allow skipping build steps #254
This file contains 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: [push] | |
jobs: | |
build-frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 19 | |
cache: 'npm' | |
cache-dependency-path: '**/package-lock.json' | |
- name: Build React viewer | |
working-directory: ${{github.workspace}}/FlipViewer | |
run: npm install && npm run build | |
- name: Upload bundle | |
uses: actions/upload-artifact@v4 | |
with: | |
name: frontend | |
path: ${{github.workspace}}/FlipViewer/dist/flipbook.js | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# max-parallel: 1 # artifact upload fails if multiple runners upload the same file simultaneously | |
matrix: | |
os: [ macos-latest, ubuntu-latest, windows-latest ] | |
needs: [ build-frontend ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
check-latest: true | |
- name: Fetch Python build dependencies | |
run: python -m pip install --user wheel | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- uses: actions/download-artifact@v4 | |
with: | |
name: frontend | |
path: ${{github.workspace}}/frontend | |
# TODO This fails to compile chrono.h but supposedly works again with LLVM 19 | |
# - name: Install ninja and clang on Windows | |
# run: choco install ninja && choco upgrade llvm | |
# if: runner.os == 'Windows' | |
- name: Build and test | |
run: ./make.ps1 -prebuiltFrontend frontend/flipbook.js | |
shell: pwsh | |
- name: Upload Binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: runtimes-${{matrix.os}} | |
path: ${{github.workspace}}/runtimes/* | |
overwrite: true | |
pack: | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: runtimes-* | |
merge-multiple: true | |
path: ${{github.workspace}}/runtimes | |
- uses: actions/download-artifact@v4 | |
with: | |
name: frontend | |
path: ${{github.workspace}}/frontend | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Build and test | |
run: ./make.ps1 -prebuiltFrontend frontend/flipbook.js -skipRuntimes 1 | |
shell: pwsh | |
- name: Pack | |
run: dotnet pack -c Release | |
- name: Upload .nupkg | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{github.workspace}}/SimpleImageIO/bin/**/*.nupkg | |
- name: Publish on version change | |
uses: alirezanet/publish-nuget@v3.0.4 | |
with: | |
PROJECT_FILE_PATH: SimpleImageIO/SimpleImageIO.csproj | |
NUGET_KEY: ${{secrets.NUGET_API_KEY}} | |
- name: Remove wheel | |
run: rm ./dist/*.whl | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
skip-existing: true |