-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
160 lines (146 loc) · 5.2 KB
/
update-caches.yml
File metadata and controls
160 lines (146 loc) · 5.2 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
159
160
name: Update Actions Caches
permissions:
contents: read
on:
# Manually
workflow_dispatch:
# On PR merge
push:
branches:
- main
# After nightly release
schedule:
- cron: "0 1 * * *"
# Environment variables must be kept in sync with all workflows that defines them.
env:
CARGO_INCREMENTAL: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_PROFILE_DEV_DEBUG: 0
# If nightly is breaking CI, modify this variable to target a specific nightly version.
NIGHTLY_TOOLCHAIN: nightly
jobs:
env:
runs-on: ubuntu-latest
outputs:
NIGHTLY_TOOLCHAIN: ${{ steps.env.outputs.NIGHTLY_TOOLCHAIN }}
MSRV: ${{ steps.msrv.outputs.MSRV }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: stable
- name: get MSRV
id: msrv
run: |
msrv=`cargo metadata --no-deps --format-version 1 | jq --raw-output '.packages[] | select(.name=="bevy") | .rust_version'`
echo "MSRV=$msrv" >> $GITHUB_OUTPUT
- name: Expose Env
id: env
run: |
echo "NIGHTLY_TOOLCHAIN=${{ env.NIGHTLY_TOOLCHAIN }}" >> $GITHUB_OUTPUT
build-caches:
name: Build Caches
needs: ["env"]
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
toolchain: stable
target: ""
- os: macos-latest
toolchain: stable
target: ""
- os: windows-latest
toolchain: stable
target: ""
- os: ubuntu-latest
toolchain: ${{ needs.env.outputs.NIGHTLY_TOOLCHAIN }}
target: ""
- os: ubuntu-latest
toolchain: ${{ needs.env.outputs.MSRV }}
target: ""
- os: macos-latest
toolchain: ${{ needs.env.outputs.NIGHTLY_TOOLCHAIN }}
target: ""
- os: ubuntu-latest
toolchain: ${{ needs.env.outputs.NIGHTLY_TOOLCHAIN }}
target: wasm32-unknown-unknown
- os: ubuntu-latest
toolchain: stable
target: wasm32-unknown-unknown
- os: ubuntu-latest
toolchain: stable
target: x86_64-unknown-none
- os: ubuntu-latest
toolchain: stable
target: thumbv6m-none-eabi
- os: ubuntu-latest
toolchain: stable
target: aarch64-linux-android
- os: macos-14
toolchain: stable
target: aarch64-apple-ios-sim
steps:
# prepare the date - used to rebuild the cache daily to update the cache for rust nightly, even if no change on Bevy dependencies
- name: Get Date
id: get-date
run: |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
shell: bash
- name: Checkout Bevy main branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: "bevyengine/bevy"
ref: "main"
persist-credentials: false
- name: Setup Rust
id: rust
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
# prepare the lockfile - to have a complete image of the dependencies on the current platform
- name: Create lock file
run: cargo update
# Fetch the cache using the complete key - to avoid rebuilding the cache if nothing changed
- uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
id: cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('Cargo.lock') }}-${{ steps.get-date.outputs.date }}
lookup-only: true
- name: Install Bevy dependencies
if: steps.cache.outputs.cache-hit != 'true'
uses: ./.github/actions/install-linux-deps
with:
wayland: true
xkb: true
x264: true
fontconfig: true
# Build Bevy for the dev profile, used by check, doc, ...
- name: Build dev cache
if: steps.cache.outputs.cache-hit != 'true'
run: cargo build --profile dev --package bevy
# Build Bevy for the test profile, used by test
- name: Build test cache
if: steps.cache.outputs.cache-hit != 'true'
run: cargo build --profile test --package bevy
- name: Save cache
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('Cargo.lock') }}-${{ steps.get-date.outputs.date }}