-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (71 loc) · 2.35 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
77
name: CI
run-name: ${{ github.actor }} is running ${{ github.workflow }} on commit ${{ github.sha }}
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
DOCKER_TAG: ${{ secrets.DOCKER_USERNAME }}/team8:${{ github.sha }}
IS_PUSH_TO_MAIN: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
jobs:
build:
runs-on: ubuntu-latest
concurrency:
group: build-${{ github.sha }}
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
if: ${{ env.IS_PUSH_TO_MAIN }}
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.DOCKER_TAG }}
cache-from: type=registry,ref=${{ env.DOCKER_TAG }}
cache-to: type=inline
lint:
runs-on: ubuntu-latest
needs: build
concurrency:
group: lint-${{ github.sha }}
cancel-in-progress: true
steps:
- name: Run linter on workspace backend
id: backend
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/backend lint
- name: Run linter on workspace frontend
id: frontend
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/frontend lint
- name: Run linter on workspace types
id: types
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/types lint
- name: Run linter on workspace constants
id: constants
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/constants lint
- name: Run linter on workspace utils
id: utils
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/utils lint
tests-unit-backend:
runs-on: ubuntu-latest
needs: build
concurrency:
group: tests-unit-backend-${{ github.sha }}
cancel-in-progress: true
steps:
- name: Run unit tests on workspace backend
id: backend
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/backend test:unit