Skip to content

Commit 76687ca

Browse files
committed
ci: update ci for testcontainers setup
Signed-off-by: Joseph Livesey <[email protected]>
1 parent 4a57d33 commit 76687ca

File tree

1 file changed

+18
-46
lines changed

1 file changed

+18
-46
lines changed

.github/workflows/tests.yml

Lines changed: 18 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
steps:
4141
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
4242
- name: Install libsasl2-dev
43-
run: apt-get update && apt-get install -y libsasl2-dev
43+
run: sudo apt-get update && sudo apt-get install -y libsasl2-dev
4444
- name: Cache dependencies
4545
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
4646
if: ${{ !startsWith(github.head_ref, 'renovate/') }}
@@ -53,7 +53,7 @@ jobs:
5353
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
5454
if: ${{ !startsWith(github.head_ref, 'renovate/') }}
5555
- name: Install protobuf compiler
56-
run: apt-get update && apt-get install protobuf-compiler -y
56+
run: sudo apt-get update && sudo apt-get install protobuf-compiler -y
5757
- name: Install sqlx
5858
run: cargo install sqlx-cli --no-default-features --features postgres
5959
- name: Run the test sqlx migrations
@@ -72,7 +72,7 @@ jobs:
7272
steps:
7373
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
7474
- name: Install libsasl2-dev
75-
run: apt-get update && apt-get install -y libsasl2-dev
75+
run: sudo apt-get update && sudo apt-get install -y libsasl2-dev
7676
- name: Cache dependencies
7777
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
7878
if: ${{ !startsWith(github.head_ref, 'renovate/') }}
@@ -85,7 +85,7 @@ jobs:
8585
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
8686
if: ${{ !startsWith(github.head_ref, 'renovate/') }}
8787
- name: Install protobuf compiler
88-
run: apt-get update && apt-get install protobuf-compiler -y
88+
run: sudo apt-get update && sudo apt-get install protobuf-compiler -y
8989
- run: |
9090
rustup component add clippy
9191
# Temporarily allowing dead-code, while denying all other warnings
@@ -98,27 +98,17 @@ jobs:
9898
contents: write
9999
pull-requests: write
100100
actions: read
101-
services:
102-
postgres:
103-
image: postgres:15
104-
env:
105-
POSTGRES_HOST_AUTH_METHOD: trust
106-
options: >-
107-
--health-cmd pg_isready
108-
--health-interval 10s
109-
--health-timeout 5s
110-
--health-retries 5
111-
ports:
112-
- 5432:5432
113-
container:
114-
image: rust:1.86-bookworm
115101
env:
116-
DATABASE_URL: postgres://postgres@postgres:5432
117102
CI: true
103+
SQLX_OFFLINE: true
118104
steps:
119105
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
106+
- name: Install Rust
107+
uses: dtolnay/rust-toolchain@stable
108+
with:
109+
toolchain: 1.86
120110
- name: Install libsasl2-dev
121-
run: apt-get update && apt-get install -y libsasl2-dev
111+
run: sudo apt-get update && sudo apt-get install -y libsasl2-dev
122112
- name: Cache dependencies
123113
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
124114
if: ${{ !startsWith(github.head_ref, 'renovate/') }}
@@ -128,16 +118,12 @@ jobs:
128118
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
129119
if: ${{ !startsWith(github.head_ref, 'renovate/') }}
130120
- name: Install protobuf compiler
131-
run: apt-get update && apt-get install protobuf-compiler -y
121+
run: sudo apt-get update && sudo apt-get install protobuf-compiler -y
132122
- name: Run sccache-cache
133123
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
134124
if: ${{ !startsWith(github.head_ref, 'renovate/') }}
135125
- name: Install cargo-llvm-cov
136126
uses: taiki-e/install-action@cargo-llvm-cov
137-
- name: Install sqlx
138-
run: cargo install sqlx-cli --no-default-features --features postgres
139-
- name: Run the test sqlx migrations
140-
run: cargo sqlx migrate run
141127
- name: Run tests and generate coverage report
142128
run: cargo llvm-cov test --all-features --workspace --lcov --output-path lcov.info
143129
- name: Upload coverage to Coveralls
@@ -153,26 +139,16 @@ jobs:
153139
contents: write
154140
pull-requests: write
155141
actions: read
156-
services:
157-
postgres:
158-
image: postgres:15
159-
env:
160-
POSTGRES_HOST_AUTH_METHOD: trust
161-
options: >-
162-
--health-cmd pg_isready
163-
--health-interval 10s
164-
--health-timeout 5s
165-
--health-retries 5
166-
ports:
167-
- 5432:5432
168-
container:
169-
image: rust:1.86-bookworm
170142
env:
171-
DATABASE_URL: postgres://postgres@postgres:5432
143+
SQLX_OFFLINE: true
172144
steps:
173145
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
146+
- name: Install Rust
147+
uses: dtolnay/rust-toolchain@stable
148+
with:
149+
toolchain: 1.86
174150
- name: Install libsasl2-dev
175-
run: apt-get update && apt-get install -y libsasl2-dev
151+
run: sudo apt-get update && sudo apt-get install -y libsasl2-dev
176152
- name: Cache dependencies
177153
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
178154
if: ${{ !startsWith(github.head_ref, 'renovate/') }}
@@ -182,13 +158,9 @@ jobs:
182158
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
183159
if: ${{ !startsWith(github.head_ref, 'renovate/') }}
184160
- name: Install protobuf compiler
185-
run: apt-get update && apt-get install protobuf-compiler -y
161+
run: sudo apt-get update && sudo apt-get install protobuf-compiler -y
186162
- name: Run sccache-cache
187163
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
188164
if: ${{ !startsWith(github.head_ref, 'renovate/') }}
189-
- name: Install sqlx
190-
run: cargo install sqlx-cli --no-default-features --features postgres
191-
- name: Run the test sqlx migrations
192-
run: cargo sqlx migrate run
193165
- name: Test documentation code snippets
194166
run: cargo test --doc --all-features --workspace

0 commit comments

Comments
 (0)