-
Notifications
You must be signed in to change notification settings - Fork 2
103 lines (86 loc) · 2.55 KB
/
ci.yml
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
name: CI
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: musicbrainz
POSTGRES_PASSWORD: musicbrainz
POSTGRES_DB: musicbrainz_db
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U musicbrainz"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Install PostgreSQL Client
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client
- name: Wait for PostgreSQL
run: |
until pg_isready -h localhost -p 5432 -U musicbrainz; do
echo "Waiting for PostgreSQL to start..."
sleep 1
done
- name: Copy example config files
run: cp config/development.example.toml config/development.toml
- name: Populate Test Data
env:
PGPASSWORD: musicbrainz
run: |
for sql_file in ./tests/fixtures/*.sql; do
psql -h localhost -p 5432 -U musicbrainz -d musicbrainz_db -f "$sql_file"
done
- name: Verify Table Existence
env:
PGPASSWORD: musicbrainz
run: |
psql -h localhost -p 5432 -U musicbrainz -d musicbrainz_db -c '\dt external_url_archiver.internet_archive_urls'
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Formatting
uses: clechasseur/rs-cargo@v2
with:
command: fmt
args: --check
continue-on-error: true
- name: Cargo Check
uses: clechasseur/rs-cargo@v2
with:
command: check
args: --all-targets --all-features --locked
continue-on-error: true
- name: Linting
uses: clechasseur/rs-cargo@v2
with:
command: clippy
args: --all-targets --all-features --locked -- -D warnings
continue-on-error: true
- name: Run Tests
env:
DATABASE_URL: postgres://musicbrainz:musicbrainz@localhost:5432/musicbrainz_db
run: cargo test -- --nocapture