Speed up appveyor build (#317) #186
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - build_type: Debug | |
| - build_type: Release | |
| env: | |
| BUILD_TYPE: ${{ matrix.build_type }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup vcpkg (with binary caching) | |
| uses: lukka/run-vcpkg@v11 | |
| with: | |
| runVcpkgInstall: false | |
| vcpkgDirectory: "${{ github.workspace }}/.vcpkg" | |
| vcpkgGitCommitId: "58950f88544e4637524dbd6a01d0317cf4cb77fc" | |
| - name: Install dependencies | |
| shell: bash | |
| run: $VCPKG_ROOT/vcpkg install boost-container-hash gtest | |
| - name: Create Build Environment | |
| run: cmake -E make_directory ${{runner.workspace}}/terminalpp/build | |
| - name: Configure CMake | |
| shell: bash | |
| working-directory: ${{runner.workspace}}/terminalpp/build | |
| run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake | |
| - name: Build | |
| shell: bash | |
| working-directory: ${{runner.workspace}}/terminalpp/build | |
| run: cmake --build . --config $BUILD_TYPE | |
| - name: Test | |
| working-directory: ${{runner.workspace}}/terminalpp/build | |
| shell: bash | |
| run: ctest -C $BUILD_TYPE --output-on-failure | |
| build-coverage: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - build_type: Debug | |
| env: | |
| BUILD_TYPE: ${{ matrix.build_type }} | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup vcpkg (with binary caching) | |
| uses: lukka/run-vcpkg@v11 | |
| with: | |
| runVcpkgInstall: false | |
| vcpkgDirectory: "${{ github.workspace }}/.vcpkg" | |
| vcpkgGitCommitId: "58950f88544e4637524dbd6a01d0317cf4cb77fc" | |
| - name: Install dependencies | |
| shell: bash | |
| run: $VCPKG_ROOT/vcpkg install boost-container-hash gtest | |
| - name: Extract branch name | |
| shell: bash | |
| run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
| id: extract_branch | |
| # Build a cache for LCOV. | |
| - name: Cache lcov | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.lcov | |
| key: lcov-cache-${{ steps.extract_branch.outputs.branch }} | |
| restore-keys: | | |
| lcov-cache-master | |
| - name: Install LCOV | |
| shell: bash | |
| run: | | |
| if [ ! -f "$HOME/.lcov/usr/local/bin/lcov" ]; then | |
| mkdir $HOME/.lcov-build || true; | |
| cd $HOME/.lcov-build; | |
| wget https://github.com/linux-test-project/lcov/releases/download/v1.16/lcov-1.16.tar.gz | |
| tar -xzf lcov-1.16.tar.gz; | |
| mkdir -p $HOME/.lcov || true; | |
| DESTDIR=$HOME/.lcov make -C lcov-1.16/ install; | |
| fi | |
| echo "##[set-output name=bin;]$(echo $HOME/.lcov/usr/local/bin/lcov)" | |
| id: lcov | |
| - name: Create Build Environment | |
| run: cmake -E make_directory ${{runner.workspace}}/terminalpp/build | |
| - name: Configure CMake | |
| shell: bash | |
| working-directory: ${{runner.workspace}}/terminalpp/build | |
| run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DTERMINALPP_COVERAGE=True | |
| - name: Build | |
| shell: bash | |
| working-directory: ${{runner.workspace}}/terminalpp/build | |
| run: cmake --build . --config $BUILD_TYPE | |
| - name: Zero test counters | |
| shell: bash | |
| run: ${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-13 --base-directory ${{runner.workspace}}/terminalpp/build --directory ${{runner.workspace}}/terminalpp/build --zerocounters -q | |
| - name: Test | |
| working-directory: ${{runner.workspace}}/terminalpp/build | |
| shell: bash | |
| run: ctest -C $BUILD_TYPE | |
| - name: Calculate coverage | |
| shell: bash | |
| run: | | |
| ${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-13 --base-directory ${{runner.workspace}}/terminalpp/build --directory ${{runner.workspace}}/terminalpp/build --capture --output-file coverage.info; | |
| ${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-13 --remove coverage.info '*/test/*' '/usr/*' '*/3party/*' '*/.vcpkg/*' '*/vcpkg_installed/*' --output-file coverage.info; | |
| ${{ steps.lcov.outputs.bin }} --gcov-tool=gcov-13 --list coverage.info; | |
| - name: Post coverage to Coveralls | |
| uses: coverallsapp/github-action@master | |
| with: | |
| path-to-lcov: coverage.info | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Post coverage to Codacy | |
| if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }} | |
| uses: codacy/codacy-coverage-reporter-action@v1 | |
| with: | |
| project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
| coverage-reports: coverage.info | |
| build-docs: | |
| runs-on: ubuntu-latest | |
| # Only build documentation for valid builds on master. | |
| needs: [build] | |
| if: github.ref == 'refs/heads/master' | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Doxygen | |
| shell: bash | |
| run: sudo apt install doxygen | |
| - name: Create Build Environment | |
| run: cmake -E make_directory ${{runner.workspace}}/terminalpp/build | |
| - name: Configure CMake | |
| shell: bash | |
| working-directory: ${{runner.workspace}}/terminalpp/build | |
| run: cmake $GITHUB_WORKSPACE -DTERMINALPP_DOC_ONLY=True | |
| - name: Build | |
| working-directory: ${{runner.workspace}}/terminalpp/build | |
| shell: bash | |
| run: cmake --build . --target terminalpp_doc | |
| - uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ${{runner.workspace}}/terminalpp/build/html |