Skip to content

feat!: Bevy 0.17

feat!: Bevy 0.17 #1482

on:
push:
branches:
- main
- staging
pull_request:
branches:
- "**"
name: CI
env:
REGISTRY: ghcr.io
IMAGE_NAME: bevy-mod-scripting
CODEGEN_BRANCH_NAME: __update-bevy-bindings-${{ github.head_ref || github.ref_name }}
GH_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
RUST_BACKTRACE: 1
concurrency:
# Use github.run_id on main branch
# Use github.event.pull_request.number on pull requests, so it's unique per pull request
# Use github.ref on other branches, so it's unique per branch
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check-needs-run:
runs-on: ubuntu-latest
outputs:
any-changes: ${{ steps.changes.outputs.src }}
permissions:
pull-requests: read
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
base: main
filters: |
src:
- 'bindings/**'
- 'src/**'
- 'crates/**'
- 'examples/**'
- 'assets/**'
- 'docs/**'
- '.github/workflows/bevy_mod_scripting.yml'
generate-job-matrix:
runs-on: ubuntu-latest
# container: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Rust Cache
uses: Swatinem/rust-cache@v2.7.7
with:
# reasoning: we want to cache xtask, most of the jobs in the matrix will be sped up a good bit thanks to that
save-if: ${{ github.ref == 'refs/heads/main' }}
cache-all-crates: true
- name: Generate matrix
id: generate-matrix
run: |
cargo xtask ci-matrix > matrix.json
cat matrix.json
echo "Convert to single line JSON"
jq -c . matrix.json > matrix-one-line.json
echo "matrix=$(cat matrix-one-line.json)" >> $GITHUB_OUTPUT
check-is-fork:
runs-on: ubuntu-latest
outputs:
is_fork: ${{ steps.check-fork.outputs.is_fork }}
steps:
- name: Check if fork
id: check-fork
run: |
if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.repository }}" != "${{ github.event.pull_request.head.repo.full_name }}" ]]; then
echo "This is a forked repository."
echo "is_fork=true" >> $GITHUB_OUTPUT
else
echo "This is not a forked repository."
echo "is_fork=false" >> $GITHUB_OUTPUT
fi
check:
needs: [check-needs-run, generate-job-matrix, check-is-fork]
permissions:
pull-requests: write
contents: write
issues: write
checks: write
name: Check - ${{ matrix.run_args.name }}
runs-on: ${{ matrix.run_args.os }}
strategy:
matrix:
run_args: ${{fromJson(needs.generate-job-matrix.outputs.matrix)}}
steps:
- name: Free Disk Space (Ubuntu)
if: runner.os == 'Linux'
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks || needs.check-is-fork.outputs.is_fork != 'true') }}
uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks || needs.check-is-fork.outputs.is_fork != 'true') }}
with:
toolchain: stable
override: false
- name: Print versions
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks || needs.check-is-fork.outputs.is_fork != 'true') }}
run: |
echo "Rust version: $(rustc --version)"
echo "Clippy version: $(cargo clippy --version)"
echo "Active toolchain: $(rustup show active-toolchain)"
continue-on-error: true
- name: Rust Cache
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks || needs.check-is-fork.outputs.is_fork != 'true') }}
uses: Swatinem/rust-cache@v2.7.7
with:
# reasoning: we want to cache xtask, most of the jobs in the matrix will be sped up a good bit thanks to that
save-if: ${{ github.ref == 'refs/heads/main' }}
cache-all-crates: true
- name: Setup
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks || needs.check-is-fork.outputs.is_fork != 'true') }}
run: |
cargo xtask init
- name: Setup GPU Drivers
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks || needs.check-is-fork.outputs.is_fork != 'true') && matrix.run_args.requires_gpu }}
run: |
sudo add-apt-repository ppa:kisak/turtle -y
sudo apt-get install --no-install-recommends libxkbcommon-x11-0 xvfb libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
- name: Check
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks || needs.check-is-fork.outputs.is_fork != 'true') && !matrix.run_args.requires_gpu }}
run: |
${{ matrix.run_args.command }}
- name: Check With virtual X11 server
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' && (matrix.run_args.run_on_forks || needs.check-is-fork.outputs.is_fork != 'true') && matrix.run_args.requires_gpu }}
run: |
xvfb-run ${{ matrix.run_args.command }}
rollup-check:
name: Required Checks Successful
needs: [check]
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: Check if all jobs succeeded
run: |
if [[ "${{ needs.check.result }}" != "success" ]]; then
echo "One or more checks failed. See detailed job results above."
exit 1
else
echo "All checks passed successfully!"
fi