cal.pub0.org/.github/workflows/pr.yml

89 lines
2.4 KiB
YAML
Raw Normal View History

2023-02-18 02:13:25 +00:00
name: PR Update
on:
pull_request:
workflow_dispatch:
env:
2023-02-18 02:57:07 +00:00
node_version: ${{ secrets.NODE_VERSION }}
2023-02-18 02:13:25 +00:00
pr_id: ${{ github.event.number }}
2023-02-18 03:12:06 +00:00
# last_commit_sha: ${{ github.event.pull_request.head.sha }}
2023-02-18 02:13:25 +00:00
gh_action_name: pull_request
2023-02-18 03:12:06 +00:00
bsr_filename_txt: bundle-size-report.txt
stale_build_files_find_args: -maxdepth 1 -type f -regextype posix-egrep -regex ".*\.(json|js|css|map|txt)$"
2023-02-18 02:13:25 +00:00
merge_base_cmd: git merge-base origin/${{ github.base_ref }} ${{ github.event.pull_request.head.sha }}
concurrency:
group: pr-update-${{ github.event.number }}
cancel-in-progress: true
jobs:
setup:
name: Yarn install & cache
2023-02-18 03:12:06 +00:00
uses: ./.github/workflows/yarn_install.yml
2023-02-18 02:13:25 +00:00
secrets:
2023-02-18 02:57:07 +00:00
node_version: ${{ secrets.NODE_VERSION }}
2023-02-18 03:12:06 +00:00
2023-02-18 02:13:25 +00:00
lint:
name: Linters
runs-on: ubuntu-latest
needs: setup
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v3
name: Set nodeJs version
with:
node-version: ${{ env.node_version }}
- name: Restore node_modules from cache
uses: actions/cache@v3
env:
cache_name: node-modules-yarn
cache_fingerprint: ${{ env.node_version }}-${{ hashFiles('yarn.lock') }}
with:
path: node_modules
key: ${{ runner.os }}-${{ env.cache_name }}-${{ env.cache_fingerprint }}
- name: lint the code
run: yarn lint
build:
name: Production build
needs: setup
2023-02-18 02:55:47 +00:00
uses: ./.github/workflows/production-build.yml
2023-02-18 03:12:06 +00:00
with:
pr_id: ${{ github.event.number }}
2023-02-18 02:13:25 +00:00
secrets:
2023-02-18 03:12:06 +00:00
node_version: ${{ secrets.NODE_VERSION }}
2023-02-18 02:13:25 +00:00
e2e-test:
name: E2E tests
runs-on: ubuntu-latest
2023-02-18 03:12:06 +00:00
needs: [lint, build]
2023-02-18 02:13:25 +00:00
2023-02-18 03:12:06 +00:00
timeout-minutes: 10
2023-02-18 02:13:25 +00:00
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v3
name: Set nodeJs version
with:
node-version: ${{ env.node_version }}
- name: Restore node_modules from cache
uses: actions/cache@v3
env:
cache_name: node-modules-yarn
cache_fingerprint: ${{ env.node_version }}-${{ hashFiles('yarn.lock') }}
with:
path: node_modules
key: ${{ runner.os }}-${{ env.cache_name }}-${{ env.cache_fingerprint }}
2023-02-18 03:12:06 +00:00
# figure the better way supporting all the packages
- name: Fake yarn postinstall
run: yarn playwright install
- name: Run tests
run: yarn e2e