split build and test pipeline

This commit is contained in:
Yizhou Mo
2022-09-29 01:35:35 +08:00
parent 9dba6ec80f
commit 1d32a34314
2 changed files with 32 additions and 25 deletions

28
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: "build"
on: # rebuild any PRs and main branch changes
pull_request:
branches: [ "master" ]
push:
branches: [ "master" ]
jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci
- run: npm run all
- name: Compare the expected and actual dist
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff
- name: upload the expected dist
uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/

View File

@@ -1,34 +1,13 @@
name: "build-test" name: "test"
on: # rebuild any PRs and main branch changes on:
pull_request: pull_request:
branches: [ "master" ]
push: push:
branches: branches: [ "master" ]
- master
schedule: schedule:
- cron: '0 0 * * *' - cron: '0 0 * * *'
jobs: jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci
- run: npm run all
- name: Compare the expected and actual dist
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff
- name: upload the expected dist
uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/
test: # make sure the action works on a clean machine without building test: # make sure the action works on a clean machine without building
strategy: strategy:
matrix: matrix: