Skip to content

remove more panics in macros #445

remove more panics in macros

remove more panics in macros #445

on:
push:
branches:
- "**"
paths-ignore:
- '.github/workflows/release-plz.yml'
- 'docs/**'
name: Check and Lint - bevy_mod_scripting
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:
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:
permissions:
pull-requests: write
contents: write
name: Check - ${{ matrix.run_args.name }}
runs-on: ${{ matrix.run_args.os }}
# container: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
needs:
- generate-job-matrix
strategy:
matrix:
run_args: ${{fromJson(needs.generate-job-matrix.outputs.matrix)}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install alsa and udev
if: 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
with:
toolchain: stable
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
- name: Setup
run: |
cargo xtask init
- name: Check
run: |
${{ matrix.run_args.command }}
- name: Upload coverage artifact
if: ${{ matrix.run_args.generates_coverage }}
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: target/coverage/html/
- name: Update coverage badge
if: ${{ matrix.run_args.generates_coverage && github.ref == 'refs/heads/main' }}
run: |
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 add badges/coverage.svg
if [[ -n $(git status -s) ]]; then
git commit -m "chore(badge): Update coverage badge" -m "[skip ci]"
git push
fi
generate_bindings:
name: Bindings - Synchronise
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 checkout -b ${{ env.CODEGEN_BRANCH_NAME }} || git checkout ${{ env.CODEGEN_BRANCH_NAME }}
git add -A
git commit -m "chore(codegen): update bevy bindings"
git push -u origin ${{ env.CODEGEN_BRANCH_NAME }} --force
- uses: jwalton/gh-find-current-pr@master
if: steps.check_changes.outputs.changes
id: findPR
with:
state: all
- name: Create Or Update PR
if: steps.check_changes.outputs.changes && success() && steps.findPR.outputs.number
run: |
gh pr list --base ${{ github.ref }} --search "chore(codegen): update bevy bindings" --json number > prs.json
if [ $(jq '. | length' prs.json) -eq 0 ]; then
gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings for #${{ steps.findPR.outputs.number }}" --base ${{ github.ref }} --head ${{ env.CODEGEN_BRANCH_NAME }} || true
fi