Merge pull request #1480 from TyperOfCode/master #1056
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 | |
RUST_TEST_THREADS: 1 | |
CARGO_PROFILE_TEST_DEBUG: 0 | |
SQL_URL: postgres://db_user:db_pass@localhost:5432/test_db | |
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: 16 | |
- name: Cache node_modules | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.cache/Cypress | |
./atcoder-problems-frontend/node_modules | |
key: ${{ runner.os }}-cargo-${{ 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 |