|
| 1 | +# This workflow relies on the fact that the dojoengine/katana-dev Docker image has `sozo` installed via `asdf`. |
| 2 | + |
1 | 3 | name: generate-test-db-dispatch |
2 | 4 | on: |
3 | | - workflow_dispatch: |
| 5 | + workflow_dispatch: |
4 | 6 |
|
5 | 7 | jobs: |
6 | | - generate-compat-db: |
7 | | - runs-on: ubuntu-latest |
8 | | - container: |
9 | | - image: ghcr.io/dojoengine/katana-dev:latest |
10 | | - steps: |
11 | | - - uses: actions/checkout@v4 |
12 | | - with: |
13 | | - ref: v1.6.0 |
14 | | - |
15 | | - # Workaround for https://github.com/actions/runner-images/issues/6775 |
16 | | - - run: git config --global --add safe.directory "*" |
17 | | - - uses: Swatinem/rust-cache@v2 |
18 | | - |
19 | | - - name: Checkout Dojo repository |
20 | | - uses: actions/checkout@v4 |
21 | | - with: |
22 | | - repository: dojoengine/dojo |
23 | | - ref: v1.6.0 |
24 | | - path: dojo |
25 | | - |
26 | | - - uses: software-mansion/setup-scarb@v1 |
27 | | - with: |
28 | | - scarb-version: "2.10.1" |
29 | | - |
30 | | - - name: Install Sozo |
31 | | - run: | |
32 | | - cd dojo |
33 | | - cargo install --path bin/sozo --locked --force |
34 | | -
|
35 | | - - name: Generate test database |
36 | | - run: ./scripts/generate-test-db.sh --dojo-tag v1.6.0 |
37 | | - |
38 | | - - name: Upload compat database artifact |
39 | | - uses: actions/upload-artifact@v4 |
40 | | - with: |
41 | | - name: compat-db |
42 | | - path: tests/fixtures/db/*.tar.gz |
43 | | - |
44 | | - generate-migration-dbs: |
45 | | - runs-on: ubuntu-latest |
46 | | - container: |
47 | | - image: ghcr.io/dojoengine/katana-dev:latest |
48 | | - steps: |
49 | | - - uses: actions/checkout@v4 |
50 | | - with: |
51 | | - submodules: recursive |
52 | | - |
53 | | - # Workaround for https://github.com/actions/runner-images/issues/6775 |
54 | | - - run: git config --global --add safe.directory "*" |
55 | | - - uses: Swatinem/rust-cache@v2 |
56 | | - |
57 | | - - name: Set sozo version |
58 | | - run: asdf set sozo 1.7.0 |
59 | | - |
60 | | - - name: Build contracts |
61 | | - run: make contracts |
62 | | - |
63 | | - - name: Build generate_migration_db |
64 | | - run: cargo build --bin generate_migration_db --features node --release |
65 | | - |
66 | | - - name: Generate spawn-and-move database |
67 | | - run: ./target/release/generate_migration_db --example spawn-and-move --output tests/fixtures/db/spawn_and_move.tar.gz |
68 | | - |
69 | | - - name: Generate simple database |
70 | | - run: ./target/release/generate_migration_db --example simple --output tests/fixtures/db/simple.tar.gz |
71 | | - |
72 | | - - name: Upload migration database artifacts |
73 | | - uses: actions/upload-artifact@v4 |
74 | | - with: |
75 | | - name: migration-dbs |
76 | | - path: | |
77 | | - tests/fixtures/db/spawn_and_move.tar.gz |
78 | | - tests/fixtures/db/simple.tar.gz |
79 | | -
|
80 | | - create-pr: |
81 | | - needs: [generate-compat-db, generate-migration-dbs] |
82 | | - runs-on: ubuntu-latest |
83 | | - permissions: |
84 | | - contents: write |
85 | | - pull-requests: write |
86 | | - steps: |
87 | | - - uses: actions/checkout@v4 |
88 | | - |
89 | | - - name: Download compat database |
90 | | - uses: actions/download-artifact@v4 |
91 | | - with: |
92 | | - name: compat-db |
93 | | - path: tests/fixtures/db/ |
94 | | - |
95 | | - - name: Download migration databases |
96 | | - uses: actions/download-artifact@v4 |
97 | | - with: |
98 | | - name: migration-dbs |
99 | | - path: tests/fixtures/db/ |
100 | | - |
101 | | - - id: version_info |
102 | | - run: | |
103 | | - DATE=$(date +%Y%m%d%H%M%S) |
104 | | - echo "version=db-update-${DATE}" >> $GITHUB_OUTPUT |
105 | | -
|
106 | | - - name: Create Pull Request |
107 | | - uses: peter-evans/create-pull-request@v5 |
108 | | - with: |
109 | | - base: main |
110 | | - delete-branch: true |
111 | | - token: ${{ secrets.CREATE_PR_TOKEN }} |
112 | | - add-paths: | |
113 | | - tests/fixtures/db/ |
114 | | - branch: db-update-${{ steps.version_info.outputs.version }} |
115 | | - title: "chore(test): update test database fixtures" |
116 | | - commit-message: "chore(test): update test database fixtures" |
| 8 | + generate-compat-db: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + container: |
| 11 | + image: ghcr.io/dojoengine/katana-dev:latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + with: |
| 15 | + ref: v1.6.0 |
| 16 | + |
| 17 | + # Workaround for https://github.com/actions/runner-images/issues/6775 |
| 18 | + - run: git config --global --add safe.directory "*" |
| 19 | + - uses: Swatinem/rust-cache@v2 |
| 20 | + |
| 21 | + - name: Checkout Dojo repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + with: |
| 24 | + repository: dojoengine/dojo |
| 25 | + ref: v1.6.0 |
| 26 | + path: dojo |
| 27 | + |
| 28 | + - uses: software-mansion/setup-scarb@v1 |
| 29 | + with: |
| 30 | + scarb-version: "2.10.1" |
| 31 | + |
| 32 | + - name: Set sozo version |
| 33 | + run: asdf set sozo 1.7.0 |
| 34 | + |
| 35 | + - name: Generate test database |
| 36 | + run: ./scripts/generate-test-db.sh --dojo-tag v1.6.0 |
| 37 | + |
| 38 | + - name: Upload compat database artifact |
| 39 | + uses: actions/upload-artifact@v4 |
| 40 | + with: |
| 41 | + name: compat-db |
| 42 | + path: tests/fixtures/db/*.tar.gz |
| 43 | + |
| 44 | + generate-migration-dbs: |
| 45 | + runs-on: ubuntu-latest |
| 46 | + container: |
| 47 | + image: ghcr.io/dojoengine/katana-dev:latest |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + with: |
| 51 | + submodules: recursive |
| 52 | + |
| 53 | + # Workaround for https://github.com/actions/runner-images/issues/6775 |
| 54 | + - run: git config --global --add safe.directory "*" |
| 55 | + - uses: Swatinem/rust-cache@v2 |
| 56 | + |
| 57 | + - name: Set sozo version |
| 58 | + run: asdf set sozo 1.7.0 |
| 59 | + |
| 60 | + - name: Build contracts |
| 61 | + run: make contracts |
| 62 | + |
| 63 | + - name: Build generate_migration_db |
| 64 | + run: cargo build --bin generate_migration_db --features node --release |
| 65 | + |
| 66 | + - name: Generate spawn-and-move database |
| 67 | + run: ./target/release/generate_migration_db --example spawn-and-move --output tests/fixtures/db/spawn_and_move.tar.gz |
| 68 | + |
| 69 | + - name: Generate simple database |
| 70 | + run: ./target/release/generate_migration_db --example simple --output tests/fixtures/db/simple.tar.gz |
| 71 | + |
| 72 | + - name: Upload migration database artifacts |
| 73 | + uses: actions/upload-artifact@v4 |
| 74 | + with: |
| 75 | + name: migration-dbs |
| 76 | + path: | |
| 77 | + tests/fixtures/db/spawn_and_move.tar.gz |
| 78 | + tests/fixtures/db/simple.tar.gz |
| 79 | +
|
| 80 | + create-pr: |
| 81 | + needs: [generate-compat-db, generate-migration-dbs] |
| 82 | + runs-on: ubuntu-latest |
| 83 | + permissions: |
| 84 | + contents: write |
| 85 | + pull-requests: write |
| 86 | + steps: |
| 87 | + - uses: actions/checkout@v4 |
| 88 | + |
| 89 | + - name: Download compat database |
| 90 | + uses: actions/download-artifact@v4 |
| 91 | + with: |
| 92 | + name: compat-db |
| 93 | + path: tests/fixtures/db/ |
| 94 | + |
| 95 | + - name: Download migration databases |
| 96 | + uses: actions/download-artifact@v4 |
| 97 | + with: |
| 98 | + name: migration-dbs |
| 99 | + path: tests/fixtures/db/ |
| 100 | + |
| 101 | + - id: version_info |
| 102 | + run: | |
| 103 | + DATE=$(date +%Y%m%d%H%M%S) |
| 104 | + echo "version=db-update-${DATE}" >> $GITHUB_OUTPUT |
| 105 | +
|
| 106 | + - name: Create Pull Request |
| 107 | + uses: peter-evans/create-pull-request@v5 |
| 108 | + with: |
| 109 | + base: main |
| 110 | + delete-branch: true |
| 111 | + token: ${{ secrets.CREATE_PR_TOKEN }} |
| 112 | + add-paths: | |
| 113 | + tests/fixtures/db/ |
| 114 | + branch: db-update-${{ steps.version_info.outputs.version }} |
| 115 | + title: "chore(test): update test database fixtures" |
| 116 | + commit-message: "chore(test): update test database fixtures" |
0 commit comments