Use ccache-ghac-adapter #9860
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: 'Check: Unit Tests (utest)' | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| code_coverage: | |
| description: 'Enable code coverage' | |
| required: false | |
| type: boolean | |
| default: false | |
| schedule: | |
| - cron: "0 3 * * 4" # Every Thursday night at 03:00 for master branch | |
| jobs: | |
| run_tests: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Cancel Previous Runs | |
| uses: styfle/[email protected] | |
| with: | |
| access_token: ${{ github.token }} | |
| - name: Clone repository | |
| uses: actions/checkout@v6 | |
| - name: "Configure workflow" | |
| run: | | |
| bash ./buildscripts/ci/tools/make_build_number.sh | |
| BUILD_NUMBER=$(cat ./build.artifacts/env/build_number.env) | |
| echo "BUILD_NUMBER=$BUILD_NUMBER" | tee -a $GITHUB_ENV | |
| - name: Set up ccache | |
| uses: cbjeukendrup/[email protected] | |
| with: | |
| namespace: ccache-${{runner.os}}-${{runner.arch}} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Configure ccache | |
| run: | | |
| bash ./buildscripts/ci/tools/setup_ccache_config.sh | |
| - name: Free up disk space | |
| run: | | |
| sudo docker system prune -a -f | |
| sudo rm -rf /usr/local/lib/android | |
| - name: Install Qt | |
| uses: jurplel/install-qt-action@v4 | |
| with: | |
| version: 6.10.0 | |
| host: 'linux' | |
| target: 'desktop' | |
| arch: 'linux_gcc_64' | |
| modules: 'qt5compat qtnetworkauth qtscxml qtshadertools qtwebsockets' | |
| - name: Setup environment | |
| run: | | |
| bash ./buildscripts/ci/linux/setup.sh | |
| - name: Build | |
| env: | |
| GITHUB_EVENT_NAME: ${{ github.event_name }} | |
| CODE_COVERAGE: ${{ inputs.code_coverage }} | |
| run: | | |
| mkdir -p build.artifacts/env | |
| ENABLE_CODE_COVERAGE='false' | |
| if [[ "$GITHUB_EVENT_NAME" == "schedule" || "$CODE_COVERAGE" == true ]]; then | |
| ENABLE_CODE_COVERAGE='true' | |
| else | |
| ENABLE_CODE_COVERAGE='false' | |
| fi | |
| bash ./buildscripts/ci/linux/build_utest.sh -n ${{ env.BUILD_NUMBER }} --enable_code_coverage ${ENABLE_CODE_COVERAGE} | |
| echo "============== ccache ===============" | |
| ccache -sv | |
| - name: Run tests | |
| run: | | |
| bash ./buildscripts/ci/linux/runutests.sh | |
| env: | |
| ASAN_OPTIONS: "detect_leaks=0" | |
| - name: Code coverage | |
| if: ( github.event_name == 'schedule' || inputs.code_coverage ) && github.repository == 'musescore/MuseScore' | |
| run: | | |
| lcov --capture --directory "$(pwd)/build.debug/" --output-file coverage.info | |
| lcov --remove coverage.info '/usr/*' '*/tests/*' '*/thirdparty/*' '*/moc_*' '*framework/Headers/*' '*/hb-*' '*/Qt/*' --output-file filtered_coverage.info | |
| python3 buildscripts/ci/linux/tools/lcov_badger.py filtered_coverage.info coverage_badge.svg | |
| - name: Push to S3 | |
| if: ( github.event_name == 'schedule' || inputs.code_coverage ) && github.repository == 'musescore/MuseScore' | |
| run: | | |
| S3_URL='s3://extensions.musescore.org/test/code_coverage/coverage_badge.svg' | |
| bash ./buildscripts/ci/tools/s3_push_file.sh \ | |
| --s3_key '${{ secrets.S3_KEY }}' \ | |
| --s3_secret '${{ secrets.S3_SECRET }}' \ | |
| --s3_url "${S3_URL}" \ | |
| --file_path "coverage_badge.svg" |