-
Notifications
You must be signed in to change notification settings - Fork 7
139 lines (137 loc) · 4.34 KB
/
test.yaml
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: CI / Console
on:
push:
branches: [master]
pull_request:
branches: ["*"]
jobs:
build:
name: Test Build Docker image
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/pluralsh/console
docker.io/pluralsh/console
# generate Docker tags based on the following events/attributes
tags: |
type=sha
type=ref,event=pr
type=ref,event=branch
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker
uses: docker/login-action@v3
with:
username: mjgpluralsh
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
# - name: download jwt verification key
# run: |
# echo $JWT_PUBLIC_KEY > config/pubkey.pem
# env:
# JWT_PUBLIC_KEY: ${{ secrets.JWT_PUBLIC_KEY }}
- name: Test Build console image
uses: docker/build-push-action@v3
with:
context: "."
file: "./Dockerfile"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
GIT_COMMIT=${{ github.sha }}
VITE_PROD_SECRET_KEY=${{ secrets.VITE_PROD_SECRET_KEY }}
test:
name: Test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
version-file: .tool-versions
version-type: strict
- uses: azure/setup-helm@v3
with:
version: latest
- run: make testup
# - name: download jwt verification key
# run: |
# echo $JWT_PUBLIC_KEY > config/pubkey.pem
# env:
# JWT_PUBLIC_KEY: ${{ secrets.JWT_PUBLIC_KEY }}
- name: Restore dependencies cache
uses: actions/cache@v3
with:
path: deps
key: ${{ runner.os }}-mix-2-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-2
- name: Restore _build
uses: actions/cache@v3
with:
path: _build
key: ${{ runner.os }}-mix-2-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-2
- run: mix deps.get
- run: mix test
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: workflow,job,repo,message,commit,author
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
if: always()
updateSchema:
name: Check that Schema is up to date
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
version-file: .tool-versions
version-type: strict
- name: Restore dependencies cache
uses: actions/cache@v3
with:
path: deps
key: ${{ runner.os }}-mix-2-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-2
- name: Restore _build
uses: actions/cache@v3
with:
path: _build
key: ${{ runner.os }}-mix-2-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-2
- name: get dependencies
run: mix deps.get
- name: update schema
run: MIX_ENV=test mix absinthe.schema.sdl --schema Console.GraphQl schema/schema.graphql
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v17
id: verify-changed-files
with:
files: |
schema/schema.graphql
- name: Schema changed
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
echo "::error Schema has changed changed. Please run 'make update-schema' and commit the changes."
exit 1