Skip to content

make github workflow jobs concurrent and add caching #3

make github workflow jobs concurrent and add caching

make github workflow jobs concurrent and add caching #3

Workflow file for this run

name: Cypher Backend CI
on:
push:
branches: [main]
paths:
- 'cypher/backend/**'
- '.github/workflows/cypher-backend.yml'
pull_request:
paths:
- 'cypher/backend/**'
- '.github/workflows/cypher-backend.yml'
env:
PDS_EMAIL_FROM_ADDRESS: "noreply@blacksky.app"
PDS_EMAIL_FROM_NAME: "noreply"
PDS_MODERATION_EMAIL_FROM_NAME: "noreply"
PDS_MODERATION_EMAIL_FROM_ADDRESS: "noreply@blacksky.app"
PDS_HOSTNAME: "localho.st"
PDS_SERVICE_DID: "did:web:localho.st"
PDS_ADMIN_PASS: ${{ secrets.PDS_ADMIN_PASS }}
PDS_JWT_KEY_K256_PRIVATE_KEY_HEX: ${{ secrets.PDS_JWT_KEY_K256_PRIVATE_KEY_HEX }}
PDS_MAILGUN_API_KEY: ${{ secrets.PDS_MAILGUN_API_KEY }}
PDS_MAILGUN_DOMAIN: ${{ secrets.PDS_MAILGUN_DOMAIN }}
PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX: ${{ secrets.PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX }}
PDS_REPO_SIGNING_KEY_K256_PRIVATE_KEY_HEX: ${{ secrets.PDS_REPO_SIGNING_KEY_K256_PRIVATE_KEY_HEX }}
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: cypher-backend
- name: Run cargo check
working-directory: cypher/backend
run: cargo check
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: cypher-backend
- name: Run cargo build
working-directory: cypher/backend
run: cargo build --release
test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: cypher-backend
- name: Run cargo test
working-directory: cypher/backend
run: cargo test
formatting:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: cypher-backend
- name: Run cargo fmt
working-directory: cypher/backend
run: cargo fmt -- --check
ci-success:
runs-on: ubuntu-latest
needs: [check, build, test, formatting]
if: always()
steps:
- name: CI Success
if: ${{ !contains(needs.*.result, 'failure') }}
run: echo "All Cypher Backend CI jobs passed!"
- name: CI Failed
if: ${{ contains(needs.*.result, 'failure') }}
run: |
echo "Some Cypher Backend CI jobs failed!"
exit 1