Check Releasability #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check Releasability | |
| on: | |
| push: | |
| workflow_dispatch: | |
| env: | |
| RUSTFLAGS: "-D warnings" | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_PROFILE_TEST_DEBUG: 0 | |
| CARGO_PROFILE_DEV_DEBUG: 0 | |
| jobs: | |
| split-crates: | |
| name: Prepare crate list | |
| runs-on: ubuntu-latest | |
| outputs: | |
| crates: ${{ steps.env.outputs.crates }} | |
| steps: | |
| - name: Checkout Bevy | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: bevyengine/bevy | |
| ref: main | |
| - name: Prepare crate list | |
| id: env | |
| run: | | |
| # remove workspace members that are not published | |
| sed -z -i 's/members = \[[^]]*\]/members = ["crates\/*"]/' Cargo.toml | |
| crate_list=`cargo test -p 2>&1 | grep ' '` | |
| echo "crates=`python3 -c \"import json; crate_list_str='''$crate_list''';crate_list=[crate.strip() for crate in crate_list_str.splitlines()];crate_list.sort();print(json.dumps(crate_list))\"`" >> $GITHUB_OUTPUT | |
| crate-check: | |
| name: Check | |
| needs: [split-crates] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| crate: ${{ fromJSON(needs.split-crates.outputs.crates) }} | |
| extra: ["", "--all-features", "--no-default-features"] | |
| exclude: | |
| # can't build as it needs either x11 or wayland feature enabled | |
| - crate: "bevy_winit" | |
| extra: "--no-default-features" | |
| steps: | |
| - name: Checkout Bevy | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: bevyengine/bevy | |
| ref: main | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install Bevy dependencies | |
| run: | | |
| sudo apt-get update; | |
| DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -yq libasound2-dev libudev-dev libxkbcommon-x11-0 libwayland-dev | |
| - uses: actions/cache/restore@v4 | |
| id: restore-cache | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: cargo-${{ hashFiles('**/Cargo.toml') }} | |
| restore-keys: cargo- | |
| - name: Build Crate | |
| run: | | |
| cargo build -p ${{ matrix.crate }} ${{ matrix.extra }} | |
| - name: Clippy Crate | |
| run: | | |
| cargo clippy -p ${{ matrix.crate }} ${{ matrix.extra }} --no-deps -- -D warnings | |
| crate-archi: | |
| name: Toolchains | |
| needs: [split-crates] | |
| runs-on: ${{ matrix.target.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| crate: ${{ fromJSON(needs.split-crates.outputs.crates) }} | |
| target: | |
| # need to install android tooling and build with it | |
| # - target: "aarch64-linux-android" | |
| # os: ubuntu-latest | |
| - target: "wasm32-unknown-unknown" | |
| os: ubuntu-latest | |
| - target: "aarch64-apple-ios" | |
| os: macos-latest | |
| exclude: | |
| - crate: bevy_dylib | |
| steps: | |
| - name: Checkout Bevy | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: bevyengine/bevy | |
| ref: main | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target.target }} | |
| - name: Install Bevy dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update; | |
| DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -yq libasound2-dev libudev-dev libxkbcommon-x11-0 libwayland-dev | |
| - name: Enable android game-activity | |
| if: matrix.target.target == 'aarch64-linux-android' | |
| run: | | |
| cargo add --package ${{ matrix.crate }} android-activity --features game-activity | |
| - name: Build Crate | |
| run: | | |
| cargo build --target ${{ matrix.target.target }} -p ${{ matrix.crate }} | |
| - name: Clippy Crate | |
| run: | | |
| cargo clippy --target ${{ matrix.target.target }} -p ${{ matrix.crate }} --no-deps -- -D warnings | |
| release-private-registry: | |
| name: Release to Private Registry | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Starts kellnr | |
| run: | | |
| docker run --detach --rm -p 8000:8000 --name kellnr -e "KELLNR_ORIGIN__HOSTNAME=localhost" ghcr.io/kellnr/kellnr:5.0.0 | |
| - name: Checkout Bevy | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: bevyengine/bevy | |
| ref: main | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@nightly | |
| - name: Install Bevy dependencies | |
| run: | | |
| sudo apt-get update; | |
| DEBIAN_FRONTEND=noninteractive sudo apt-get install --no-install-recommends -yq libasound2-dev libudev-dev libxkbcommon-x11-0 | |
| - name: Setup kellnr registry | |
| run: | | |
| # add kellnr registry to cargo config | |
| cat > .cargo/config.toml<< EOF | |
| [registries.kellnr] | |
| index = "sparse+http://localhost:8000/api/v1/crates/" | |
| credential-provider = ["cargo:token"] | |
| token = "Zy9HhJ02RJmg0GCrgLfaCVfU6IwDfhXD" | |
| EOF | |
| # remove workspace members that are not published | |
| sed -z -i 's/members = \[[^]]*\]/members = ["crates\/*"]/' Cargo.toml | |
| # set all local dependency as coming from the kellnr registry | |
| find . -name Cargo.toml | xargs sed -i 's/{ path = "/{ registry = "kellnr", path = "/' | |
| - name: Publish to kellnr registry | |
| run: | | |
| cargo +nightly publish --workspace --allow-dirty --no-verify --registry kellnr -Z package-workspace | |
| - name: Stops kellnr | |
| if: always() | |
| run: | | |
| docker stop kellnr |