Search endpoint #288
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |