This repository has been archived by the owner on Feb 11, 2024. It is now read-only.
fix: return 4xx instead of 5xx on invalid JWT (#67) #133
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: ci | |
on: | |
workflow_dispatch: | |
pull_request: | |
paths-ignore: | |
- ".github/**" | |
- "spec/**" | |
- "terraform/**" | |
- "*.md" | |
- "LICENSE" | |
push: | |
branches: | |
- "main" | |
paths-ignore: | |
- ".github/**" | |
- "spec/**" | |
- "terraform/**" | |
- "*.md" | |
- "LICENSE" | |
concurrency: | |
# Support push/pr as event types with different behaviors each: | |
# 1. push: queue up builds | |
# 2. pr: only allow one run per PR | |
group: ${{ github.workflow }}-${{ github.event.type }}${{ github.event.pull_request.number }} | |
# If there is already a workflow running for the same pull request, cancel it | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
jobs: | |
tasks: | |
name: "${{ matrix.cargo.name }} [${{ matrix.os }}/rust-${{matrix.rust}}]" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
rust: | |
- nightly | |
cargo: | |
- name: "Clippy" | |
cmd: clippy | |
args: --all-features --tests -- -D clippy::all -W clippy::style | |
cache: {} | |
- name: "Formatting" | |
cmd: fmt | |
args: -- --check | |
cache: {} | |
- name: "Unit Tests" | |
cmd: test | |
args: --features ci-tests | |
cache: { sharedKey: "tests" } | |
- name: "Documentation Tests" | |
cmd: test | |
args: --doc | |
rust: stable | |
cache: {} | |
include: | |
- sccache-path: /home/runner/.cache/sccache | |
env: | |
RUST_BACKTRACE: full | |
RUSTC_WRAPPER: sccache | |
SCCACHE_CACHE_SIZE: 1G | |
SCCACHE_DIR: ${{ matrix.sccache-path }} | |
steps: | |
- name: "Git checkout" | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: "Install sccache" | |
env: | |
SCCACHE_URL: https://github.com/mozilla/sccache/releases/download | |
SCCACHE_VERSION: v0.4.0 | |
run: | | |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl | |
curl -sSL "$SCCACHE_URL/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz | |
install -vDm 755 "$SCCACHE_FILE/sccache" "$HOME/.local/bin/sccache" | |
echo "$HOME/.local/bin" >> "$GITHUB_PATH" | |
- name: "Install Rust ${{ matrix.rust }}" | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
profile: minimal | |
override: true | |
components: rustfmt, clippy | |
# Rebuild cache | |
- name: Cache cargo registry | |
uses: Swatinem/rust-cache@v2 | |
with: ${{ matrix.cargo.cache }} | |
continue-on-error: false | |
- name: Cache sccache | |
uses: actions/cache@v2 | |
continue-on-error: false | |
with: | |
path: ${{ matrix.sccache-path }} | |
key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-sccache- | |
- name: "Start sccache server" | |
run: | | |
sccache --stop-server || true | |
sccache --start-server | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
# Run job | |
- name: "Task ${{ matrix.cargo.name }}" | |
uses: actions-rs/cargo@v1 | |
with: | |
command: ${{ matrix.cargo.cmd }} | |
args: ${{ matrix.cargo.args }} | |
- name: "Print sccache stats" | |
run: sccache --show-stats | |
- name: "Stop sccache server" | |
run: sccache --stop-server || true | |
integration: | |
name: "Integration Tests" | |
runs-on: ubuntu-latest | |
env: | |
RUST_BACKTRACE: full | |
RUSTC_WRAPPER: sccache | |
SCCACHE_CACHE_SIZE: 1G | |
SCCACHE_DIR: /home/runner/.cache/sccache | |
steps: | |
- name: "Git checkout" | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: "Install sccache" | |
env: | |
SCCACHE_URL: https://github.com/mozilla/sccache/releases/download | |
SCCACHE_VERSION: v0.4.0 | |
run: | | |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl | |
curl -sSL "$SCCACHE_URL/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz | |
install -vDm 755 "$SCCACHE_FILE/sccache" "$HOME/.local/bin/sccache" | |
echo "$HOME/.local/bin" >> "$GITHUB_PATH" | |
- name: "Install Rust nightly" | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
profile: minimal | |
override: true | |
components: rustfmt, clippy | |
# Rebuild cache | |
- name: Cache cargo registry | |
uses: Swatinem/rust-cache@v2 | |
with: | |
sharedKey: "tests" | |
continue-on-error: false | |
- name: Cache sccache | |
uses: actions/cache@v2 | |
continue-on-error: false | |
with: | |
path: /home/runner/.cache/sccache | |
key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-sccache- | |
- name: "Start sccache server" | |
run: | | |
sccache --stop-server || true | |
sccache --start-server | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: '4.4' | |
mongodb-db: gilgamesh | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
# Run job | |
- name: "Storage Tests" | |
uses: actions-rs/cargo@v1 | |
env: | |
MONGO_ADDRESS: mongodb://localhost:27017/gilgamesh | |
with: | |
command: test | |
args: --features storage-tests | |
- name: "Print sccache stats" | |
run: sccache --show-stats | |
- name: "Stop sccache server" | |
run: sccache --stop-server || true | |
release: | |
needs: [tasks, integration] | |
if: github.event_name != 'pull_request' | |
uses: ./.github/workflows/release.yml | |
secrets: inherit |