Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI improvements #1195

Merged
merged 4 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions .github/workflows/bridge-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- 'bridge/**'
- '.github/workflows/bridge-ci.yml'

env:
CARGO_TERM_COLOR: always

jobs:
test-versions:
name: Webhook Bridge CI
Expand All @@ -21,21 +24,17 @@ jobs:
rust: [stable, beta]
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
override: true
profile: minimal
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
with:
workspaces: "bridge -> target"

- name: rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path bridge/Cargo.toml --all -- --check
run: cargo fmt -- --check
working-directory: bridge

- name: Install dependencies
# Packages should align with whatever is in the bridge/Dockerfile
Expand All @@ -50,22 +49,18 @@ jobs:
zlib1g-dev=1:*

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path bridge/Cargo.toml --all --locked
run: cargo build --locked
working-directory: bridge

- name: Start dependencies
run: docker-compose -f "bridge/testing-docker-compose.yml" up -d

- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --manifest-path bridge/Cargo.toml --all --all-targets --all-features -- -D warnings
run: cargo clippy --all-targets --all-features -- -D warnings
working-directory: bridge

- name: Run tests
working-directory: ./bridge
working-directory: bridge
run: ./run-tests.sh

- name: Stop dependencies
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/bridge-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
release:
types: [published]

env:
CARGO_TERM_COLOR: always

jobs:
release:
name: release ${{ matrix.target }}
Expand Down Expand Up @@ -31,22 +34,16 @@ jobs:
- uses: actions/checkout@master

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
profile: minimal
target: ${{ matrix.target }}
targets: ${{ matrix.target }}

- name: Install musl for x86_64-unknown-linux-musl
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
run: sudo apt-get install -y musl-dev musl-tools

- name: Compile bridge
uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.target }} --release --manifest-path bridge/svix-bridge/Cargo.toml
run: cargo build --target ${{ matrix.target }} --release --manifest-path bridge/svix-bridge/Cargo.toml

- name: Release
uses: actions/upload-artifact@v3
Expand Down
25 changes: 10 additions & 15 deletions .github/workflows/rust-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
- '.github/workflows/rust-lint.yml'
- "openapi.json"

env:
CARGO_TERM_COLOR: always

jobs:
test-versions:
name: Rust Lint
Expand All @@ -28,31 +31,23 @@ jobs:
yarn
./regen_openapi.sh

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
override: true
profile: minimal
components: clippy, rustfmt

- uses: Swatinem/rust-cache@v1
with:
working-directory: rust

- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --manifest-path rust/Cargo.toml --all --all-targets --all-features -- -D warnings
run: cargo clippy --all-targets --all-features -- -D warnings
working-directory: rust

- name: rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path rust/Cargo.toml --all -- --check
run: cargo fmt -- --check
working-directory: rust

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path rust/Cargo.toml --all
run: cargo test --all
working-directory: rust
13 changes: 5 additions & 8 deletions .github/workflows/rust-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
tags:
- 'v*'

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -24,19 +27,13 @@ jobs:
git add -f src/apis/ src/models/
git commit -a -m "Snap"

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
profile: minimal
components: clippy, rustfmt

- uses: Swatinem/rust-cache@v1

- name: Publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
uses: actions-rs/cargo@v1
with:
command: publish
args: --manifest-path rust/Cargo.toml
run: cargo publish --manifest-path rust/Cargo.toml
31 changes: 12 additions & 19 deletions .github/workflows/server-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- 'server/**'
- '.github/workflows/server-ci.yml'

env:
CARGO_TERM_COLOR: always

jobs:
test-versions:
name: Server CI
Expand All @@ -21,27 +24,21 @@ jobs:
rust: [stable, beta]
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
override: true
profile: minimal
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
with:
workspaces: "server -> target"

- name: rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path server/Cargo.toml --all -- --check
run: cargo fmt -- --check
working-directory: server

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path server/Cargo.toml --all --locked
run: cargo build --locked
working-directory: server

- name: Install dependencies
run: sudo apt-get install -y jq
Expand All @@ -54,22 +51,18 @@ jobs:
run: docker-compose -f "server/testing-docker-compose.yml" up -d

- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --manifest-path server/Cargo.toml --all --all-targets --all-features -- -D warnings
run: cargo clippy --all-targets --all-features -- -D warnings
working-directory: server

- name: Run migrations
uses: actions-rs/cargo@v1
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres"
SVIX_REDIS_DSN: "redis://localhost:6379"
SVIX_QUEUE_TYPE: "redis"
SVIX_JWT_SECRET: "test value"
SVIX_CACHE_TYPE: "memory"
with:
command: run
args: --manifest-path server/Cargo.toml -- --wait-for 15 migrate
run: cargo run -- --wait-for 15 migrate
working-directory: server

- name: Run tests
working-directory: ./server
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/server-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
release:
types: [published]

env:
CARGO_TERM_COLOR: always

jobs:
release:
name: release ${{ matrix.target }}
Expand Down Expand Up @@ -31,22 +34,16 @@ jobs:
- uses: actions/checkout@master

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
profile: minimal
target: ${{ matrix.target }}
targets: ${{ matrix.target }}

- name: Install musl for x86_64-unknown-linux-musl
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
run: sudo apt-get install -y musl-dev musl-tools

- name: Compile server
uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.target }} --release --manifest-path server/svix-server/Cargo.toml
run: cargo build --target ${{ matrix.target }} --release --manifest-path server/svix-server/Cargo.toml

- name: Release
uses: actions/upload-artifact@v3
Expand Down
Loading