Skip to content

Commit 7b82992

Browse files
committed
Run tests before deploying
1 parent f2edb28 commit 7b82992

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

.github/workflows/main.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,31 @@ on:
55
branches:
66
- 'main'
77
jobs:
8+
test:
9+
name: Run tests
10+
runs-on: ubuntu-latest
11+
container:
12+
image: node:22-alpine
13+
steps:
14+
- name: "checkout"
15+
uses: actions/checkout@v4
16+
- name: "cache packages"
17+
id: cache-packages
18+
uses: actions/cache@v4
19+
with:
20+
key: ${{ hashFiles('package.json') }}
21+
path: |
22+
.yarn/cache
23+
node_modules
24+
- name: yarn
25+
if: steps.cache-packages.outputs.cache-hit != 'true'
26+
run: yarn
27+
- name: run tests
28+
run: yarn test
829
deploy:
930
name: Deploy app
1031
runs-on: ubuntu-latest
11-
# needs: deploy-infra
32+
needs: test
1233
concurrency: deploy-group # optional: ensure only one action runs at a time
1334
steps:
1435
- uses: actions/checkout@v4

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"type": "module",
33
"scripts": {
4-
"start": "node --require ts-node/register src/app.ts"
4+
"start": "node --require ts-node/register src/app.ts",
5+
"test": "npx mocha tests/**/*.ts"
56
},
67
"dependencies": {
78
"@types/handlebars": "^4.1.0",

0 commit comments

Comments
 (0)