-
-
Notifications
You must be signed in to change notification settings - Fork 151
112 lines (92 loc) · 2.87 KB
/
ci.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
name: CI
on:
push:
branches: [master]
pull_request:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
CARGO_PROFILE_TEST_DEBUG: 0
RUST_TEST_THREADS: 1
SQL_URL: postgres://db_user:db_pass@localhost:5432/test_db
# Node 17でOpenSSLがデフォルトでMD4ハッシュを提供しなくなり、
# これに依存していたwebpackに依存するreact-scripts 4.x系でのビルドができなくなってしまった。
# --openssl-legacy-providerをオプションとして渡すことで、Node 17以降でもビルドができる。
# react-scripts 4.x系から移行したら、このオプションは不要になる。
NODE_OPTIONS: --openssl-legacy-provider
jobs:
backend_test:
name: Run backend tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./atcoder-problems-backend
services:
postgres:
image: postgres
env:
POSTGRES_USER: db_user
POSTGRES_PASSWORD: db_pass
POSTGRES_DB: test_db
POSTGRES_INITDB_ARGS: "--encoding=UTF8"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/[email protected]
- name: Cache dependencies
uses: Swatinem/[email protected]
with:
workspaces: atcoder-problems-backend -> target
- name: Setup Postgresql
run: psql ${SQL_URL} < ../config/database-definition.sql
- name: Setup
run: rustup component add rustfmt
- name: Check format
run: cargo fmt --all -- --check
- name: Download dependencies
run: cargo fetch --locked
- name: Build
run: cargo test --no-run --workspace --locked --verbose
- name: Run tests
run: cargo test --workspace --locked --verbose -- --test-threads=1
frontend_test:
name: Run frontend tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./atcoder-problems-frontend
steps:
- uses: actions/[email protected]
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 20
- name: Cache dependencies
uses: actions/[email protected]
with:
path: |
~/.cache/Cypress
atcoder-problems-frontend/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('atcoder-problems-frontend/yarn.lock') }}
- name: Install dependencies
run: yarn
- name: Setup mdBook
uses: peaceiris/[email protected]
with:
mdbook-version: "latest"
- name: build
run: yarn build
- name: test
run: yarn test
- name: lint
run: yarn lint
- name: Integration test
run: |
yarn prepare-ci
yarn start:ci &
yarn cy:run