|
86 | 86 | if-no-files-found: error |
87 | 87 | path: | |
88 | 88 | ./tests/snos/snos/build |
89 | | - ./tests/fixtures/db/spawn_and_move |
90 | | - ./tests/fixtures/db/simple |
91 | 89 | ./crates/contracts/build |
92 | 90 |
|
93 | 91 | build-katana-binary: |
@@ -159,8 +157,100 @@ jobs: |
159 | 157 | - name: Run Clippy |
160 | 158 | run: ./scripts/clippy.sh |
161 | 159 |
|
| 160 | + generate-db-fixtures: |
| 161 | + needs: [generate-test-artifacts] |
| 162 | + runs-on: ubuntu-latest-32-cores |
| 163 | + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) |
| 164 | + container: |
| 165 | + image: ghcr.io/dojoengine/katana-dev:latest |
| 166 | + env: |
| 167 | + MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/ |
| 168 | + LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/ |
| 169 | + TABLEGEN_190_PREFIX: /usr/lib/llvm-19/ |
| 170 | + steps: |
| 171 | + - uses: actions/checkout@v3 |
| 172 | + with: |
| 173 | + submodules: recursive |
| 174 | + # Workaround for https://github.com/actions/runner-images/issues/6775 |
| 175 | + - run: git config --global --add safe.directory "*" |
| 176 | + |
| 177 | + - name: Cache DB fixtures |
| 178 | + id: cache-db-fixtures |
| 179 | + uses: actions/cache@v4 |
| 180 | + with: |
| 181 | + path: | |
| 182 | + tests/fixtures/db/spawn_and_move |
| 183 | + tests/fixtures/db/simple |
| 184 | + key: db-fixtures-${{ hashFiles('crates/storage/db/src/version.rs') }}-dojo-v1.7.0 |
| 185 | + |
| 186 | + - name: Download contract artifacts |
| 187 | + if: steps.cache-db-fixtures.outputs.cache-hit != 'true' |
| 188 | + uses: actions/download-artifact@v5 |
| 189 | + with: |
| 190 | + name: test-artifacts |
| 191 | + |
| 192 | + - uses: Swatinem/rust-cache@v2 |
| 193 | + if: steps.cache-db-fixtures.outputs.cache-hit != 'true' |
| 194 | + with: |
| 195 | + key: ci-${{ github.job }} |
| 196 | + shared-key: katana-ci-cache |
| 197 | + |
| 198 | + - name: Checkout Dojo repository |
| 199 | + if: steps.cache-db-fixtures.outputs.cache-hit != 'true' |
| 200 | + uses: actions/checkout@v3 |
| 201 | + with: |
| 202 | + repository: dojoengine/dojo |
| 203 | + ref: v1.7.0 |
| 204 | + path: dojo |
| 205 | + |
| 206 | + - name: Read scarb version from Dojo |
| 207 | + if: steps.cache-db-fixtures.outputs.cache-hit != 'true' |
| 208 | + id: dojo-scarb |
| 209 | + run: | |
| 210 | + SCARB_VERSION=$(grep '^scarb ' dojo/.tool-versions | awk '{print $2}') |
| 211 | + echo "version=$SCARB_VERSION" >> $GITHUB_OUTPUT |
| 212 | +
|
| 213 | + - uses: software-mansion/setup-scarb@v1 |
| 214 | + if: steps.cache-db-fixtures.outputs.cache-hit != 'true' |
| 215 | + with: |
| 216 | + scarb-version: ${{ steps.dojo-scarb.outputs.version }} |
| 217 | + |
| 218 | + - name: Install sozo |
| 219 | + if: steps.cache-db-fixtures.outputs.cache-hit != 'true' |
| 220 | + run: cargo install --path dojo/bin/sozo --locked --force |
| 221 | + |
| 222 | + - name: Build generate_migration_db |
| 223 | + if: steps.cache-db-fixtures.outputs.cache-hit != 'true' |
| 224 | + run: cargo build --bin generate_migration_db --features node -p katana-utils |
| 225 | + |
| 226 | + - name: Generate spawn-and-move fixture |
| 227 | + if: steps.cache-db-fixtures.outputs.cache-hit != 'true' |
| 228 | + run: ./target/debug/generate_migration_db --example spawn-and-move --output /tmp/spawn_and_move.tar.gz |
| 229 | + |
| 230 | + - name: Generate simple fixture |
| 231 | + if: steps.cache-db-fixtures.outputs.cache-hit != 'true' |
| 232 | + run: ./target/debug/generate_migration_db --example simple --output /tmp/simple.tar.gz |
| 233 | + |
| 234 | + - name: Extract fixtures |
| 235 | + if: steps.cache-db-fixtures.outputs.cache-hit != 'true' |
| 236 | + run: | |
| 237 | + mkdir -p tests/fixtures/db |
| 238 | + cd tests/fixtures/db && tar -xzf /tmp/spawn_and_move.tar.gz |
| 239 | + cd tests/fixtures/db && tar -xzf /tmp/simple.tar.gz |
| 240 | +
|
| 241 | + - name: Upload DB fixtures |
| 242 | + uses: actions/upload-artifact@v4 |
| 243 | + with: |
| 244 | + name: db-fixtures |
| 245 | + overwrite: true |
| 246 | + retention-days: 14 |
| 247 | + if-no-files-found: error |
| 248 | + path: | |
| 249 | + ./tests/fixtures/db/spawn_and_move |
| 250 | + ./tests/fixtures/db/simple |
| 251 | +
|
162 | 252 | test: |
163 | | - needs: [fmt, clippy, generate-test-artifacts, build-katana-binary] |
| 253 | + needs: [fmt, clippy, generate-test-artifacts, build-katana-binary, generate-db-fixtures] |
164 | 254 | runs-on: ubuntu-latest-32-cores |
165 | 255 | timeout-minutes: 30 |
166 | 256 | if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) |
@@ -188,6 +278,11 @@ jobs: |
188 | 278 | with: |
189 | 279 | name: test-artifacts |
190 | 280 |
|
| 281 | + - name: Download DB fixtures |
| 282 | + uses: actions/download-artifact@v5 |
| 283 | + with: |
| 284 | + name: db-fixtures |
| 285 | + |
191 | 286 | - name: Download Katana binary |
192 | 287 | uses: actions/download-artifact@v5 |
193 | 288 | with: |
|
0 commit comments