Skip to content

Feature: Justfiles and ci #58

Feature: Justfiles and ci

Feature: Justfiles and ci #58

Workflow file for this run

name: CI/CD
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
backend-ci:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install latest stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Install just
run: |
# Update nix
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update
nix-env -iA nixpkgs.just
nix-env -iA nixpkgs.xmlstarlet
nix-env -iA nixpkgs.cargo-tarpaulin
- name: Lint code
run: just lint
working-directory: ./apps/backend/backend-server
env:
CARGO_TERM_COLOR: always
- name: Calculate test coverage
working-directory: ./apps/backend/backend-server
run: |
just test-coverage
COVERAGE=$(cat cobertura.xml | xmlstarlet sel -t -v "/coverage/@line-rate" | awk '{printf "%.2f", $1 * 100}')%
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV
env:
CARGO_TERM_COLOR: always
frontend-ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: npm install
working-directory: ./apps/frontend
- name: Build
run: npm run build
working-directory: ./apps/frontend
data-pipeline-ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install latest stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Install just
run: |
# Update nix
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update
nix-env -iA nixpkgs.just
nix-env -iA nixpkgs.xmlstarlet
nix-env -iA nixpkgs.cargo-tarpaulin
- name: Run pipeline
run: echo "Runing data pipeline"
working-directory: ./ci/data-pipeline
deploy:
runs-on: ubuntu-latest
needs:
- backend-ci
- frontend-ci
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- name: Deploy
if: github.ref == 'refs/heads/main'
run: flyctl deploy --local-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}