From 1d32a3431491cdb7b898034af4992211470211fc Mon Sep 17 00:00:00 2001 From: Yizhou Mo Date: Thu, 29 Sep 2022 01:35:35 +0800 Subject: [PATCH] split build and test pipeline --- .github/workflows/build.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/test.yml | 29 ++++------------------------- 2 files changed, 32 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7a57e84 --- /dev/null +++ b/.github/workflows/build.yml @@ -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/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bc83ff0..21b1c0d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,34 +1,13 @@ -name: "build-test" -on: # rebuild any PRs and main branch changes +name: "test" +on: pull_request: + branches: [ "master" ] push: - branches: - - master + branches: [ "master" ] schedule: - cron: '0 0 * * *' 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 strategy: matrix: