Skip to content

Commit

Permalink
chore: address review comments
Browse files Browse the repository at this point in the history
Way back a long time ago in jfmengels#186 (comment), @jfmengels asked me to write some comments.

I also updated the workflows to align with recent changes to our test workflow in jfmengels#288.
  • Loading branch information
lishaduck committed Nov 10, 2024
1 parent 0fc215e commit 8e0d5c6
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 51 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Git checkout
# Pin actions their full commit hashes to prevent supply-chain attacks.
# To update, find the latest tag on the releases page,
# then copy the full SHA and paste it back here (and update the comment).
# Alternatively, setup Dependabot for the `github-actions` ecosystem.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive
Expand Down
84 changes: 67 additions & 17 deletions new-package/github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on: [push, pull_request]
# Controls when the action will run.
on:
# Run on pushes to the default branch.
push:
branches:
- main

# Run on all PRs.
pull_request:
types:
- opened
- synchronize
- reopened

# Support merge queues.
merge_group:

# Allow running this workflow manually from the Actions tab.
workflow_dispatch:

defaults:
run:
shell: bash

permissions:
contents: read
Expand All @@ -16,29 +36,44 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Git checkout
# Pin actions their full commit hashes to prevent supply-chain attacks.
# To update, find the latest tag on the releases page,
# then copy the full SHA and paste it back here (and update the comment).
# Alternatively, setup Dependabot for the `github-actions` ecosystem.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive
clean: true
persist-credentials: false
set-safe-directory: true

- name: Setup Node.js environment
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: lts/*
cache: 'npm'

# Re-use node_modules between runs until package-lock.json changes.
- name: Cache node_modules
id: internal-cache-node_modules
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
id: cache-node_modules
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: node_modules
key: internal-node_modules-ubuntu-latest.x-${{ hashFiles('package-lock.json') }}
key: node_modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
node_modules-${{ runner.os }}-
# Re-use ~/.elm between runs until elm.json, elm-tooling.json or
# review/elm.json changes. The Elm compiler saves downloaded Elm packages
# to ~/.elm, and elm-tooling saves downloaded tool executables there.
- name: Cache ~/.elm
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ~/.elm
key: elm-${{ hashFiles('elm.json', 'elm-tooling.json', 'review/elm.json') }}
key: elm-${{ runner.os }}-${{ hashFiles('**/elm.json', 'elm-tooling.json') }}
restore-keys: |
elm-${{ runner.os }}-
- name: Install npm dependencies
if: steps.cache-node_modules.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -76,29 +111,44 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Git checkout
# Pin actions their full commit hashes to prevent supply-chain attacks.
# To update, find the latest tag on the releases page,
# then copy the full SHA and paste it back here (and update the comment).
# Alternatively, setup Dependabot for the `github-actions` ecosystem.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive
clean: true
persist-credentials: false
set-safe-directory: true

- name: Setup Node.js environment
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: lts/*
cache: 'npm'

# Re-use node_modules between runs until package-lock.json changes.
- name: Cache node_modules
id: internal-cache-node_modules
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
id: cache-node_modules
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: node_modules
key: internal-node_modules-ubuntu-latest.x-${{ hashFiles('package-lock.json') }}
key: node_modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
node_modules-${{ runner.os }}-
# Re-use ~/.elm between runs until elm.json, elm-tooling.json or
# review/elm.json changes. The Elm compiler saves downloaded Elm packages
# to ~/.elm, and elm-tooling saves downloaded tool executables there.
- name: Cache ~/.elm
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ~/.elm
key: elm-${{ hashFiles('elm.json', 'elm-tooling.json', 'review/elm.json') }}
key: elm-${{ runner.os }}-${{ hashFiles('**/elm.json', 'elm-tooling.json') }}
restore-keys: |
elm-${{ runner.os }}-
- name: Install npm dependencies
if: steps.cache-node_modules.outputs.cache-hit != 'true'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on: [push, pull_request]
# Controls when the action will run.
on:
# Run on pushes to the default branch.
push:
branches:
- main

# Run on all PRs.
pull_request:
types:
- opened
- synchronize
- reopened

# Support merge queues.
merge_group:

# Allow running this workflow manually from the Actions tab.
workflow_dispatch:

defaults:
run:
shell: bash

permissions:
contents: read
Expand All @@ -16,29 +36,44 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Git checkout
# Pin actions their full commit hashes to prevent supply-chain attacks.
# To update, find the latest tag on the releases page,
# then copy the full SHA and paste it back here (and update the comment).
# Alternatively, setup Dependabot for the `github-actions` ecosystem.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive
clean: true
persist-credentials: false
set-safe-directory: true

- name: Setup Node.js environment
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: lts/*
cache: 'npm'

# Re-use node_modules between runs until package-lock.json changes.
- name: Cache node_modules
id: internal-cache-node_modules
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
id: cache-node_modules
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: node_modules
key: internal-node_modules-ubuntu-latest.x-${{ hashFiles('package-lock.json') }}
key: node_modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
node_modules-${{ runner.os }}-
# Re-use ~/.elm between runs until elm.json, elm-tooling.json or
# review/elm.json changes. The Elm compiler saves downloaded Elm packages
# to ~/.elm, and elm-tooling saves downloaded tool executables there.
- name: Cache ~/.elm
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ~/.elm
key: elm-${{ hashFiles('elm.json', 'elm-tooling.json', 'review/elm.json') }}
key: elm-${{ runner.os }}-${{ hashFiles('**/elm.json', 'elm-tooling.json') }}
restore-keys: |
elm-${{ runner.os }}-
- name: Install npm dependencies
if: steps.cache-node_modules.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -76,29 +111,44 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Git checkout
# Pin actions their full commit hashes to prevent supply-chain attacks.
# To update, find the latest tag on the releases page,
# then copy the full SHA and paste it back here (and update the comment).
# Alternatively, setup Dependabot for the `github-actions` ecosystem.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive
clean: true
persist-credentials: false
set-safe-directory: true

- name: Setup Node.js environment
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: lts/*
cache: 'npm'

# Re-use node_modules between runs until package-lock.json changes.
- name: Cache node_modules
id: internal-cache-node_modules
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
id: cache-node_modules
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: node_modules
key: internal-node_modules-ubuntu-latest.x-${{ hashFiles('package-lock.json') }}
key: node_modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
node_modules-${{ runner.os }}-
# Re-use ~/.elm between runs until elm.json, elm-tooling.json or
# review/elm.json changes. The Elm compiler saves downloaded Elm packages
# to ~/.elm, and elm-tooling saves downloaded tool executables there.
- name: Cache ~/.elm
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ~/.elm
key: elm-${{ hashFiles('elm.json', 'elm-tooling.json', 'review/elm.json') }}
key: elm-${{ runner.os }}-${{ hashFiles('**/elm.json', 'elm-tooling.json') }}
restore-keys: |
elm-${{ runner.os }}-
- name: Install npm dependencies
if: steps.cache-node_modules.outputs.cache-hit != 'true'
Expand Down
Loading

0 comments on commit 8e0d5c6

Please sign in to comment.