Merge pull request #4036 from traPtitech/dependabot/npm_and_yarn/pini… #6766
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: | |
jobs: | |
packages: | |
name: check npm install | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: ./.node-version | |
cache: npm | |
- name: check npm ci | |
run: npm ci | |
lint: | |
name: run lint | |
runs-on: ubuntu-latest | |
needs: [packages] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: ./.node-version | |
cache: npm | |
- name: npm ci | |
run: npm ci | |
env: | |
CYPRESS_INSTALL_BINARY: 0 | |
- name: run lint | |
run: npm run lint:no-fix -- --max-warnings=0 | |
format: | |
name: run format | |
runs-on: ubuntu-latest | |
needs: [packages] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: ./.node-version | |
cache: npm | |
- name: npm ci | |
run: npm ci | |
env: | |
CYPRESS_INSTALL_BINARY: 0 | |
- name: run format | |
run: npx prettier --check . | |
type-check: | |
name: run type-check | |
runs-on: ubuntu-latest | |
needs: [packages] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: ./.node-version | |
cache: npm | |
- name: npm ci | |
run: npm ci | |
env: | |
CYPRESS_INSTALL_BINARY: 0 | |
- name: run type-check | |
run: npm run type-check | |
build: | |
name: run build | |
runs-on: ubuntu-latest | |
needs: [packages] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: ./.node-version | |
cache: npm | |
- uses: actions/cache@v3 | |
with: | |
path: ./public/fonts | |
key: font-build-${{ runner.os }} | |
restore-keys: | | |
font-build-${{ runner.os }} | |
- name: npm ci | |
run: npm ci | |
env: | |
CYPRESS_INSTALL_BINARY: 0 | |
- name: run build | |
run: npm run build:may-with-font | |
test-unit: | |
name: run test:unit | |
runs-on: ubuntu-latest | |
needs: [packages] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: ./.node-version | |
cache: npm | |
- name: npm ci | |
run: npm ci | |
env: | |
CYPRESS_INSTALL_BINARY: 0 | |
- name: run test:unit | |
run: npm run test:unit | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: ./coverage | |
codecov: | |
name: Upload coverage to Codecov | |
runs-on: ubuntu-latest | |
needs: [test-unit] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: coverage | |
path: ./coverage | |
- uses: codecov/codecov-action@v3 | |
test-e2e: | |
name: run test:e2e | |
runs-on: ubuntu-latest | |
needs: [packages] | |
if: (github.repository_owner == 'traPtitech' && github.actor != 'dependabot[bot]') | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: ./.node-version | |
cache: npm | |
- uses: actions/cache@v3 | |
with: | |
path: ./public/fonts | |
key: font-build-${{ runner.os }} | |
restore-keys: | | |
font-build-${{ runner.os }} | |
- name: npm ci | |
run: npm ci | |
- name: run test:e2e | |
run: npm run test:e2e-headless | |
if: env.CYPRESS_username != null | |
env: | |
CYPRESS_username: ${{ secrets.traQ_username }} | |
CYPRESS_password: ${{ secrets.traQ_password }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: failed-screenshots | |
path: ./tests/e2e/screenshots | |
if: ${{ failure() }} |