This repository has been archived by the owner on Dec 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
139 lines (110 loc) · 3.82 KB
/
ci-playground.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Continuous Integration playground
on:
pull_request:
paths:
- '.github/workflows/ci-playground.yml'
- 'backend/**'
- 'frontend/**'
jobs:
frontend:
runs-on: ubuntu-latest
if: "! contains(github.event.head_commit.message, '[CI Skip]')"
defaults:
run:
working-directory: ./frontend
steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: "14"
- name: Install
run: yarn install --check-files
- name: Lint
run: yarn lint
- name: Audit
run: yarn audit
- name: Build
run: yarn build
- name: Test
run: yarn test
backend:
runs-on: ubuntu-latest
if: "! contains(github.event.head_commit.message, '[CI Skip]')"
defaults:
run:
working-directory: ./backend
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
components: rustfmt, clippy
- name: Check Formatting
run: cargo check-fmt
- name: Lint
run: cargo lint
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
docker:
runs-on: ubuntu-latest
if: "! contains(github.event.head_commit.message, '[CI Skip]')"
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v1
with:
install: true
- name: Build frontend Dockerfile
run: cd frontend && docker build -f Dockerfile .
- name: Build backend Dockerfile
run: cd backend && docker build -f Dockerfile .
- uses: AbsaOSS/k3d-action@b176c2a6dcae72e3e64e3e4d61751904ec314002 # v2.3.0
with:
cluster-name: "pg-cluster"
args: >-
--k3s-arg '--tls-san=127.0.0.1@server:*'
--k3s-arg '--no-deploy=traefik@server:*'
--k3s-node-label "cloud.google.com/gke-nodepool=default-workspace@server:0"
--port 80:80@loadbalancer
--port 443:443@loadbalancer
- name: Set environment
id: env
run: |
echo "sha=sha-${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
- name: Set up Kustomize
run: |-
curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv3.6.1/kustomize_v3.6.1_linux_amd64.tar.gz
tar zxvf kustomize*
chmod u+x ./kustomize
working-directory: resources/k8s/overlays/dev
- name: Update version
run: |-
./kustomize edit set image paritytech/substrate-playground-backend-api:${{ steps.env.outputs.sha }}
./kustomize edit set image paritytech/substrate-playground-backend-ui:${{ steps.env.outputs.sha }}
working-directory: resources/k8s/overlays/dev
- name: Load docker images
run: k3d image import paritytech/substrate-playground-backend-api:${{ steps.env.outputs.sha }} paritytech/substrate-playground-backend-ui:${{ steps.env.outputs.sha }} -c pg-cluster
- name: Configure playground
run: |-
make k8s-setup-env
make dev-create-certificate
make k8s-update-certificate
env:
GH_CLIENT_ID: ${{ secrets.GH_CLIENT_ID }}
GH_CLIENT_SECRET: ${{ secrets.GH_CLIENT_SECRET }}
- name: Deploy playground
run: make k8s-deploy
- name: Wait for deployment
run: sleep 300
# Will not run authenticated tests when triggered by PR
# See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
- name: Run e2e tests
run: yarn && yarn test
working-directory: ./e2e
timeout-minutes: 3
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}