Skip to content

Commit

Permalink
wasm examples: update the GitHub actions (#1124)
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Mar 25, 2024
1 parent f108fec commit 8104fac
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 16 deletions.
34 changes: 20 additions & 14 deletions .github/workflows/build-wasm-examples.yml
Expand Up @@ -7,13 +7,31 @@ env:
PER_PAGE: 50

jobs:
prepare-pages:
name: Get Pages
runs-on: ubuntu-latest
outputs:
pages: ${{ steps.pages.outputs.pages }}
steps:
- name: Checkout Bevy main branch
uses: actions/checkout@v4
with:
repository: 'bevyengine/bevy'
ref: 'latest'
- name: Get Pages
id: pages
run: |
example_count=`cat Cargo.toml | grep 'wasm = true' | wc -l`
page_count=$((example_count / ${{ env.PER_PAGE }} + 1))
echo "pages=`jq -n -c \"[range($page_count)]\"`" >> $GITHUB_OUTPUT
wasm-examples:
name: Build WASM Examples
needs: prepare-pages
runs-on: macos-latest
strategy:
matrix:
# if all examples are not built, add a new page here
page: [0, 1, 2]
page: ${{ fromJSON(needs.prepare-pages.outputs.pages) }}
api: [webgl2, webgpu]
steps:

Expand All @@ -23,18 +41,6 @@ jobs:
repository: 'bevyengine/bevy'
ref: 'latest'

# temporary: fetch tools from main branch
- name: Checkout Bevy Tools
uses: actions/checkout@v4
with:
repository: 'bevyengine/bevy'
ref: 'main'
path: 'bevy-tools'
- name: Copy Bevy tools to latest
run: |
cp -r bevy-tools/tools/ tools
rm -rf bevy-tools
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/update-screenshots.yml
Expand Up @@ -7,13 +7,31 @@ env:
PER_PAGE: 20

jobs:
prepare-pages:
name: Get Pages
runs-on: ubuntu-latest
outputs:
pages: ${{ steps.pages.outputs.pages }}
steps:
- name: Checkout Bevy main branch
uses: actions/checkout@v4
with:
repository: 'bevyengine/bevy'
ref: 'latest'
- name: Get Pages
id: pages
run: |
example_count=`cat Cargo.toml | grep '\[\[example\]\]' | wc -l`
page_count=$((example_count / ${{ env.PER_PAGE }} + 1))
echo "pages=`jq -n -c \"[range($page_count)]\"`" >> $GITHUB_OUTPUT
take-screenshots:
name: Take Screenshots
needs: prepare-pages
runs-on: ubuntu-latest
strategy:
matrix:
# if all examples are not built, add a new page here
page: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
page: ${{ fromJSON(needs.prepare-pages.outputs.pages) }}
steps:

- name: Checkout Bevy latest tag
Expand Down

0 comments on commit 8104fac

Please sign in to comment.