Skip to content

Merge pull request #7 from sine-fdn/martin/ci-fix #24

Merge pull request #7 from sine-fdn/martin/ci-fix

Merge pull request #7 from sine-fdn/martin/ci-fix #24

on: [push]
name: iLEAP Demo API CI & CD
concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
build_and_test:
name: Rust project
runs-on: ubuntu-latest
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
working-directory: demo-api
run: |
make ci
cargo clippy -- -Dwarnings
deploy_preview:
needs: build_and_test
if: github.ref == 'refs/heads/preview'
name: Deploy preview app
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only --config demo-api/fly.staging.toml
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_PREVIEW_TOKEN }}
deploy:
needs: build_and_test
if: github.ref == 'refs/heads/main'
name: Deploy app
runs-on: ubuntu-latest
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 }}