Run FileOp CI #516
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 | |
| permissions: | |
| contents: read | |
| 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: Install build tools | |
| run: | | |
| ./scripts/container.setup.sh | |
| - 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 gcovr==8.3 | |
| - name: Configure | |
| run: ./scripts/cmake.configure.sh -DCMAKE_BUILD_TYPE=${{ matrix.BuildType }} | |
| - name: Build | |
| run: ./scripts/cmake.build.sh | |
| - name: Upload FileOp.7z | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-windows${{ matrix.BuildType == 'Profile' && '-profile' || ''}} | |
| path: build/FileOp.7z | |
| - 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 performance test | |
| if: always() | |
| run: ./scripts/run_test_performance.sh 2>&1 | tee performance.txt | |
| - name: Upload performance report | |
| if: ${{ matrix.BuildType == 'Release' && always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: performance | |
| path: performance.txt | |
| - name: Create coverage report | |
| if: ${{ matrix.BuildType == 'Profile' && always() }} | |
| run: | | |
| gcovr \ | |
| --filter src/ \ | |
| --exclude-noncode-lines build \ | |
| --txt coverage.txt \ | |
| --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.* | |
| deploy: | |
| needs: | |
| - container-build | |
| - build | |
| runs-on: Windows-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up environment | |
| run: | | |
| echo "FILEOP_VERSION=$(scripts/get_version.sh)" >> $GITHUB_ENV | |
| - name: Download apps | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: app-* | |
| - name: Download coverage report | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: coverage | |
| - name: Download performance report | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: performance | |
| # cspell:ignore oapp | |
| - name: Test container release build | |
| run: | | |
| 7z x -oapp-container app-container/FileOp.7z | |
| ./app-container/FileOp.exe --help | |
| - name: Test windows release build | |
| run: | | |
| 7z x -oapp-windows app-windows/FileOp.7z | |
| ./app-windows/FileOp.exe --help | |
| - name: Test windows profile build | |
| run: | | |
| 7z x -oapp-windows-profile app-windows-profile/FileOp.7z | |
| ./app-windows-profile/FileOp.exe --help | |
| - name: Create release notes | |
| run: | | |
| sed -n '/^## / { p; :a; n; /^## /q; p; ba; }' Changelog.md | sed -e 's/^## /# /;' > release_notes.md | |
| - name: Add job summary | |
| run: | | |
| ( | |
| cat release_notes.md | |
| echo "" | |
| echo "# Test coverage report" | |
| echo "" | |
| echo '```' | |
| cat coverage.txt | |
| echo '```' | |
| echo "" | |
| cat performance.txt | |
| ) >> $GITHUB_STEP_SUMMARY | |
| - name: Create new tag | |
| run: | | |
| # Set git user info | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "FileOp authors" | |
| # Create the tag and print the output. | |
| sed -e "/^# / { s/^# //; s/$/ $(date -I)/; }" release_notes.md | tee commit_msg.txt | |
| git tag -a "$FILEOP_VERSION" -F commit_msg.txt | |
| git tag --list -n "$FILEOP_VERSION" | |
| - name: Push new tag | |
| if: ${{ (github.repository == 'ZF-Group/FileOp') && (github.event.ref == 'refs/heads/main') && (env.FILEOP_VERSION != '0.0.0') }} | |
| run: | | |
| git push origin "refs/tags/$FILEOP_VERSION" | |
| - name: Create release and upload build artifacts | |
| if: ${{ (github.repository == 'ZF-Group/FileOp') && (github.event.ref == 'refs/heads/main') && (env.FILEOP_VERSION != '0.0.0') }} | |
| uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 | |
| with: | |
| tag_name: ${{ env.FILEOP_VERSION }} | |
| body_path: release_notes.md | |
| files: ./app-windows/FileOp.exe | |