forked from boundless-xyz/boundless
-
Notifications
You must be signed in to change notification settings - Fork 0
167 lines (144 loc) · 4.34 KB
/
bento.yml
File metadata and controls
167 lines (144 loc) · 4.34 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
161
162
163
164
165
166
167
name: Bento Testing
on:
pull_request:
branches:
- main
- 'release-*'
paths:
- 'bento/**'
- '.github/workflows/bento.yml'
push:
branches:
- main
- 'release-*'
paths:
- 'bento/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
id-token: write
contents: read
pull-requests: read
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RISC0_TOOLCHAIN_VERSION: 1.88.0
RISC0_CRATE_VERSION: "3.0.1"
FOUNDRY_VERSION: v1.2.3
jobs:
bento-test:
runs-on: [ self-hosted, prod, "Linux", "cpu" ]
services:
postgres:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: password
POSTGRES_DB: bento_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Setup sccache + S3
uses: ./.github/actions/sccache
- name: Setup Rust toolchain
uses: risc0/risc0/.github/actions/rustup@v3.0.3
- name: Install cargo risczero
uses: ./.github/actions/bininstall-risc0
with:
risczero-version: ${{ env.RISC0_CRATE_VERSION }}
toolchain-version: ${{ env.RISC0_TOOLCHAIN_VERSION }}
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: ${{ env.FOUNDRY_VERSION }}
- name: Install cargo-sort
uses: risc0/cargo-install@b9307573043522ab0d3e3be64a51763b765b52a4
with:
crate: cargo-sort
version: "1.0"
- name: Change to bento directory
run: cd bento
- name: Cargo sort check
run: |
cd bento
cargo sort --workspace --check
- name: Cargo format check
run: |
cd bento
cargo fmt --all -- --check
- name: Cargo check
run: |
cd bento
cargo check
- name: Run database migrations
run: |
# Install sqlx-cli if not present
if ! command -v sqlx &> /dev/null; then
cargo install sqlx-cli --no-default-features --features postgres
fi
pwd
# Create database and run migrations for taskdb
cd bento/crates/taskdb
sqlx database create --database-url "postgres://postgres:password@localhost:5432/bento_test"
sqlx migrate run --database-url "postgres://postgres:password@localhost:5432/bento_test"
cd ../..
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/bento_test
- name: Run bento tests
run: |
cd bento
cargo test
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/bento_test
REDIS_URL: redis://localhost:6379
RISC0_DEV_MODE: true
POVW_ENABLED: false
- name: Test with POVW enabled
run: |
cd bento
cargo test
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/bento_test
REDIS_URL: redis://localhost:6379
RISC0_DEV_MODE: true
POVW_ENABLED: true
POVW_LOG_ID: "0000000000000000000000000000000000000000"
POVW_JOB_NUMBER: "1"
- name: Test specific crates
run: |
cd bento
cargo test --locked -p taskdb
cargo test --locked -p workflow-common
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/bento_test
REDIS_URL: redis://localhost:6379
RISC0_DEV_MODE: true
- name: Cleanup Docker services
if: always()
run: |
docker stop bento-postgres-test bento-redis-test || true
docker rm bento-postgres-test bento-redis-test || true
- name: sccache stats
run: sccache --show-stats