Skip to content

Commit

Permalink
run test workflow before publish
Browse files Browse the repository at this point in the history
  • Loading branch information
gurza committed Sep 29, 2023
1 parent df05264 commit 35ddf5c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 15 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/npm-publish-github-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ on:
- master

jobs:
test:
uses: ./.github/workflows/test-base.yml
with:
DATABASE_NAME: ${{ vars.DATABASE_NAME }}
secrets:
authorized_key: inherit

publish-gpr:
runs-on: ubuntu-latest
permissions:
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/test-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: test-base

on:
workflow_call:
inputs:
DATABASE_NAME:
required: true
type: string
secrets:
AUTHORIZED_KEY:
required: true

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- run: npm ci
- name: Add authorized key
run: echo '${{ secrets.authorized_key }}' > tests/authorized_key.json
- name: Run tests
env:
DATABASE_NAME: ${{ inputs.DATABASE_NAME }}
NODE_ENV: development
run: npm test
19 changes: 4 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,7 @@ on: [pull_request]

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- run: npm ci
- name: Add authorized key
run: echo '${{ secrets.AUTHORIZED_KEY }}' > tests/authorized_key.json
- name: Run tests
env:
DATABASE_NAME: ${{ vars.DATABASE_NAME }}
NODE_ENV: development
run: npm test
uses: ./.github/workflows/test-base.yml
with:
DATABASE_NAME: ${{ vars.DATABASE_NAME }}
secrets: inherit

0 comments on commit 35ddf5c

Please sign in to comment.