Skip to content

Commit dd88dc4

Browse files
committed
Simpler test workflow
1 parent 6d44b52 commit dd88dc4

File tree

1 file changed

+42
-152
lines changed

1 file changed

+42
-152
lines changed

.github/workflows/tests.yml

Lines changed: 42 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -2,169 +2,59 @@ name: Tests
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
pull_request:
7-
branches: [ master ]
7+
branches: [master]
88

99
env:
1010
CARGO_TERM_COLOR: always
1111
RUST_BACKTRACE: 1
1212

1313
jobs:
1414
unit-tests:
15-
name: Unit Tests
15+
name: Tests
1616
runs-on: ubuntu-latest
17-
18-
permissions:
19-
contents: read
20-
21-
steps:
22-
- uses: actions/checkout@v4
23-
24-
- name: Install Rust toolchain
25-
uses: actions-rs/toolchain@v1
26-
with:
27-
profile: minimal
28-
toolchain: stable
29-
override: true
30-
components: rustfmt, clippy
31-
32-
- name: Cache cargo registry
33-
uses: actions/cache@v4
34-
with:
35-
path: ~/.cargo/registry
36-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
37-
38-
- name: Cache cargo index
39-
uses: actions/cache@v4
40-
with:
41-
path: ~/.cargo/git
42-
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
43-
44-
- name: Cache cargo build
45-
uses: actions/cache@v4
46-
with:
47-
path: target
48-
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
49-
50-
- name: Check formatting
51-
run: cargo fmt -- --check
52-
53-
- name: Run clippy
54-
run: cargo clippy -- -D warnings
55-
56-
- name: Build
57-
run: cargo build --verbose
58-
59-
- name: Run unit tests
60-
run: cargo test --lib --verbose
6117

62-
integration-tests:
63-
name: Integration Tests
64-
runs-on: ubuntu-latest
65-
6618
permissions:
6719
contents: read
68-
69-
services:
70-
postgres:
71-
image: postgres:16-alpine
72-
env:
73-
POSTGRES_PASSWORD: password
74-
POSTGRES_USER: postgres
75-
POSTGRES_DB: nostr_test
76-
options: >-
77-
--health-cmd pg_isready
78-
--health-interval 10s
79-
--health-timeout 5s
80-
--health-retries 5
81-
ports:
82-
- 5432:5432
83-
84-
steps:
85-
- uses: actions/checkout@v4
86-
87-
- name: Install Rust toolchain
88-
uses: actions-rs/toolchain@v1
89-
with:
90-
profile: minimal
91-
toolchain: stable
92-
override: true
93-
94-
- name: Cache cargo registry
95-
uses: actions/cache@v4
96-
with:
97-
path: ~/.cargo/registry
98-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
99-
100-
- name: Cache cargo index
101-
uses: actions/cache@v4
102-
with:
103-
path: ~/.cargo/git
104-
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
105-
106-
- name: Cache cargo build
107-
uses: actions/cache@v4
108-
with:
109-
path: target
110-
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
111-
112-
- name: Run integration tests
113-
env:
114-
DATABASE_URL: postgres://postgres:password@localhost:5432/nostr_test
115-
run: cargo test --test integration_tests --verbose
11620

117-
edge-case-tests:
118-
name: Edge Case Tests
119-
runs-on: ubuntu-latest
120-
121-
permissions:
122-
contents: read
123-
124-
services:
125-
postgres:
126-
image: postgres:16-alpine
127-
env:
128-
POSTGRES_PASSWORD: password
129-
POSTGRES_USER: postgres
130-
POSTGRES_DB: nostr_test
131-
options: >-
132-
--health-cmd pg_isready
133-
--health-interval 10s
134-
--health-timeout 5s
135-
--health-retries 5
136-
ports:
137-
- 5432:5432
138-
13921
steps:
140-
- uses: actions/checkout@v4
141-
142-
- name: Install Rust toolchain
143-
uses: actions-rs/toolchain@v1
144-
with:
145-
profile: minimal
146-
toolchain: stable
147-
override: true
148-
149-
- name: Cache cargo registry
150-
uses: actions/cache@v4
151-
with:
152-
path: ~/.cargo/registry
153-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
154-
155-
- name: Cache cargo index
156-
uses: actions/cache@v4
157-
with:
158-
path: ~/.cargo/git
159-
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
160-
161-
- name: Cache cargo build
162-
uses: actions/cache@v4
163-
with:
164-
path: target
165-
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
166-
167-
- name: Run edge case tests
168-
env:
169-
DATABASE_URL: postgres://postgres:password@localhost:5432/nostr_test
170-
run: cargo test --test edge_cases --verbose
22+
- uses: actions/checkout@v4
23+
24+
- name: Install Rust toolchain
25+
uses: actions-rs/toolchain@v1
26+
with:
27+
profile: minimal
28+
toolchain: stable
29+
override: true
30+
components: rustfmt, clippy
31+
32+
- name: Cache cargo registry
33+
uses: actions/cache@v4
34+
with:
35+
path: ~/.cargo/registry
36+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
37+
38+
- name: Cache cargo index
39+
uses: actions/cache@v4
40+
with:
41+
path: ~/.cargo/git
42+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
43+
44+
- name: Cache cargo build
45+
uses: actions/cache@v4
46+
with:
47+
path: target
48+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
49+
50+
- name: Check formatting
51+
run: cargo fmt -- --check
52+
53+
- name: Run clippy
54+
run: cargo clippy -- -D warnings
55+
56+
- name: Build
57+
run: cargo build --verbose
58+
59+
- name: Run tests
60+
run: cargo test --verbose

0 commit comments

Comments
 (0)