Skip to content

Commit

Permalink
compute the number of pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Mar 20, 2024
1 parent 031aed7 commit 0ceec76
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
22 changes: 20 additions & 2 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 '\[\[example\]\]' | wc -l`
page_count=$((example_count / ${{ env.PER_PAGE }} + 1))
echo "pages=`python -c \"import json; print(json.dumps([i for i in 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 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=`python -c \"import json; print(json.dumps([i for i in 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 0ceec76

Please sign in to comment.