Skip to content

Commit

Permalink
feat: even more improvements
Browse files Browse the repository at this point in the history
Actually export cache keys to Github output, only use a cache when not in a merge group, customize Rust installation for WASM, and use proper command for docs.
  • Loading branch information
BD103 committed Apr 20, 2024
1 parent 47d7144 commit 142a504
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
7 changes: 4 additions & 3 deletions .github/actions/cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ runs:
- name: Calculate restore key
id: restore-key
shell: bash
run: echo key=${{ inputs.kind }}-${{ inputs.toolchain }}-${{ runner.os }}-${{ inputs.target }}
run: echo key=${{ inputs.kind }}-${{ inputs.toolchain }}-${{ runner.os }}-${{ inputs.target }} >> $GITHUB_OUTPUT

# But wait, I thought we were calculating the cache key in the previous step? What are we doing here?
#
Expand All @@ -68,7 +68,7 @@ runs:
- name: Calculate cache key
id: cache-key
shell: bash
run: echo key=${{ steps.restore-key.outputs.key }}-${{ steps.date.outputs.date }}
run: echo key=${{ steps.restore-key.outputs.key }}-${{ steps.date.outputs.date }} >> $GITHUB_OUTPUT

# Either save a new cache...
- name: Save cache
Expand All @@ -88,7 +88,8 @@ runs:

# ...or restore an existing cache.
- name: Restore cache
if: ${{ inputs.action == 'restore' }}
# We do not use the cache when in the merge queue.
if: ${{ inputs.action == 'restore' && github.event_name == 'merge_group' }}
uses: actions/cache/restore@v4
with:
path: |
Expand Down
35 changes: 32 additions & 3 deletions .github/workflows/create-caches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,43 @@ jobs:
uses: actions/checkout@v4

- name: Install Rust
if: ${{ matrix.target == 'default' }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}

- name: Install Rust (WASM)
if: ${{ matrix.target == 'wasm' }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
target: wasm32-unknown-unknown

- name: Install Rust (WASM Atomics)
if: ${{ matrix.target == 'wasm-atomics' }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
target: wasm32-unknown-unknown
components: rust-src

- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps

- name: Build workspace
- name: Check workspace
if: ${{ matrix.target == 'default' }}
run: cargo check --workspace

- name: Check workspace
if: ${{ matrix.target == 'wasm' }}
run: cargo check --workspace --target wasm32-unknown-unknown

- name: Check workspace
if: ${{ matrix.target == 'wasm-atomics' }}
run: cargo check --workspace --target wasm32-unknown-unknown -Z build-std=std,panic_abort
env:
RUSTFLAGS: "-C target-feature=+atomics,+bulk-memory"

- name: Save cache
uses: ./.github/actions/cache
with:
Expand Down Expand Up @@ -108,8 +135,10 @@ jobs:
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps

- name: Build workspace
run: cargo doc -p bevy --no-deps
- name: Document workspace
run: |
cargo doc --workspace --all-features --no-deps --document-private-items
cargo test --workspace --doc
- name: Save cache
uses: ./.github/actions/cache
Expand Down

0 comments on commit 142a504

Please sign in to comment.