-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (151 loc) · 5.47 KB
/
check-releasability.yml
File metadata and controls
158 lines (151 loc) · 5.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
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