refactor(ci): according to PR comments #2
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
on: [push] | |
name: PACT and iLEAP CI & CD | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
name: Rust projects | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache target | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: CI | |
run: | | |
cargo build | |
cargo test | |
cargo clippy -- -Dwarnings | |
- name: SQLITE3 Smoke Test | |
working-directory: ileap-data-model/sql-example | |
run: | | |
sqlite3 < ileap.sql | |
demo_api_deployment: | |
runs-on: ubuntu-latest | |
name: Deploy demo API | |
if: github.ref == 'refs/heads/main' | |
needs: build_and_test | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- run: flyctl deploy --remote-only --config demo-api/fly.production.toml | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
demo_preview_api_deployment: | |
runs-on: ubuntu-latest | |
name: Deploy preview demo API | |
if: github.ref == 'refs/heads/preview' | |
needs: build_and_test | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- run: flyctl deploy --remote-only --config demo-api/fly.production.toml | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |