From 8308497a680a3b6a8407d67816cea2d28e38afbe Mon Sep 17 00:00:00 2001 From: Shazron Abdullah Date: Thu, 1 Jul 2021 23:49:36 +0800 Subject: [PATCH] add release branch ci (#423) * fix: break out npm test script into lint and unit-tests npm scripts * fix: add release-branch CI for release branch unit tests and linting --- .github/workflows/release-branch.yml | 30 ++++++++++++++++++++++++++++ package.json | 4 ++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release-branch.yml diff --git a/.github/workflows/release-branch.yml b/.github/workflows/release-branch.yml new file mode 100644 index 00000000..a0baecd3 --- /dev/null +++ b/.github/workflows/release-branch.yml @@ -0,0 +1,30 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# this is meant for pull-requests who have a base branch as a release branch (prefix release-) and will run the unit-tests npm script + +name: Release Branch CI + +on: + pull_request: + branches: [ 'release-*' ] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + node-version: [12.x, 14.x] + os: [ubuntu-latest, windows-latest] + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm i --package-lock --package-lock-only + - run: npm ci + - run: npm run build --if-present + - run: npm run unit-tests + - run: npm run lint \ No newline at end of file diff --git a/package.json b/package.json index b7a125f6..bb9144f3 100644 --- a/package.json +++ b/package.json @@ -86,9 +86,9 @@ "scripts": { "postpack": "rm -f oclif.manifest.json", "lint": "eslint src test", - "posttest": "npm run lint", "prepack": "oclif-dev manifest && oclif-dev readme", - "test": "jest -c ./jest.config.js", + "test": "npm run unit-tests && npm run lint", + "unit-tests": "jest -c ./jest.config.js", "version": "oclif-dev readme && git add README.md" } }