-
Notifications
You must be signed in to change notification settings - Fork 173
167 lines (154 loc) · 5.31 KB
/
ts_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
name: TS tests
on:
push:
branches: ["main"]
paths-ignore:
- "website/**"
- "**/README.md"
pull_request:
paths-ignore:
- "website/**"
- "**/README.md"
permissions:
contents: read
jobs:
list_ts_packages:
name: List packages
runs-on: ubuntu-latest
outputs:
directories: ${{ steps.list_ts_packages.outputs.directories }}
steps:
- uses: actions/checkout@v4
- run: echo "directories=`find packages/ -mindepth 1 -maxdepth 1 -type d -exec test -e '{}'/tsconfig.json \; -print | jq -R -s -c 'split("\n")[:-1]'`" >> $GITHUB_OUTPUT
id: list_ts_packages
list_examples:
name: List examples
runs-on: ubuntu-latest
outputs:
example_names: ${{ steps.list_examples.outputs.example_names }}
steps:
- uses: actions/checkout@v4
- run: echo "example_names=$(find examples/ -mindepth 1 -maxdepth 2 -type f -name package.json | xargs dirname | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
id: list_examples
check_packages:
name: Check ${{ matrix.package_dir }}
needs: [list_ts_packages]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package_dir: ${{ fromJson(needs.list_ts_packages.outputs.directories) }}
defaults:
run:
working-directory: ${{ matrix.package_dir }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- run: pnpm install --frozen-lockfile
- run: pnpm -r --filter "$(jq '.name' -r package.json)^..." build
- run: pnpm run stylecheck
- run: pnpm run typecheck
build_and_test_packages:
name: Build and test
needs: [list_ts_packages]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package_dir: ${{ fromJson(needs.list_ts_packages.outputs.directories) }}
defaults:
run:
working-directory: ${{ matrix.package_dir }}
env:
ELECTRIC_DATABASE_ID: ci_test_tenant
MIX_ENV: dev
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
version-type: strict
version-file: ".tool-versions"
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Cache dependencies
uses: actions/cache@v4
with:
path: packages/sync-service/deps
key: "${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-${{ hashFiles('packages/sync-service/mix.lock') }}"
restore-keys: |
${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-${{ hashFiles('packages/sync-service/mix.lock') }}
${{ runner.os }}-sync-service-deps-${{ env.MIX_ENV }}-
${{ runner.os }}-sync-service-deps-
- name: Cache compiled code
uses: actions/cache@v4
with:
path: |
packages/sync-service/_build/*/lib
!packages/sync-service/_build/*/lib/electric
key: "${{ runner.os }}-sync-service-build-${{ env.MIX_ENV }}-[${{ github.ref_name }}]-${{ github.sha }}"
restore-keys: |
${{ runner.os }}-sync-service-build-${{ env.MIX_ENV }}-[${{ github.ref_name }}]-${{ github.sha }}
${{ runner.os }}-sync-service-build-${{ env.MIX_ENV }}-[${{ github.ref_name }}]-
${{ runner.os }}-sync-service-build-${{ env.MIX_ENV }}-
${{ runner.os }}-sync-service-build-
- name: Install dependencies
run: mix deps.get && mix deps.compile
working-directory: packages/sync-service
- name: Compile sync-service
run: mix compile
working-directory: packages/sync-service
- uses: JarvusInnovations/background-action@v1
name: Bootstrap System Under Test (SUT)
with:
run: |
mix start_dev
mix run --no-halt &
wait-on: |
http-get://localhost:3000/v1/health?database_id=${{ env.ELECTRIC_DATABASE_ID }}
tail: true
log-output-resume: stderr
wait-for: 1m
log-output: true
log-output-if: failure
working-directory: packages/sync-service
- name: build dependencies, if any
run: pnpm -r --filter "$(jq '.name' -r package.json)^..." build
- run: pnpm test
check_and_build_examples:
name: Check and build ${{ matrix.example_folder }}
needs: [list_examples, build_and_test_packages]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example_folder: ${{ fromJson(needs.list_examples.outputs.example_names) }}
defaults:
run:
working-directory: ${{ matrix.example_folder }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm -r --filter "$(jq '.name' -r package.json)^..." build
- run: pnpm --if-present run typecheck
- run: pnpm --if-present run build
- run: pnpm --if-present run test
- run: pnpm --if-present run stylecheck