|
1 | | -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
2 | | -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
3 | | - |
4 | | -name: Run FileOp CI |
5 | | - |
6 | | -on: |
7 | | - workflow_dispatch: # For manual triggering |
8 | | - push: |
9 | | - branches: |
10 | | - - main |
11 | | - pull_request: |
12 | | - types: [opened, synchronize, reopened, edited] |
13 | | - |
14 | | -jobs: |
15 | | - |
16 | | - spell-check: |
17 | | - runs-on: ubuntu-22.04 |
18 | | - steps: |
19 | | - - uses: actions/checkout@v4 |
20 | | - - name: Install spellchecker |
21 | | - run: |
22 | | - npm install -g cspell@latest |
23 | | - - name: Run spellchecker |
24 | | - run: | |
25 | | - cspell |
| 1 | +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
| 2 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
| 3 | + |
| 4 | +name: Run FileOp CI |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_dispatch: # For manual triggering |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + pull_request: |
| 12 | + types: [opened, synchronize, reopened, edited] |
| 13 | + |
| 14 | +defaults: |
| 15 | + run: |
| 16 | + shell: bash |
| 17 | + |
| 18 | +jobs: |
| 19 | + |
| 20 | + spell-check: |
| 21 | + runs-on: ubuntu-22.04 |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + - name: Install spellchecker |
| 25 | + run: |
| 26 | + npm install -g cspell@8.19.4 |
| 27 | + - uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46 |
| 28 | + id: changed-files |
| 29 | + with: |
| 30 | + separator: "," |
| 31 | + - name: Run spellchecker |
| 32 | + run: | |
| 33 | + # Run spellchecker with changed files |
| 34 | + mapfile -d ',' -t added_modified_files < <(printf '%s,' '${{ steps.changed-files.outputs.all_changed_and_modified_files }}') |
| 35 | + cspell --config cspell.json --color --show-suggestions "${added_modified_files[@]}" |
| 36 | +
|
| 37 | + container-build: |
| 38 | + needs: |
| 39 | + - spell-check |
| 40 | + strategy: |
| 41 | + fail-fast: false |
| 42 | + matrix: |
| 43 | + BuildType: |
| 44 | + - Profile |
| 45 | + - Release |
| 46 | + runs-on: ubuntu-24.04 |
| 47 | + container: |
| 48 | + image: dockcross/windows-static-x64 |
| 49 | + |
| 50 | + steps: |
| 51 | + - name: Install git |
| 52 | + run: | |
| 53 | + export DEBIAN_FRONTEND=noninteractive |
| 54 | + apt update |
| 55 | + apt install -y git |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + |
| 58 | + - name: Configure |
| 59 | + run: | |
| 60 | + git config --global --add safe.directory $PWD |
| 61 | + ./scripts/cmake.configure.sh -DCMAKE_BUILD_TYPE=${{ matrix.BuildType }} |
| 62 | + - name: Build |
| 63 | + run: |
| 64 | + ./scripts/cmake.build.sh |
| 65 | + |
| 66 | + - name: Upload ZIP |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + with: |
| 69 | + name: app-container${{ matrix.BuildType == 'Profile' && '-profile' || ''}} |
| 70 | + path: build/FileOp.7z |
| 71 | + |
| 72 | + build: |
| 73 | + needs: |
| 74 | + - spell-check |
| 75 | + strategy: |
| 76 | + fail-fast: false |
| 77 | + matrix: |
| 78 | + BuildType: |
| 79 | + - Profile |
| 80 | + - Release |
| 81 | + runs-on: Windows-latest |
| 82 | + |
| 83 | + steps: |
| 84 | + - uses: actions/checkout@v4 |
| 85 | + - name: Install ninja |
| 86 | + run: choco install ninja |
| 87 | + - name: Install gcovr |
| 88 | + if: ${{ matrix.BuildType == 'Profile' }} |
| 89 | + run: pip install git+https://github.com/gcovr/gcovr.git # gcovr==8.3 |
| 90 | + |
| 91 | + - name: Configure |
| 92 | + run: ./scripts/cmake.configure.sh -DCMAKE_BUILD_TYPE=${{ matrix.BuildType }} |
| 93 | + - name: Build |
| 94 | + run: ./scripts/cmake.build.sh |
| 95 | + - name: Test |
| 96 | + run: | |
| 97 | + ./scripts/cmake.test.sh || ExitCode=$? |
| 98 | + echo "::group::build/Testing/Temporary/LastTest.log" |
| 99 | + cat build/Testing/Temporary/LastTest.log |
| 100 | + echo "::endgroup::" |
| 101 | + exit $ExitCode |
| 102 | + - name: Run performance test |
| 103 | + if: always() |
| 104 | + run: ./scripts/run_test_performance.sh 2>&1 | tee performance.txt |
| 105 | + |
| 106 | + - name: Create coverage report |
| 107 | + if: ${{ matrix.BuildType == 'Profile' && always() }} |
| 108 | + run: | |
| 109 | + gcovr \ |
| 110 | + --filter src/ \ |
| 111 | + --exclude-noncode-lines build \ |
| 112 | + --txt coverage.txt \ |
| 113 | + --markdown coverage.md --markdown-title "Test coverage report" --markdown-file-link 'https://github.com/Spacetown/FileOp/blob/${{ github.sha }}/{file}' \ |
| 114 | + --json coverage.json --json-pretty \ |
| 115 | + --html-single-page --html-title "GCOVR report for $(git rev-parse HEAD)" --html-details coverage.html |
| 116 | + cat coverage.txt |
| 117 | + gcovr --fail-under-line 100.0 --add-tracefile coverage.json > /dev/null |
| 118 | + - name: Upload coverage report |
| 119 | + if: ${{ matrix.BuildType == 'Profile' && always() }} |
| 120 | + uses: actions/upload-artifact@v4 |
| 121 | + with: |
| 122 | + name: coverage |
| 123 | + path: coverage.* |
| 124 | + |
| 125 | + - name: Upload ZIP |
| 126 | + if: always() |
| 127 | + uses: actions/upload-artifact@v4 |
| 128 | + with: |
| 129 | + name: app-windows${{ matrix.BuildType == 'Profile' && '-profile' || ''}} |
| 130 | + path: build/FileOp.7z |
| 131 | + |
| 132 | + - name: Add job summary |
| 133 | + if: ${{ matrix.BuildType == 'Profile' && always() }} |
| 134 | + run: | |
| 135 | + ( |
| 136 | + cat coverage.md |
| 137 | + echo "" |
| 138 | + cat performance.txt |
| 139 | + ) >> $GITHUB_STEP_SUMMARY |
| 140 | +
|
| 141 | + deploy: |
| 142 | + needs: |
| 143 | + - container-build |
| 144 | + - build |
| 145 | + runs-on: Windows-latest |
| 146 | + steps: |
| 147 | + - name: Download artifacts |
| 148 | + uses: actions/download-artifact@v4 |
| 149 | + with: |
| 150 | + pattern: app-* |
| 151 | + # cspell:ignore oapp |
| 152 | + - name: Test container release build |
| 153 | + run: | |
| 154 | + 7z x -oapp-container app-container/FileOp.7z |
| 155 | + ./app-container/FileOp.exe --help |
| 156 | + - name: Test windows release build |
| 157 | + run: | |
| 158 | + 7z x -oapp-windows app-windows/FileOp.7z |
| 159 | + ./app-windows/FileOp.exe --help |
| 160 | + - name: Test windows profile build |
| 161 | + run: | |
| 162 | + 7z x -oapp-windows-profile app-windows-profile/FileOp.7z |
| 163 | + ./app-windows-profile/FileOp.exe --help |
0 commit comments