From 66c76cda89fce1a1d309eae39d93219ed190bf75 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Fri, 15 Jul 2022 12:16:17 +0200 Subject: [PATCH 1/2] feat(workflows): feat(workflows): create 'test.yml' reusable workflow --- .github/workflows/test.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7f8906f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: Test + +on: + workflow_call: + inputs: + node_versions: + required: true + type: string + +jobs: + test_matrix: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: + - 14 + - 16 + - 18 + 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: + runs-on: ubuntu-latest + needs: test_matrix + steps: + - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 + - run: npm ci + - run: npm run lint --if-present From a7abe2180f4bda9234fab051a4f08b506b21d1c3 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Sun, 16 Jul 2023 12:27:33 +0200 Subject: [PATCH 2/2] feat(test.yml): use fromJSON to read node_versions input in tet_matrix --- .github/workflows/test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7f8906f..d26eb13 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,10 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node_version: - - 14 - - 16 - - 18 + node_version: ${{ fromJson(inputs.node_versions) }} steps: - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - name: "Test with Node.js ${{ matrix.node_version }}"