Skip to content

feat: improve warning on missing asset #646

feat: improve warning on missing asset

feat: improve warning on missing asset #646

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 }}
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:
- '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: 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:
needs: [check-needs-run, generate-job-matrix]
permissions:
pull-requests: write
contents: write
issues: 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: Checkout
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' }}
uses: actions/checkout@v4
- name: Install alsa and udev
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' && runner.os == 'linux' }}
run: |
sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
sudo rm -rf /usr/share/dotnet; sudo rm -rf /opt/ghc; sudo rm -rf "/usr/local/share/boost"; sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions-rs/toolchain@v1
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' }}
with:
toolchain: stable
override: true
- name: Rust Cache
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' }}
uses: Swatinem/[email protected]
- name: Setup
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' }}
run: |
cargo xtask init
- name: Check
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' }}
run: |
${{ matrix.run_args.command }}
- name: Upload coverage artifact
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' && matrix.run_args.generates_coverage }}
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: target/coverage/html/
- name: Update coverage badge
if: ${{ needs.check-needs-run.outputs.any-changes == 'true' && matrix.run_args.generates_coverage }}
continue-on-error: true
run: |
git checkout -b chore/_update-coverage-badge || git checkout chore/_update-coverage-badge
cp target/coverage/html/badges/for_the_badge.svg badges/coverage.svg
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global push.autoSetupRemote true
git add badges/coverage.svg
if [[ -n $(git status -s) ]]; then
git commit -m "chore(badge): Update coverage badge" -m "[skip ci]"
git push -f
gh pr create --title "chore: Update coverage badge" --body "Updates coverage badge based on test results" --base ${{ github.ref }} --head chore/_update-coverage-badge > pr.txt
sed -n 's/.*pull\/\([0-9]*\).*/\1/p' pr.txt > pr_number.txt
PRNUMBER=$(cat pr_number.txt)
gh pr merge $PRNUMBER --squash
fi
generate_bindings:
name: Bindings - Synchronise
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref_name }}
- name: Setup Bot GitHub Credentials
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Setup
run: |
cargo xtask init
- name: Generate Bindings
run: |
cargo xtask codegen
- name: Check for changes
id: check_changes
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "changes=true" >> "$GITHUB_OUTPUT";
fi
- name: Commit Changes
if: steps.check_changes.outputs.changes
run: |
git add -A
git commit -m "chore(codegen): update bevy bindings"
git push