Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(workflows): create 'test.yml' reusable workflow #13

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,31 @@
name: Test

on:
workflow_call:
inputs:
node_versions:
oscard0m marked this conversation as resolved.
Show resolved Hide resolved
required: true
type: string

jobs:
test_matrix:
runs-on: ubuntu-latest
strategy:
matrix:
node_version: ${{ fromJson(inputs.node_versions) }}
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
- name: "Test with Node.js ${{ matrix.node_version }}"
uses: actions/setup-node@5b949b50c3461bbcd5a540b150c368278160234a # tag=v3
with:
node-version: "${{ matrix.node_version }}"
cache: npm
- run: npm ci
- run: npm run test --ignore-scripts # run lint only once
test:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of renaming this job to be more indicative?

Suggested change
test:
lint:

This comment was marked as outdated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not just linting, we also test things that are independent of node versions, e.g. type tests

Copy link

@timrogers timrogers Jul 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting! Does the lint npm script do all of those things? (I made this suggestion because the only substantive command in the steps is to run the lint script.)

runs-on: ubuntu-latest
needs: test_matrix
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
- run: npm ci
- run: npm run lint --if-present