feat: add basic ci #1
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: PR Commit | |
on: | |
pull_request: | |
branches: [main] | |
env: | |
WORKSPACE_ROOT: . | |
CACHE_SUFFIX: c # cache busting | |
# Cancel redundant workflow runs | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
pre_job: | |
name: Run Workflow? | |
runs-on: ubuntu-22.04 | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@master | |
with: | |
concurrent_skipping: 'never' | |
skip_after_successful_duplicate: 'true' | |
# Changes to paths must be synced with pr-merge*.yml | |
paths: '[".github/workflows/pr-commit.yml", "web/**", "*"]' | |
paths_ignore: '["**/Readme.md"]' | |
check-format: | |
needs: pre_job | |
if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
name: Format, Lint, Unit Test | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code into workspace directory | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/env-setup | |
- name: Check code format | |
run: npm run format:check | |
- name: Lint source code | |
if: success() || failure() | |
run: npm run lint | |
- name: Lint style | |
if: success() || failure() | |
run: npm run lint:style | |
build-apps: | |
needs: pre_job | |
if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
name: Build Apps | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code into workspace directory | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/env-setup | |
- name: Build web app | |
run: npm run prod:web:build |