Skip to content

Commit

Permalink
Better names for CI jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
trxcllnt committed May 21, 2024
1 parent 05f78c7 commit 5a7cc9f
Showing 1 changed file with 37 additions and 31 deletions.
68 changes: 37 additions & 31 deletions .github/workflows/main.pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ jobs:
lint-pull-request:
name: Lint
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
node: [20.x]
steps:
- name: Setup node v${{ matrix.node }}
- name: Setup node v20.x
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
node-version: 20.x

- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Construct cache keys
run: |
echo node_modules_key='["${{ runner.os }}", "node_modules", "20.x", "${{ hashFiles('package.json', 'yarn.lock') }}"]' >> $GITHUB_ENV;
- name: Cache node_modules
uses: actions/cache@v4
with:
key: ${{ runner.os }}-node_modules-${{ matrix.node }}-${{ hashFiles('package.json', 'yarn.lock') }}
key: ${{ join(fromJSON(env.node_modules_key), '-') }}
path: node_modules

- name: Check if source or test files changed
Expand All @@ -51,14 +51,14 @@ jobs:
build-and-test-pull-request:
needs:
- lint-pull-request
name: Test
name: Test ${{ matrix.node }} ${{ join(fromJSON('["${{ matrix.target }}", "${{ matrix.module }}"]'), '/') }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
node: [16.x, 18.x, 20.x]
module: [cjs, esm, umd]
target: [es5, es2015, esnext]
module: [cjs, esm, umd]
include:
- {node: 16.x, target: ix}
- {node: 18.x, target: ix}
Expand All @@ -69,21 +69,27 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Construct cache keys
run: |
echo node_modules_key='["${{ runner.os }}", "node_modules", "${{ matrix.node }}", "${{ hashFiles('package.json', 'yarn.lock') }}"]' >> $GITHUB_ENV;
echo targets_key='["${{ runner.os }}", "targets", "${{ matrix.node }}", "${{ matrix.target }}", "${{ matrix.module }}", "${{ hashFiles('package.json', 'yarn.lock', 'tsconfig.json', 'src/**/*', 'tsconfigs/**/*') }}"]' >> $GITHUB_ENV;
- name: Cache targets
uses: actions/cache@v4
with:
key: ${{ runner.os }}-targets-${{ matrix.node }}-${{ matrix.target }}-${{ matrix.module }}-${{ hashFiles('package.json', 'yarn.lock', 'src/**/*') }}
key: ${{ join(fromJSON(env.targets_key), '-') }}
path: targets

- name: Cache node_modules
uses: actions/cache@v4
with:
key: ${{ runner.os }}-node_modules-${{ matrix.node }}-${{ hashFiles('package.json', 'yarn.lock') }}
key: ${{ join(fromJSON(env.node_modules_key), '-') }}
path: node_modules

- name: Check if test files changed
Expand All @@ -92,6 +98,10 @@ jobs:
with:
files: |
spec/**/*
tsconfig.json
tsconfigs/**/*
jest.config.js
jestconfigs/**/*
- name: Check if source files changed
id: source_files_changed
Expand All @@ -101,7 +111,10 @@ jobs:
.npmrc
yarn.lock
package.json
tsconfig.json
src/**/*
gulp/**/*
tsconfigs/**/*
integration/**/*
- name: Install dependencies
Expand Down Expand Up @@ -158,18 +171,18 @@ jobs:
test-tree-shaking-pull-request:
needs:
- build-and-test-pull-request
name: Integration
name: Bundle ${{ matrix.bundler }} ${{ matrix.target }} ${{ matrix.module }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
module: [cjs, esm, umd]
target: [es5, es2015, esnext]
bundler: [esbuild, rollup, webpack]
target: [es5, es2015, esnext]
module: [cjs, esm, umd]
include:
- {target: ix, bundler: esbuild}
- {target: ix, bundler: rollup}
- {target: ix, bundler: webpack}
- {bundler: esbuild, target: ix}
- {bundler: rollup, target: ix}
- {bundler: webpack, target: ix}
steps:
- name: Setup node v20.x
uses: actions/setup-node@v4
Expand All @@ -180,31 +193,24 @@ jobs:
with:
persist-credentials: false

- name: Construct cache keys
run: |
echo node_modules_key='["${{ runner.os }}", "node_modules", "20.x", "${{ hashFiles('package.json', 'yarn.lock') }}"]' >> $GITHUB_ENV;
echo targets_key='["${{ runner.os }}", "targets", "20.x", "${{ matrix.target }}", "${{ matrix.module }}", "${{ hashFiles('package.json', 'yarn.lock', 'tsconfig.json', 'src/**/*', 'tsconfigs/**/*') }}"]' >> $GITHUB_ENV;
- name: Cache targets
uses: actions/cache@v4
with:
key: ${{ runner.os }}-targets-20.x-ix--${{ hashFiles('package.json', 'yarn.lock', 'src/**/*') }}
key: ${{ join(fromJSON(env.targets_key), '-') }}
path: targets

- name: Cache node_modules
uses: actions/cache@v4
with:
key: ${{ runner.os }}-node_modules-20.x-${{ hashFiles('package.json', 'yarn.lock') }}
key: ${{ join(fromJSON(env.node_modules_key), '-') }}
path: node_modules

- name: Check if source files changed
id: source_files_changed
uses: tj-actions/changed-files@v44
with:
files: |
.npmrc
yarn.lock
package.json
src/**/*
integration/**/*
- name: Test ${{ matrix.bundler }} tree-shaking
if: ${{ steps.source_files_changed.outputs.any_modified == 'true' }}
env:
t: "${{ matrix.target }}"
m: "${{ matrix.module }}"
Expand Down

0 comments on commit 5a7cc9f

Please sign in to comment.