Skip to content

Commit

Permalink
ci: pin actions by hash and use corepack (#21356)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Jun 5, 2023
1 parent af9ee31 commit 9deeab9
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 93 deletions.
110 changes: 50 additions & 60 deletions .github/workflows/test.yml
Expand Up @@ -20,33 +20,23 @@ jobs:
node: [16]

steps:
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: checkout
uses: actions/checkout@v3
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 0 # All history
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}
cache: "yarn"

- name: fetch tags
run: git fetch --depth=1 origin "+refs/tags/*:refs/tags/*"

- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v3
with:
path: |
node_modules
packages/*/node_modules
distributions/*/node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}

- name: install
run: yarn --check-files --frozen-lockfile --non-interactive

- name: cache workspace
uses: actions/cache@v3
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
Expand All @@ -64,15 +54,15 @@ jobs:
node: [16]

steps:
- uses: actions/setup-node@v3
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}

- name: checkout
uses: actions/checkout@master
cache: "yarn"

- name: restore workspace cache
uses: actions/cache@v3
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
Expand All @@ -97,15 +87,15 @@ jobs:
node: [16]

steps:
- uses: actions/setup-node@v3
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}

- name: checkout
uses: actions/checkout@master
cache: "yarn"

- name: restore workspace cache
uses: actions/cache@v3
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
Expand All @@ -128,15 +118,15 @@ jobs:
node: [16]

steps:
- uses: actions/setup-node@v3
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}

- name: checkout
uses: actions/checkout@master
cache: "yarn"

- name: restore workspace cache
uses: actions/cache@v3
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
Expand Down Expand Up @@ -168,15 +158,15 @@ jobs:
NODE_OPTIONS: "--max_old_space_size=4096"

steps:
- uses: actions/setup-node@v3
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}

- name: checkout
uses: actions/checkout@master
cache: "yarn"

- name: restore workspace cache
uses: actions/cache@v3
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
Expand All @@ -189,7 +179,7 @@ jobs:
run: yarn test:fixtures -i

- name: Save fixtures
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: fixtures-${{ matrix.os }}-node-v${{ matrix.node }}
path: test/fixtures
Expand All @@ -204,15 +194,15 @@ jobs:
node: [16]

steps:
- uses: actions/setup-node@v3
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}

- name: checkout
uses: actions/checkout@master
cache: "yarn"

- name: restore workspace cache
uses: actions/cache@v3
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
Expand All @@ -222,7 +212,7 @@ jobs:
key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }}

- name: restore fixtures
uses: actions/download-artifact@v3
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: fixtures-${{ matrix.os }}-node-v${{ matrix.node }}
path: test/fixtures
Expand All @@ -241,15 +231,15 @@ jobs:
node: [16]

steps:
- uses: actions/setup-node@v3
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}

- name: checkout
uses: actions/checkout@master
cache: "yarn"

- name: restore workspace cache
uses: actions/cache@v3
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
Expand All @@ -259,7 +249,7 @@ jobs:
key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }}

- name: restore fixtures
uses: actions/download-artifact@v3
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: fixtures-${{ matrix.os }}-node-v${{ matrix.node }}
path: test/fixtures
Expand All @@ -278,15 +268,15 @@ jobs:
node: [16]

steps:
- uses: actions/setup-node@v3
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}

- name: checkout
uses: actions/checkout@master
cache: "yarn"

- name: restore workspace cache
uses: actions/cache@v3
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
Expand All @@ -296,7 +286,7 @@ jobs:
key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }}

- name: restore fixtures
uses: actions/download-artifact@v3
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: fixtures-${{ matrix.os }}-node-v${{ matrix.node }}
path: test/fixtures
Expand All @@ -314,8 +304,7 @@ jobs:
node: [16]

steps:
- name: checkout
uses: actions/checkout@master
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
ref: "refs/heads/dev"
fetch-depth: 0 # All history
Expand All @@ -324,7 +313,7 @@ jobs:
run: git fetch --depth=1 origin "+refs/tags/*:refs/tags/*"

- name: restore workspace cache
uses: actions/cache@v3
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
Expand All @@ -333,9 +322,10 @@ jobs:
packages/*/dist
key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }}

- uses: actions/setup-node@v3
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}
cache: "yarn"
registry-url: "https://registry.npmjs.org"

- name: bump version
Expand Down
54 changes: 22 additions & 32 deletions .github/workflows/windows.yml
Expand Up @@ -19,28 +19,18 @@ jobs:
node: [16]

steps:
- uses: actions/setup-node@v3
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}

- name: checkout
uses: actions/checkout@v3

- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v3
with:
path: |
node_modules
packages/*/node_modules
distributions/*/node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}-2
cache: "yarn"

- name: install
run: yarn --check-files --frozen-lockfile --non-interactive

- name: cache workspace
uses: actions/cache@v3
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
Expand All @@ -61,15 +51,15 @@ jobs:
NODE_OPTIONS: "--max_old_space_size=4096"

steps:
- uses: actions/setup-node@v3
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}

- name: checkout
uses: actions/checkout@master
cache: "yarn"

- name: restore workspace cache
uses: actions/cache@v3
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
Expand All @@ -95,15 +85,15 @@ jobs:
NODE_OPTIONS: "--max_old_space_size=4096"

steps:
- uses: actions/setup-node@v3
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}

- name: checkout
uses: actions/checkout@master
cache: "yarn"

- name: restore workspace cache
uses: actions/cache@v3
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
Expand All @@ -116,7 +106,7 @@ jobs:
run: yarn test:fixtures

- name: Save fixtures
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: fixtures-${{ matrix.os }}-node-v${{ matrix.node }}
path: test/fixtures
Expand All @@ -134,15 +124,15 @@ jobs:
NODE_OPTIONS: "--max_old_space_size=4096"

steps:
- uses: actions/setup-node@v3
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- run: corepack enable
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: ${{ matrix.node }}

- name: checkout
uses: actions/checkout@master
cache: "yarn"

- name: restore workspace cache
uses: actions/cache@v3
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: |
node_modules
Expand All @@ -152,7 +142,7 @@ jobs:
key: ${{ matrix.os }}-node-v${{ matrix.node }}-nuxt-${{ github.sha }}

- name: restore fixtures
uses: actions/download-artifact@v3
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: fixtures-${{ matrix.os }}-node-v${{ matrix.node }}
path: test/fixtures
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -87,5 +87,6 @@
"sort-package-json": "2.4.1",
"typescript": "5.1.3",
"vue-jest": "4.0.1"
}
},
"packageManager": "yarn@1.22.19"
}

0 comments on commit 9deeab9

Please sign in to comment.