-
-
Notifications
You must be signed in to change notification settings - Fork 31
186 lines (148 loc) · 5.31 KB
/
scheduled.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Scheduled
on:
schedule:
- cron: '24 8 * * 0,3,5'
jobs:
fmt:
strategy:
matrix:
version: [vx.x.x, canary]
name: Test format and lint
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v3
- name: Install deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.version }}
- name: Run test for format and lint
run: make test_fmt
unit:
strategy:
matrix:
version: [vx.x.x, canary]
name: Test unit
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v3
- name: Install deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.version }}
- name: Run unit tests
run: make test_unit
- name: Generate lcov
run: deno coverage --unstable --lcov ./coverage > coverage.lcov
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
files: coverage.lcov
flags: unit
cli:
strategy:
matrix:
version: [vx.x.x, canary]
name: Test CLI
runs-on: ubuntu-latest
env:
URL_PATH: ${{github.repository}}/main
steps:
- name: Install deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.version }}
- name: Nessie Init
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts init --dialect sqlite
- run: sed -i "s|from \".*\"|from \"https://raw.githubusercontent.com/$URL_PATH/mod.ts\"|" nessie.config.ts && cat nessie.config.ts
- name: Create migration
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts make test
- name: Create migration
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts make:migration test2
- name: Create seed
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts make:seed test
- run: echo "test" >> test_template
- name: Create migration from custom template
run: |
deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts make:migration --migrationTemplate test_template test_migration_template
TEMPLATE_PATH=$(find db/migrations -type f -name "*test_migration_template.ts")
TEMPLATE_CONTENT=$(cat $TEMPLATE_PATH)
if [[ $TEMPLATE_CONTENT != "test" ]]; then echo "File $TEMPLATE_PATH was not correct, was:\n$TEMPLATE_CONTENT" && exit 1; fi
- name: Create seed from custom template
run: |
deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts make:seed --seedTemplate test_template test_seed_template
TEMPLATE_PATH=$(find db/seeds -type f -name "test_seed_template.ts")
TEMPLATE_CONTENT=$(cat $TEMPLATE_PATH)
if [[ $TEMPLATE_CONTENT != "test" ]]; then echo "File $TEMPLATE_PATH was not correct, was:\n$TEMPLATE_CONTENT" && exit 1; fi
- name: Clean files and folders
run: rm -rf db && rm -rf nessie.config.ts
- name: Init with mode and pg
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts init --mode config --dialect pg
- name: Init with mode and mysql
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts init --mode config --dialect mysql
- name: Init with mode and sqlite
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts init --mode config --dialect sqlite
- name: Init with folders only
run: deno run -A --unstable https://raw.githubusercontent.com/$URL_PATH/cli.ts init --mode folders
cli-migrations:
strategy:
matrix:
version: [vx.x.x, canary]
name: Test CLI Migrations
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: pwd
POSTGRES_DB: nessie
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5000:5432
mysql:
image: mysql
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: nessie
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
ports:
- 5001:3306
steps:
- name: Clone repo
uses: actions/checkout@v3
- name: Install deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.version }}
- name: Create databases
run: make db_sqlite_start
- name: Run tests
run: make test_integration_cli
- name: Generate lcov
run: deno coverage --unstable --lcov ./coverage > coverage.lcov
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
files: coverage.lcov
flags: integration-cli
image-test:
name: Test Docker image build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build image
run: make image_build
env:
DENO_VERSION: latest
- name: Test image
run: make image_test