Skip to content

Commit

Permalink
actions: run workflow on pull_request
Browse files Browse the repository at this point in the history
  • Loading branch information
missinglink committed Jun 21, 2022
1 parent 2cb45c1 commit 65c06c3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Unit Tests
on: workflow_call
jobs:
unit-tests:
runs-on: '${{ matrix.os }}'
strategy:
matrix:
os:
- ubuntu-20.04
node-version:
- 12.x
- 14.x
- 16.x
steps:
- uses: actions/checkout@v2
- name: 'Install node.js ${{ matrix.node-version }}'
uses: actions/setup-node@v2-beta
with:
node-version: '${{ matrix.node-version }}'
- name: Run unit tests
run: |
npm install
npm run ci
6 changes: 6 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: Continuous Integration
on: pull_request
jobs:
unit-tests:
if: github.event.repository.name != 'pelias'
uses: ./.github/workflows/_test.yml
22 changes: 2 additions & 20 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,10 @@ name: Continuous Integration
on: push
jobs:
unit-tests:
runs-on: '${{ matrix.os }}'
strategy:
matrix:
os:
- ubuntu-20.04
node-version:
- 12.x
- 14.x
- 16.x
steps:
- uses: actions/checkout@v2
- name: 'Install node.js ${{ matrix.node-version }}'
uses: actions/setup-node@v2-beta
with:
node-version: '${{ matrix.node-version }}'
- name: Run unit tests
run: |
npm install
npm run ci
uses: ./.github/workflows/_test.yml
npm-publish:
needs: unit-tests
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
if: github.ref == 'refs/heads/master' && needs.unit-tests.result == 'success'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
Expand Down

0 comments on commit 65c06c3

Please sign in to comment.