Node 20対応 #1061
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |