-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (101 loc) · 3.14 KB
/
build-test-deploy.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: BuildTestDeploy
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
test-backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run backend linting and testing
run: cd backend && ./run quality_check
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
test-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Run frontend linting and testing
run: cd frontend/pace-ui && npm install && ./run quality_check
build:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [ test-backend, test-frontend ]
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Registry
uses: docker/[email protected]
with:
registry: registry.k3s.colodeck.de
username: github
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push pace3
uses: docker/build-push-action@v4
with:
context: ./backend/
file: ./backend/Dockerfile
push: true
provenance: false
tags: registry.k3s.colodeck.de/pace3:latest
- name: Build and push migration
uses: docker/build-push-action@v4
with:
context: ./backend/
file: ./backend/Dockerfile.migration
push: true
provenance: false
tags: registry.k3s.colodeck.de/pace3-migration:latest
- name: Build and push pace3 frontend
uses: docker/build-push-action@v4
with:
context: ./frontend/pace-ui/
file: ./frontend/pace-ui/Dockerfile
push: true
provenance: false
tags: registry.k3s.colodeck.de/pace3-frontend:latest
deploy-dev:
if: github.ref == 'refs/heads/main'
runs-on: self-hosted
needs: build
env:
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
steps:
- uses: actions/checkout@v3
- name: deploy
run: kubectl apply -k infra-setup/dev
- name: reload
run: kubectl -n pace3 rollout restart deployment pace3-deployment
- name: wait
run: kubectl -n pace3 rollout status deployment pace3-deployment --timeout=2200s
cypress-run:
runs-on: ubuntu-20.04
needs: deploy-dev
env:
CYPRESS_BASE_URL: "https://pace3.lauf-gegen-rechts.de/"
steps:
- uses: actions/checkout@v3
- uses: cypress-io/github-action@v4
with:
working-directory: cypress
spec: cypress/e2e/user/registration.cy.js
deploy-prod:
if: github.ref == 'refs/heads/main'
runs-on: self-hosted
needs: cypress-run
env:
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
steps:
- uses: actions/checkout@v3
- name: deploy
run: kubectl apply -k infra-setup/prod
- name: reload
run: kubectl -n pace3-prod rollout restart deployment pace3-deployment
- name: wait
run: kubectl -n pace3-prod rollout status deployment pace3-deployment --timeout=2200s