diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 22f22bfa..899bbe0b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,12 +2,20 @@ name: ๐Ÿ“ฆ Build & Test Docker Image on: push: + paths-ignore: [ "docs/**", "**/*.md" ] branches: [ "master" ] tags: [ 'v*.*.*' ] pull_request: + paths-ignore: [ "docs/**", "**/*.md" ] branches: [ "master" ] workflow_dispatch: +# A new push to a PR cancels its older run. Pushes to branches, tags and +# releases each get their own group, so none is ever queued or dropped. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} diff --git a/.github/workflows/invariants.yml b/.github/workflows/invariants.yml index a62dcb53..da8c1f9f 100644 --- a/.github/workflows/invariants.yml +++ b/.github/workflows/invariants.yml @@ -11,13 +11,21 @@ name: ๐Ÿ”ฌ Model Invariants (Linux) on: push: + paths-ignore: [ "docs/**", "**/*.md" ] branches: - "master" - "dev" pull_request: + paths-ignore: [ "docs/**", "**/*.md" ] branches: [ "master", "dev" ] workflow_dispatch: +# A new push to a PR cancels its older run. Pushes to branches, tags and +# releases each get their own group, so none is ever queued or dropped. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + jobs: invariants: name: Dead fuel moisture invariants diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index a940bfb9..2d6fb4e5 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -2,12 +2,20 @@ name: ๐Ÿงช Test Native (macOS) on: push: + paths-ignore: [ "docs/**", "**/*.md" ] branches: - brew pull_request: + paths-ignore: [ "docs/**", "**/*.md" ] branches: [ "master", "dev" ] workflow_dispatch: +# A new push to a PR cancels its older run. Pushes to branches, tags and +# releases each get their own group, so none is ever queued or dropped. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + jobs: build-native-macos: runs-on: macos-latest diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ff104d63..efcca169 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,13 +2,21 @@ name: ๐Ÿงช Test Native (Linux) on: push: + paths-ignore: [ "docs/**", "**/*.md" ] branches: - "master" - "dev" pull_request: + paths-ignore: [ "docs/**", "**/*.md" ] branches: [ "master", "dev" ] workflow_dispatch: +# A new push to a PR cancels its older run. Pushes to branches, tags and +# releases each get their own group, so none is ever queued or dropped. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + jobs: build-native: runs-on: ubuntu-latest diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml index f0a204de..e5022ad2 100644 --- a/.github/workflows/sanitizers.yml +++ b/.github/workflows/sanitizers.yml @@ -22,13 +22,21 @@ name: ๐Ÿงผ Sanitizers (Linux) on: push: + paths-ignore: [ "docs/**", "**/*.md" ] branches: - "master" - "dev" pull_request: + paths-ignore: [ "docs/**", "**/*.md" ] branches: [ "master", "dev" ] workflow_dispatch: +# A new push to a PR cancels its older run. Pushes to branches, tags and +# releases each get their own group, so none is ever queued or dropped. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + jobs: address-sanitizer: name: AddressSanitizer diff --git a/.github/workflows/wasm-pages.yml b/.github/workflows/wasm-pages.yml deleted file mode 100644 index 34b6f2e1..00000000 --- a/.github/workflows/wasm-pages.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: ๐ŸŒ Build WASM & Deploy Demo - -# Builds the WebAssembly module (issue #171) and publishes the browser demo to -# GitHub Pages. The .wasm is built here rather than committed: it is a megabyte -# of generated output, and a stale binary next to live sources is worse than a -# two minute build. - -# Publishes from dev. The github-pages environment has to allow dev as a -# deployment branch (Settings โ†’ Environments โ†’ github-pages). -on: - push: - branches: [ "dev" ] - workflow_dispatch: - -permissions: - contents: read - pages: write - id-token: write - -# One deployment at a time; queued runs supersede rather than race. -concurrency: - group: pages - cancel-in-progress: false - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v6 - # No LFS: the WASM build reads no test data, and emcmake turns the - # integrity check off by default. - - - name: Cache Emscripten SDK - id: emsdk-cache - uses: actions/cache@v4 - with: - path: ~/emsdk - key: emsdk-${{ runner.os }}-6.0.6 - - - name: Install Emscripten - if: steps.emsdk-cache.outputs.cache-hit != 'true' - run: | - # Pinned to the version the demo was developed and tested against. - git clone --depth 1 https://github.com/emscripten-core/emsdk.git ~/emsdk - ~/emsdk/emsdk install 6.0.6 - ~/emsdk/emsdk activate 6.0.6 - - - name: Build the WebAssembly module - run: | - source ~/emsdk/emsdk_env.sh - emcmake cmake -S . -B build-wasm -DCMAKE_BUILD_TYPE=Release - cmake --build build-wasm -j"$(nproc)" - - - name: Report size - run: | - { - echo "### WebAssembly build" - echo "| file | raw | gzip | brotli |" - echo "| --- | --- | --- | --- |" - for f in bin/forefire.wasm bin/forefire.mjs; do - printf '| `%s` | %s | %s | %s |\n' "$(basename "$f")" \ - "$(stat -c%s "$f" | numfmt --to=iec)" \ - "$(gzip -c "$f" | wc -c | numfmt --to=iec)" \ - "$(brotli -c "$f" | wc -c | numfmt --to=iec)" - done - } | tee -a "$GITHUB_STEP_SUMMARY" - - - name: Smoke test under Node - run: node bindings/wasm/smoke.mjs bin/forefire.mjs - - - name: Assemble the site - run: | - mkdir -p _site - cp bin/forefire.mjs bin/forefire.wasm _site/ - cp bindings/wasm/index.html bindings/wasm/worker.mjs \ - bindings/wasm/landscape.mjs bindings/wasm/terrain3d.mjs _site/ - # Pages serves through Jekyll unless told otherwise, which would - # swallow files it does not recognise. - touch _site/.nojekyll - - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - path: _site - - deploy: - needs: build - runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index 05f7428f..0b92a82c 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -1,19 +1,31 @@ name: ๐ŸŒ Build WASM -# Builds the WebAssembly module (issue #171) and runs the Node smoke test. The -# .wasm is built here rather than committed: it is a megabyte of generated +# Builds the WebAssembly module (issue #171) and runs the Node smoke test. On +# dev it also publishes the browser demo to GitHub Pages, from the same build. +# The .wasm is built here rather than committed: it is a megabyte of generated # output, and a stale binary next to live sources is worse than a two minute # build. +# +# The github-pages environment has to allow dev as a deployment branch +# (Settings โ†’ Environments โ†’ github-pages). on: push: + paths-ignore: [ "docs/**", "**/*.md" ] branches: - "master" - "dev" pull_request: + paths-ignore: [ "docs/**", "**/*.md" ] branches: [ "master", "dev" ] workflow_dispatch: +# A new push to a PR cancels its older run. Pushes to branches, tags and +# releases each get their own group, so none is ever queued or dropped. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + permissions: contents: read @@ -63,3 +75,40 @@ jobs: - name: Smoke test under Node run: node bindings/wasm/smoke.mjs bin/forefire.mjs + + # The demo is published from dev only. + - name: Assemble the site + if: github.ref == 'refs/heads/dev' && github.event_name != 'pull_request' + run: | + mkdir -p _site + cp bin/forefire.mjs bin/forefire.wasm _site/ + cp bindings/wasm/index.html bindings/wasm/worker.mjs \ + bindings/wasm/landscape.mjs bindings/wasm/terrain3d.mjs _site/ + # Pages serves through Jekyll unless told otherwise, which would + # swallow files it does not recognise. + touch _site/.nojekyll + + - name: Upload artifact + if: github.ref == 'refs/heads/dev' && github.event_name != 'pull_request' + uses: actions/upload-pages-artifact@v3 + with: + path: _site + + deploy: + needs: build-wasm + if: github.ref == 'refs/heads/dev' && github.event_name != 'pull_request' + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + # One deployment at a time; queued runs supersede rather than race. + concurrency: + group: pages + cancel-in-progress: false + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 35fb3218..be10018e 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -2,19 +2,23 @@ name: ๐Ÿ Build Python wheels on: push: + paths-ignore: [ "docs/**", "**/*.md" ] branches: - "master" tags: - "v*" pull_request: + paths-ignore: [ "docs/**", "**/*.md" ] branches: [ "master" ] release: types: [ published ] workflow_dispatch: +# A new push to a PR cancels its older run. Pushes to branches, tags and +# releases each get their own group, so none is ever queued or dropped. concurrency: - group: wheels-${{ github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true jobs: build-wheels: