-
Notifications
You must be signed in to change notification settings - Fork 7
164 lines (152 loc) · 4.83 KB
/
on-push.yaml
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
name: PR Status Checks
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
# Depends on all actions that are required for a "successful" CI run.
# Based on the ci here: https://github.com/tokio-rs/tokio/blob/master/.github/workflows/ci.yml
all-systems-go:
runs-on: ubuntu-latest
needs:
- check-features
- clippy
- tests
- e2e
- check-all-os
steps:
- run: exit 0
check-all-os:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- run: cargo check --all-features --workspace
check-features:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: taiki-e/install-action@v2
with:
tool: [email protected]
- uses: Swatinem/rust-cache@v2
- run: cargo hack --verbose check --feature-powerset --depth=3 --at-least-one-of=postgresql-index-backend,filesystem-index-backend --at-least-one-of=postgresql-auth-backend,filesystem-auth-backend --no-dev-deps --workspace
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: taiki-e/install-action@v2
with:
tool: [email protected]
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-features --workspace -- -D warnings
tests:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: taiki-e/install-action@v2
with:
tool: [email protected]
- uses: Swatinem/rust-cache@v2
- run: cargo hack --verbose test --features=postgresql-index-backend,postgresql-auth-backend --ignore-unknown-features --each-feature --exclude-features test_e2e --workspace
minimal-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
- name: Install cargo-hack
uses: taiki-e/install-action@v2
with:
tool: [email protected]
- uses: Swatinem/rust-cache@v2
- name: "check --all-features -Z direct-minimal-versions"
run: |
# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update`
# from determining minimal versions based on dev-dependencies.
cargo hack --remove-dev-deps --workspace
# Update Cargo.lock to minimal version dependencies.
cargo update -Z direct-minimal-versions
cargo hack check --all-features --ignore-private
e2e:
strategy:
matrix:
postgres_version: [ 14, 15 ]
runs-on: ubuntu-latest
services:
postgres:
image: postgres:${{ matrix.postgres_version }}
env:
POSTGRES_USER: freighter
POSTGRES_PASSWORD: crates-crates-crates
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
s3:
image: adobe/s3mock
env:
initialBuckets: crates
validKmsKeys: "arn:aws:kms:us-east-1:1234567890:key/valid-secret"
ports:
- 9090:9090
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Install psql
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends postgresql-client
- name: Run DB migrations
run: |
psql -h localhost -f sql/init-index-db.sql
psql -h localhost -f sql/init-auth-db.sql
env:
PGUSER: freighter
PGPASSWORD: crates-crates-crates
- name: Run E2E tests
run: cargo test -p freighter-server --features=test_e2e -- --nocapture e2e
env:
SERVER_ADDR: "127.0.0.1:3000"
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_USER: freighter
POSTGRES_PASSWORD: crates-crates-crates
POSTGRES_DBNAME: freighter
BUCKET_NAME: crates
BUCKET_ENDPOINT: "http://127.0.0.1:9090"
BUCKET_ACCESS_KEY_ID: "1234567890"
BUCKET_ACCESS_KEY_SECRET: valid-secret
RUSTFLAGS: -D warnings