-
Notifications
You must be signed in to change notification settings - Fork 42
69 lines (57 loc) · 1.74 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
name: Unit Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: Run unit tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
db_required: true
- os: windows-latest
db_required: false
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install latest docker-compose
if: matrix.os == 'ubuntu-latest'
run: sudo curl -SL https://github.com/docker/compose/releases/download/v2.24.7/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose
- name: Install modules
uses: pnpm/action-setup@v4
- name: Install dependencies
run: pnpm install
- name: Start database
if: matrix.db_required
run: |
docker-compose up -d database
- name: Apply database migrations
if: matrix.db_required
run: pnpm --filter @codemod-com/backend db:migrate:apply
env:
DATABASE_URI: ${{ secrets.DATABASE_URI }}
- name: Build necessary packages
run: pnpm build --filter codemod --filter @codemod-com/jscodeshift-utils
- name: Run unit tests
run: |
if [[ ${{ matrix.os }} == "windows-latest" ]]; then
pnpm test:win
else
pnpm build --filter @codemod-com/backend && pnpm test
fi
shell: bash
env:
DATABASE_URI: ${{ secrets.DATABASE_URI }}
- name: Close database
if: matrix.db_required
run: docker-compose down