-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (70 loc) · 2.09 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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
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 --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}