Use dedicated working directory for test #494
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
| # This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
| name: Run FileOp CI | |
| on: | |
| workflow_dispatch: # For manual triggering | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, synchronize, reopened, edited] | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| spell-check: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install spellchecker | |
| run: | |
| npm install -g [email protected] | |
| - uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46 | |
| id: changed-files | |
| with: | |
| separator: "," | |
| - name: Run spellchecker | |
| run: | | |
| # Run spellchecker with changed files | |
| mapfile -d ',' -t added_modified_files < <(printf '%s,' '${{ steps.changed-files.outputs.all_changed_and_modified_files }}') | |
| cspell --config cspell.json --color --show-suggestions "${added_modified_files[@]}" | |
| container-build: | |
| needs: | |
| - spell-check | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| BuildType: | |
| - Profile | |
| - Release | |
| runs-on: ubuntu-24.04 | |
| container: | |
| image: dockcross/windows-static-x64 | |
| steps: | |
| - name: Install git | |
| run: | | |
| export DEBIAN_FRONTEND=noninteractive | |
| apt update | |
| apt install -y git | |
| - uses: actions/checkout@v4 | |
| - name: Configure | |
| run: | | |
| git config --global --add safe.directory $PWD | |
| ./scripts/cmake.configure.sh -DCMAKE_BUILD_TYPE=${{ matrix.BuildType }} | |
| - name: Build | |
| run: | |
| ./scripts/cmake.build.sh | |
| - name: Upload ZIP | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-container${{ matrix.BuildType == 'Profile' && '-profile' || ''}} | |
| path: build/FileOp.7z | |
| build: | |
| needs: | |
| - spell-check | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| BuildType: | |
| - Profile | |
| - Release | |
| runs-on: Windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install ninja | |
| run: choco install ninja | |
| - name: Install gcovr | |
| if: ${{ matrix.BuildType == 'Profile' }} | |
| run: pip install git+https://github.com/gcovr/gcovr.git # gcovr==8.3 | |
| - name: Configure | |
| run: ./scripts/cmake.configure.sh -DCMAKE_BUILD_TYPE=${{ matrix.BuildType }} | |
| - name: Build | |
| run: ./scripts/cmake.build.sh | |
| - name: Test | |
| run: | | |
| ./scripts/cmake.test.sh || ExitCode=$? | |
| echo "::group::build/Testing/Temporary/LastTest.log" | |
| cat build/Testing/Temporary/LastTest.log | |
| echo "::endgroup::" | |
| exit $ExitCode | |
| - name: Run remove test | |
| if: always() | |
| run: ./scripts/run_test_remove.sh | |
| - name: Run performance test | |
| if: always() | |
| run: ./scripts/run_test_performance.sh 2>&1 | tee performance.txt | |
| - name: Create coverage report | |
| if: ${{ matrix.BuildType == 'Profile' && always() }} | |
| run: | | |
| gcovr \ | |
| --filter src/ \ | |
| --exclude-noncode-lines build \ | |
| --txt coverage.txt \ | |
| --markdown coverage.md --markdown-title "Test coverage report" --markdown-file-link 'https://github.com/Spacetown/FileOp/blob/${{ github.sha }}/{file}' \ | |
| --json coverage.json --json-pretty \ | |
| --html-single-page --html-title "GCOVR report for $(git rev-parse HEAD)" --html-details coverage.html | |
| cat coverage.txt | |
| gcovr --fail-under-line 100.0 --add-tracefile coverage.json > /dev/null | |
| - name: Upload coverage report | |
| if: ${{ matrix.BuildType == 'Profile' && always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage | |
| path: coverage.* | |
| - name: Upload ZIP | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-windows${{ matrix.BuildType == 'Profile' && '-profile' || ''}} | |
| path: build/FileOp.7z | |
| - name: Add job summary | |
| if: ${{ matrix.BuildType == 'Profile' && always() }} | |
| run: | | |
| ( | |
| cat coverage.md | |
| echo "" | |
| cat performance.txt | |
| ) >> $GITHUB_STEP_SUMMARY | |
| deploy: | |
| needs: | |
| - container-build | |
| - build | |
| runs-on: Windows-latest | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: app-* | |
| # cspell:ignore oapp | |
| - name: Test container build | |
| run: | | |
| 7z x -oapp-container app-container/FileOp.7z | |
| ./app-container/FileOp.exe --help | |
| - name: Test windows build | |
| run: | | |
| 7z x -oapp-windows app-windows/FileOp.7z | |
| ./app-windows/FileOp.exe --help | |
| - name: Test windows build | |
| run: | | |
| 7z x -oapp-windows-profile app-windows-profile/FileOp.7z | |
| ./app-windows-profile/FileOp.exe --help | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: coverage |