-
Notifications
You must be signed in to change notification settings - Fork 22
170 lines (165 loc) · 5.23 KB
/
test.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: test
on:
pull_request:
types: [opened, synchronize]
branches:
- master
push:
branches:
- master
workflow_dispatch:
permissions:
contents: read
pull-requests: write
jobs:
changes:
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]' && contains(github.event.commits.*.message, '[skip ci]') == false
outputs:
frontend: ${{ steps.filter.outputs.backend }}
backend: ${{ steps.filter.outputs.backend }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
frontend:
- 'frontend/**'
backend:
- 'backend/**'
frontend-test:
name: frontend-test
needs: changes
runs-on: ubuntu-latest
if: ${{ needs.changes.outputs.frontend == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".tool-versions"
- uses: extractions/setup-just@v2
- uses: actions/setup-go@v5
with:
go-version-file: "backend/go.mod"
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
working-directory: frontend
- uses: actions/cache@v4
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('**/frontend/package-lock.json') }}
${{ runner.os }}-node-
- name: Install Dependencies
working-directory: frontend
run: npm ci --include=dev
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
with:
path: frontend
- name: Generate elm-constants
working-directory: frontend
run: npm run generate:elm-constants
env:
API_ROOT: ${{ secrets.API_ROOT }}
WEB_ROOT: ${{ secrets.WEB_ROOT }}
APP_VERSION: ${{ steps.package-version.outputs.current-version}}
REPO_BUTTON_URL: ${{ secrets.REPO_BUTTON_URL }}
- name: Check format
working-directory: frontend
run: npm run format:validate
- name: Run Tests
working-directory: frontend
run: npm run test
- name: Migrate database
run: |
go install github.com/amacneil/dbmate@latest
just migrate
working-directory: backend
env:
DB_TYPE: sqlite
DATABASE_URL: sqlite3:textusm.db
- name: Setup E2E
run: npm run test:e2e:init
working-directory: frontend
- name: Run E2E Tests
run: npm run test:e2e
working-directory: frontend
env:
API_ROOT: http://localhost:8081
WEB_ROOT: http://localhost:3000
APP_VERSION: ""
FIREBASE_API_KEY: textusm
FIREBASE_AUTH_DOMAIN: textusm
FIRESTORE_EMULATOR_HOST: "localhost:8082"
FIREBASE_PROJECT_ID: textusm
FIREBASE_STORAGE_BUKET: textusm.appspot.com
FIREBASE_STORAGE_EMULATOR_HOST: "localhost:9199"
FIREBASE_AUTH_EMULATOR_HOST: "localhost:9099"
FIREBASE_APP_ID: dev
STORAGE_BUCKET_NAME: textusm.appspot.com
SENTRY_ENABLE: "0"
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_RELEASE: ${{ steps.package-version.outputs.current-version}}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
MONITOR_ENABLE: "0"
USE_HTTPS: "0"
REPO_BUTTON_URL: ""
API_VERSION: v0.14.8
PORT: 8081
GO_ENV: development
DATABASE_URL: textusm.db
DB_TYPE: sqlite
backend-test:
name: backend_test
needs: changes
runs-on: ubuntu-latest
if: ${{ needs.changes.outputs.backend == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "backend/go.mod"
- uses: extractions/setup-just@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
working-directory: backend
args: --issues-exit-code=0 --timeout=2m
- name: Run tests
run: just test
working-directory: backend
analyze:
name: analyze
needs: changes
runs-on: ubuntu-latest
if: ${{ needs.changes.outputs.frontend == 'true' || needs.changes.outputs.backend == 'true' }}
permissions:
security-events: write
strategy:
fail-fast: false
matrix:
language: ["go", "typescript"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "backend/go.mod"
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3