Compare commits

..
Author SHA1 Message Date
qmuntalandcopilot-swe-agent[bot] 9c6167dc60 Merge remote-tracking branch 'origin/main' into feat/split-go-caches
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-11-25 11:13:40 +00:00
Priya Gupta d8cbb8045d chore: update version from 7.0.0 to 7.1.0 (#818) 2026-11-16 20:54:41 -06:00
dependabot[bot]andHaritha 67f1e362c7 chore(deps-dev): bump prettier from 3.8.4 to 3.9.10 (#775)
Bumps [prettier](https://github.com/prettier/prettier) from 3.8.4 to 3.9.10.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.8.4...3.9.10)

---
updated-dependencies:
- dependency-name: prettier
  dependency-version: 3.9.5
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Haritha <73516759+v-HarithaVattikuti@users.noreply.github.com>
2026-11-16 20:53:58 -06:00
dependabot[bot]andHaritha f80de0ae48 chore(deps-dev): bump @typescript-eslint/eslint-plugin (#778)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 8.62.0 to 8.72.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.72.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-version: 8.64.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Haritha <73516759+v-HarithaVattikuti@users.noreply.github.com>
2026-11-16 20:49:25 -06:00
dependabot[bot] 8b677753fd chore(deps-dev): bump eslint-plugin-jest from 29.15.2 to 29.17.0 (#776)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 29.15.2 to 29.17.0.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v29.15.2...v29.17.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-jest
  dependency-version: 29.15.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-16 13:59:36 -06:00
dependabot[bot]andpriyagupta108 c59e680a3b chore(deps): bump undici from 6.28.0 to 6.29.1 (#807)
* chore(deps): bump undici from 6.28.0 to 6.29.1

Bumps [undici](https://github.com/nodejs/undici) from 6.28.0 to 6.29.1.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.28.0...v6.29.1)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 6.29.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix ci checks

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: priyagupta108 <priyagupta108@github.com>
2026-11-16 13:47:48 -06:00
dependabot[bot] 74378e4948 chore(deps-dev): bump @typescript-eslint/parser from 8.62.0 to 8.72.1 (#777)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 8.62.0 to 8.72.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.72.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-version: 8.64.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-16 13:46:12 -06:00
6cd1843289 Rebase onto main and update nock from 14.0.15 to 15.0.0 (#767)
Co-authored-by: priyagupta108 <priyagupta108@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-16 13:42:35 -06:00
qmuntalandCopilot ff769c7905 revert: remove unrelated dependency audit updates
This reverts commit aa2cac01fd. The split-cache implementation and sequential-restore simplifications are retained.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-09 12:42:05 +01:00
qmuntalandCopilot 57097ea729 refactor: simplify split-cache handling
Restore cache entries sequentially, keep saves parallel with per-entry error handling, and simplify the cache test setup.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-09 12:29:31 +01:00
qmuntalandCopilot aa2cac01fd fix: resolve CI dependency audit failures
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-09 12:14:15 +01:00
Quim MuntalandDavis Goodin 07a8784aee Apply batched suggestions from code review
Co-authored-by: Davis Goodin <dagood@users.noreply.github.com>
2026-11-09 11:57:28 +01:00
dependabot[bot] 802e89cd73 chore(deps-dev): bump handlebars from 4.7.9 to 4.7.10 (#802)
Bumps [handlebars](https://github.com/handlebars-lang/handlebars.js) from 4.7.9 to 4.7.10.
- [Release notes](https://github.com/handlebars-lang/handlebars.js/releases)
- [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/v4.7.10/release-notes.md)
- [Commits](https://github.com/handlebars-lang/handlebars.js/compare/v4.7.9...v4.7.10)

---
updated-dependencies:
- dependency-name: handlebars
  dependency-version: 4.7.10
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-05 17:01:42 -06:00
Arne Jørgensen 7d2730e317 Add support for rc and beta versions in go.mod file (#701)
* Add support for rc and beta versions in go.mod file

The regex in `parseGoVersionFile()` didn't consider rc and beta
versions. The regex has been extended.

In `findMatch()` the match is checked using `semver.satisfies()`. But
`semver.satisfies()` doesn't no about Go's non-semver rc and beta
version formats (1.16c1 instead of 1.16.0-rc.1).

We cannot use `makeSemver()` on `versionSpec` and compare the result
using `semver.satisfies()` because `versionSpec` could be, well, a
spec. Instead we first check if there is a strict match between the
candidate version and the versionSpec.

Fixes #525.

* Add support for beta versions in go.mod toolchain directive

* Support prerelease versions in the toolchain cache
2026-11-03 14:14:03 -06:00
v-mahabaleshwarsandmahabaleshwars b2a9ab24f0 Clarify description of go-bin-path output and its fallback behavior (#803)
* docs: clarify description of go-bin-path output and its fallback behavior

* fix: add newline at end of action.yml for proper formatting

* fix: remove unnecessary newline in action.yml

* fix: add missing newline at end of action.yml

---------

Co-authored-by: mahabaleshwars <147705296+mahabaleshwars@users.noreply.github.com>
2026-11-02 14:43:35 -06:00
v-jitenderpalsingh 3c1b57c66a Add support for native Go version syntax in go-version input (#804)
* Add support for native Go version syntax in go-version input

* Enhance Go-native version handling and update tests and documentation

* Update docs
2026-11-02 12:49:42 -06:00
qmuntal ad9941188f feat: split Go module and build caches
Reuse downloaded modules across Go versions, runner architectures, and
runner images on the same OS instead of duplicating them in each build
cache archive.

Restore and save each entry independently, running operations in parallel
when safe. Serialize restores for overlapping or aliased paths, preserve
the original paths for the post step, and report cache-hit only when both
entries match their primary keys.

Update the documented manual restore keys and generated action bundles.
2026-10-05 15:05:38 +02:00
Quim Muntal 90ad2b35f6 Merge pull request #794 from actions/chore/bump-actions-cache-6.3.0
chore(deps): bump @actions/cache to 6.3.0
2026-09-28 14:30:02 +02:00
qmuntal 0464ec84ca chore(deps): bump @actions/cache to 6.3.0
Pick up the Windows BSD tar temporary-file isolation fix from
actions/toolkit#2497.

Update the lockfile, license records, and generated action bundles.
2026-09-28 14:04:32 +02:00
v-mahabaleshwarsandmahabaleshwars 3bfff43db6 Preserve native Go environment names in action outputs (#793)
* preserve native Go environment names in action outputs

* implement review comment

* Add missing trailing newline to action.yml

---------

Co-authored-by: mahabaleshwars <147705296+mahabaleshwars@users.noreply.github.com>
2026-09-25 10:35:28 -05:00
v-mahabaleshwarsandmahabaleshwars e626ada899 Expose go env variables as action outputs (#791)
* feature implementation - output go env

* update action.yml

* fix action.yml

---------

Co-authored-by: mahabaleshwars <147705296+mahabaleshwars@users.noreply.github.com>
2026-09-18 10:05:51 -05:00
dependabot[bot] 468e940882 Bump js-yaml from 3.15.1 to 3.15.2 (#790)
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.15.1 to 3.15.2.
- [Changelog](https://github.com/nodeca/js-yaml/blob/3.15.2/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/3.15.1...3.15.2)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 3.15.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-16 12:34:25 -05:00
v-priya-kinthali 34829cb9ac fix: update macOS runner configuration to use macOS 15 Intel (#786) 2026-09-08 16:28:33 -05:00
Priya Gupta addc0880c9 Group verbose Go installation logs and normalize package.json line endings (#789)
* refactor: enhance logging and group setup for Go version installation

* refactor: update logging group name for Go version setup

* refactor: standardize formatting in package.json

* audit fix

* update package-lock.json
2026-09-08 14:17:06 -05:00
HarithaandCopilot fba3fb4ead fix: resolve audit/license failures (#784)
* fix: resolve brace-expansion high-severity vulnerability, refresh license cache, rebuild dist

- Regenerated package-lock.json to pick up brace-expansion@5.0.9 (fixes
  GHSA-rgw5-rvv9-x895, a DoS via unbounded intermediate arrays), which
  is already permitted by minimatch's existing ^5.0.8 semver range.
- Refreshed .licenses/npm cache to match the updated dependency tree.
- Added minimatch to the licensed.yml reviewed list: its detected
  license text doesn't cleanly match Blue Oak 1.0.0, which is already
  in the allowed list.
- Rebuilt dist/setup and dist/cache-save from source.

npm audit --audit-level=high now reports 0 vulnerabilities;
licensed status reports 0 errors; npm run pre-checkin passes locally.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: narrow audit dependency updates

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-19 10:06:05 -05:00
Haritha 5064d95ba1 Upgrade checkout refs and docs to v7 (#779)
* chore: upgrade checkout/setup-go refs to v7

* chore: commit remaining dependency, license, and dist updates
2026-07-27 15:26:25 -05:00
42 changed files with 10880 additions and 9917 deletions
+4 -4
View File
@@ -20,7 +20,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
go-version: ['1.25', '1.24'] go-version: ['1.25', '1.24']
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Microsoft build of Go ${{ matrix.go-version }} - name: Setup Microsoft build of Go ${{ matrix.go-version }}
uses: ./ uses: ./
@@ -59,7 +59,7 @@ jobs:
env: env:
GO_DOWNLOAD_BASE_URL: 'https://aka.ms/golang/release/latest' GO_DOWNLOAD_BASE_URL: 'https://aka.ms/golang/release/latest'
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Microsoft build of Go via environment variable - name: Setup Microsoft build of Go via environment variable
uses: ./ uses: ./
@@ -95,7 +95,7 @@ jobs:
- os: macos-latest - os: macos-latest
architecture: arm64 architecture: arm64
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Microsoft build of Go with architecture - name: Setup Microsoft build of Go with architecture
uses: ./ uses: ./
@@ -116,7 +116,7 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Microsoft build of Go with caching - name: Setup Microsoft build of Go with caching
uses: ./ uses: ./
@@ -14,7 +14,7 @@ jobs:
steps: steps:
- name: Checking out - name: Checking out
uses: actions/checkout@v6 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Publish - name: Publish
id: publish id: publish
uses: actions/publish-immutable-action@v0.0.4 uses: actions/publish-immutable-action@v0.0.4
+51 -26
View File
@@ -18,9 +18,9 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large] os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go Stable - name: Setup Go Stable
uses: ./ uses: ./
with: with:
@@ -33,9 +33,9 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large] os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go oldStable - name: Setup Go oldStable
uses: ./ uses: ./
with: with:
@@ -43,21 +43,46 @@ jobs:
- name: Verify Go - name: Verify Go
run: go version run: go version
go-env-outputs:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go
id: setup-go
uses: ./
with:
go-version: stable
- name: Show Go environment outputs
run: |
echo "GOPATH: ${{ steps.setup-go.outputs.GOPATH }}"
echo "GOBIN: ${{ steps.setup-go.outputs.GOBIN }}"
echo "go-bin-path: ${{ steps.setup-go.outputs.go-bin-path }}"
echo "GOROOT: ${{ steps.setup-go.outputs.GOROOT }}"
echo "GOCACHE: ${{ steps.setup-go.outputs.GOCACHE }}"
echo "GOMODCACHE: ${{ steps.setup-go.outputs.GOMODCACHE }}"
echo "GOOS: ${{ steps.setup-go.outputs.GOOS }}"
echo "GOARCH: ${{ steps.setup-go.outputs.GOARCH }}"
echo "GOTOOLDIR: ${{ steps.setup-go.outputs.GOTOOLDIR }}"
aliases-arch: aliases-arch:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large] os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
version: [stable, oldstable] version: [stable, oldstable]
architecture: [x64, x32] architecture: [x64, x32]
exclude: exclude:
- os: macos-latest - os: macos-latest
architecture: x32 architecture: x32
- os: macos-latest-large - os: macos-15-intel
architecture: x32 architecture: x32
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go ${{ matrix.version }} ${{ matrix.architecture }} - name: Setup Go ${{ matrix.version }} ${{ matrix.architecture }}
uses: ./ uses: ./
with: with:
@@ -72,7 +97,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-latest, windows-latest, ubuntu-latest, macos-latest-large] os: [macos-latest, windows-latest, ubuntu-latest, macos-15-intel]
go: [1.21.13, 1.22.8, 1.23.2] go: [1.21.13, 1.22.8, 1.23.2]
include: include:
- os: windows-latest - os: windows-latest
@@ -82,7 +107,7 @@ jobs:
go: 1.23.2 go: 1.23.2
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: setup-go ${{ matrix.go }} - name: setup-go ${{ matrix.go }}
uses: ./ uses: ./
@@ -98,10 +123,10 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large] os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
go-version: ['1.20', '1.21', '1.22', '1.23'] go-version: ['1.20', '1.21', '1.22', '1.23']
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go and check latest - name: Setup Go and check latest
uses: ./ uses: ./
with: with:
@@ -115,9 +140,9 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large] os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go and check latest - name: Setup Go and check latest
uses: ./ uses: ./
with: with:
@@ -131,9 +156,9 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large] os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go and check latest - name: Setup Go and check latest
uses: ./ uses: ./
with: with:
@@ -147,9 +172,9 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large] os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go and check latest - name: Setup Go and check latest
uses: ./ uses: ./
with: with:
@@ -163,9 +188,9 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large] os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go from .go-version file - name: Setup Go from .go-version file
uses: ./ uses: ./
with: with:
@@ -179,11 +204,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-latest, windows-latest, ubuntu-latest, macos-latest-large] os: [macos-latest, windows-latest, ubuntu-latest, macos-15-intel]
go: [1.20.14, 1.21.10, 1.22.8, 1.23.2] go: [1.20.14, 1.21.10, 1.22.8, 1.23.2]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: setup-go ${{ matrix.go }} - name: setup-go ${{ matrix.go }}
uses: ./ uses: ./
@@ -199,11 +224,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [windows-latest, ubuntu-latest, macos-latest-large] os: [windows-latest, ubuntu-latest, macos-15-intel]
go: [1.11.12] go: [1.11.12]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: setup-go ${{ matrix.go }} - name: setup-go ${{ matrix.go }}
uses: ./ uses: ./
@@ -219,7 +244,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large] os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
go-version: [1.20.14, 1.21, 1.22, 1.23] go-version: [1.20.14, 1.21, 1.22, 1.23]
include: include:
- os: macos-latest - os: macos-latest
@@ -228,10 +253,10 @@ jobs:
architecture: x64 architecture: x64
- os: windows-latest - os: windows-latest
architecture: x64 architecture: x64
- os: macos-latest-large - os: macos-15-intel
architecture: x64 architecture: x64
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Go and check latest - name: Setup Go and check latest
uses: ./ uses: ./
with: with:
+3 -3
View File
@@ -19,7 +19,7 @@ jobs:
cache: [false, true] cache: [false, true]
go: [1.20.1] go: [1.20.1]
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: 'Setup ${{ matrix.cache }}, cache: ${{ matrix.go }}' - name: 'Setup ${{ matrix.cache }}, cache: ${{ matrix.go }}'
uses: ./ uses: ./
@@ -88,7 +88,7 @@ jobs:
matrix: matrix:
cache: [false, true] cache: [false, true]
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: 'Setup default go, cache: ${{ matrix.cache }}' - name: 'Setup default go, cache: ${{ matrix.cache }}'
uses: ./ uses: ./
@@ -121,7 +121,7 @@ jobs:
cache: [false] cache: [false]
go: [1.20.1] go: [1.20.1]
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: 'Setup ${{ matrix.go }}, cache: ${{ matrix.cache }}' - name: 'Setup ${{ matrix.go }}, cache: ${{ matrix.cache }}'
uses: ./ uses: ./
+1 -1
View File
@@ -1,6 +1,6 @@
--- ---
name: "@actions/cache" name: "@actions/cache"
version: 6.2.0 version: 6.3.0
type: npm type: npm
summary: Actions cache lib summary: Actions cache lib
homepage: https://github.com/actions/toolkit/tree/main/packages/cache homepage: https://github.com/actions/toolkit/tree/main/packages/cache
-20
View File
@@ -1,20 +0,0 @@
---
name: "@actions/glob"
version: 0.6.1
type: npm
summary: Actions glob lib
homepage: https://github.com/actions/toolkit/tree/main/packages/glob
license: mit
licenses:
- sources: LICENSE.md
text: |-
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []
+1 -1
View File
@@ -1,6 +1,6 @@
--- ---
name: "@azure/core-rest-pipeline" name: "@azure/core-rest-pipeline"
version: 1.24.0 version: 1.23.0
type: npm type: npm
summary: Isomorphic client library for making HTTP requests in node.js and browser. summary: Isomorphic client library for making HTTP requests in node.js and browser.
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-rest-pipeline/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-rest-pipeline/README.md
+1 -1
View File
@@ -1,6 +1,6 @@
--- ---
name: "@azure/storage-blob" name: "@azure/storage-blob"
version: 12.32.0 version: 12.31.0
type: npm type: npm
summary: Microsoft Azure Storage SDK for JavaScript - Blob summary: Microsoft Azure Storage SDK for JavaScript - Blob
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob/README.md
+1 -1
View File
@@ -1,6 +1,6 @@
--- ---
name: "@nodable/entities" name: "@nodable/entities"
version: 2.2.0 version: 3.0.0
type: npm type: npm
summary: Entity parser for XML, HTML, External entites with security and NCR control summary: Entity parser for XML, HTML, External entites with security and NCR control
homepage: homepage:
-55
View File
@@ -1,55 +0,0 @@
---
name: balanced-match
version: 1.0.2
type: npm
summary: Match balanced character pairs, like "{" and "}"
homepage: https://github.com/juliangruber/balanced-match
license: mit
licenses:
- sources: LICENSE.md
text: |
(MIT)
Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- sources: README.md
text: |-
(MIT)
Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
notices: []
-55
View File
@@ -1,55 +0,0 @@
---
name: brace-expansion
version: 1.1.15
type: npm
summary: Brace expansion as known from sh/bash
homepage: https://github.com/juliangruber/brace-expansion
license: mit
licenses:
- sources: LICENSE
text: |
MIT License
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- sources: README.md
text: |-
(MIT)
Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
notices: []
@@ -1,6 +1,6 @@
--- ---
name: brace-expansion name: brace-expansion
version: 5.0.6 version: 5.0.9
type: npm type: npm
summary: Brace expansion as known from sh/bash summary: Brace expansion as known from sh/bash
homepage: homepage:
-31
View File
@@ -1,31 +0,0 @@
---
name: concat-map
version: 0.0.1
type: npm
summary: concatenative mapdashery
homepage: https://github.com/substack/node-concat-map#readme
license: other
licenses:
- sources: LICENSE
text: |
This software is released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- sources: README.markdown
text: MIT
notices: []
+1 -1
View File
@@ -1,6 +1,6 @@
--- ---
name: fast-xml-parser name: fast-xml-parser
version: 5.9.3 version: 5.10.1
type: npm type: npm
summary: Validate XML, Parse XML, Build XML without C/C++ based libraries summary: Validate XML, Parse XML, Build XML without C/C++ based libraries
homepage: homepage:
+1 -1
View File
@@ -1,6 +1,6 @@
--- ---
name: is-unsafe name: is-unsafe
version: 1.0.1 version: 2.0.0
type: npm type: npm
summary: Zero-dependency, DOM-free, pure predicate for detecting unsafe strings across summary: Zero-dependency, DOM-free, pure predicate for detecting unsafe strings across
HTML, XML, SVG, SQL, SHELL, and REGEX contexts HTML, XML, SVG, SQL, SHELL, and REGEX contexts
-26
View File
@@ -1,26 +0,0 @@
---
name: minimatch
version: 3.1.5
type: npm
summary: a glob matcher in javascript
homepage:
license: isc
licenses:
- sources: LICENSE
text: |
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
notices: []
+1 -1
View File
@@ -1,6 +1,6 @@
--- ---
name: path-expression-matcher name: path-expression-matcher
version: 1.6.0 version: 1.6.2
type: npm type: npm
summary: Efficient path tracking and pattern matching for XML/JSON parsers summary: Efficient path tracking and pattern matching for XML/JSON parsers
homepage: https://github.com/NaturalIntelligence/path-expression-matcher#readme homepage: https://github.com/NaturalIntelligence/path-expression-matcher#readme
+1 -1
View File
@@ -1,6 +1,6 @@
--- ---
name: undici name: undici
version: 6.27.0 version: 6.29.1
type: npm type: npm
summary: An HTTP/1.1 client, written from scratch for Node.js summary: An HTTP/1.1 client, written from scratch for Node.js
homepage: https://undici.nodejs.org homepage: https://undici.nodejs.org
+35
View File
@@ -0,0 +1,35 @@
---
name: xml-naming
version: 0.3.0
type: npm
summary: Validates XML name productions — Name, NCName, QName, NMToken, NMTokens —
for XML 1.0 and 1.1
homepage:
license: mit
licenses:
- sources: LICENSE
text: |
MIT License
Copyright (c) 2026 Natural Intelligence
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- sources: README.md
text: MIT
notices: []
+6 -3
View File
@@ -35,7 +35,7 @@ See [action.yml](action.yml).
<!-- start usage --> <!-- start usage -->
```yaml ```yaml
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
# Version or version range of Go to use # Version or version range of Go to use
go-version: '1.23' go-version: '1.23'
@@ -70,8 +70,8 @@ See [action.yml](action.yml).
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: '1.25' # The Go version to download (if necessary) and use. go-version: '1.25' # The Go version to download (if necessary) and use.
- run: go run hello.go - run: go run hello.go
@@ -94,6 +94,7 @@ the [check-latest input](docs/advanced-usage.md#check-latest-version).
The `go-version` input supports the following syntax: The `go-version` input supports the following syntax:
- Specific versions: `1.25`, `1.24.11`, `1.24.0-rc.1`, `1.23.0-beta.1` - Specific versions: `1.25`, `1.24.11`, `1.24.0-rc.1`, `1.23.0-beta.1`
- Native Go versions: `go1.21`, `go1.21.5`, `go1.18beta2`, `go1.21rc2`. `go1.21` resolves to exactly `1.21.0`, unlike `1.21`, which matches patch releases.
- SemVer version range syntax: `^1.25.1`, `~1.24.1`, `>=1.25.0-rc.1`, `<1.25.0`, `>=1.22.0 <1.24.0` - SemVer version range syntax: `^1.25.1`, `~1.24.1`, `>=1.25.0-rc.1`, `<1.25.0`, `>=1.22.0 <1.24.0`
- Aliases: `stable`, `oldstable` - Aliases: `stable`, `oldstable`
- Wildcards: `1.25.x`, `1.x` - Wildcards: `1.25.x`, `1.x`
@@ -127,6 +128,8 @@ The `cache` input is optional, and caching is enabled by default. To disable cac
By default, the action looks for `go.mod` in the repository root and uses its hash as part of the cache key. Use the `cache-dependency-path` input when you have multiple dependency files, or when they’re located in different subdirectories. This input supports glob patterns. By default, the action looks for `go.mod` in the repository root and uses its hash as part of the cache key. Use the `cache-dependency-path` input when you have multiple dependency files, or when they’re located in different subdirectories. This input supports glob patterns.
Module sources (`GOMODCACHE`) and build outputs (`GOCACHE`) are cached separately. On the same runner OS, module sources can be reused across Go versions and runner architectures, while build outputs remain partitioned by Go version, runner architecture, and Linux runner image. The `cache-hit` output is `true` only when both cache entries are restored on their primary keys.
If caching cannot be performed for any reason, the action logs a warning and continues workflow execution. If caching cannot be performed for any reason, the action logs a warning and continues workflow execution.
For examples of using `cache-dependency-path`, see the [Caching](docs/advanced-usage.md#caching) section of the [Advanced usage](docs/advanced-usage.md) guide. For examples of using `cache-dependency-path`, see the [Caching](docs/advanced-usage.md#caching) section of the [Advanced usage](docs/advanced-usage.md) guide.
+280 -60
View File
@@ -1,3 +1,5 @@
/// <reference types="node" />
import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals'; import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals';
import fs from 'fs'; import fs from 'fs';
@@ -50,91 +52,309 @@ const core = await import('@actions/core');
const glob = await import('@actions/glob'); const glob = await import('@actions/glob');
const cacheRestore = await import('../src/cache-restore.js'); const cacheRestore = await import('../src/cache-restore.js');
const cacheUtils = await import('../src/cache-utils.js'); const cacheUtils = await import('../src/cache-utils.js');
import type {PackageManagerInfo} from '../src/package-managers.js'; const {run: saveCaches} = await import('../src/cache-save.js');
import type {CacheDirectory} from '../src/cache-utils.js';
function deferred() {
let resolve!: () => void;
const promise = new Promise<void>(done => {
resolve = done;
});
return {promise, resolve};
}
describe('restoreCache', () => { describe('restoreCache', () => {
let hashFilesSpy: jest.Mock<typeof glob.hashFiles>; const hashFilesSpy = glob.hashFiles as jest.Mock<typeof glob.hashFiles>;
let getCacheDirectoryPathSpy: jest.Mock< const getCacheDirectoryPathSpy =
typeof cacheUtils.getCacheDirectoryPath cacheUtils.getCacheDirectoryPath as jest.Mock<
typeof cacheUtils.getCacheDirectoryPath
>;
const restoreCacheSpy = cache.restoreCache as jest.Mock<
typeof cache.restoreCache
>; >;
let restoreCacheSpy: jest.Mock<typeof cache.restoreCache>; const saveCacheSpy = cache.saveCache as jest.Mock<typeof cache.saveCache>;
let infoSpy: jest.Mock<typeof core.info>; const infoSpy = core.info as jest.Mock<typeof core.info>;
let setOutputSpy: jest.Mock<typeof core.setOutput>; const setOutputSpy = core.setOutput as jest.Mock<typeof core.setOutput>;
const versionSpec = '1.13.1'; const versionSpec = '1.13.1';
const packageManager = 'default'; const packageManager = 'default';
const cacheDependencyPath = 'path'; const cacheDependencyPath = 'path';
const modulePath = 'module_cache_directory';
let originalWorkspace: string | undefined; const buildPath = 'build_cache_directory';
const directories: CacheDirectory[] = [
{kind: 'modules', path: modulePath},
{kind: 'build', path: buildPath}
];
const originalEnv = {...process.env};
const originalArch = Object.getOwnPropertyDescriptor(process, 'arch')!;
beforeEach(() => { beforeEach(() => {
originalWorkspace = process.env.GITHUB_WORKSPACE; jest.resetAllMocks();
process.env.GITHUB_WORKSPACE = '/test/workspace'; process.env = {
//Arrange ...originalEnv,
hashFilesSpy = glob.hashFiles as jest.Mock<typeof glob.hashFiles>; GITHUB_WORKSPACE: '/test/workspace',
getCacheDirectoryPathSpy = cacheUtils.getCacheDirectoryPath as jest.Mock< RUNNER_OS: 'Linux',
typeof cacheUtils.getCacheDirectoryPath ImageOS: 'ubuntu24'
>; };
restoreCacheSpy = cache.restoreCache as jest.Mock< Object.defineProperty(process, 'arch', {value: 'x64'});
typeof cache.restoreCache hashFilesSpy.mockResolvedValue('file_hash');
>; getCacheDirectoryPathSpy.mockResolvedValue(directories);
infoSpy = core.info as jest.Mock<typeof core.info>; restoreCacheSpy.mockResolvedValue(undefined);
setOutputSpy = core.setOutput as jest.Mock<typeof core.setOutput>; saveCacheSpy.mockResolvedValue(1);
getCacheDirectoryPathSpy.mockImplementation(
(PackageManager: PackageManagerInfo) => {
return Promise.resolve([
'cache_directory_path',
'cache_directory_path'
]);
}
);
}); });
afterEach(() => { afterEach(() => {
process.env.GITHUB_WORKSPACE = originalWorkspace; process.env = {...originalEnv};
Object.defineProperty(process, 'arch', originalArch);
jest.restoreAllMocks(); jest.restoreAllMocks();
}); });
const restore = (version = versionSpec) =>
cacheRestore.restoreCache(version, packageManager, cacheDependencyPath);
const requestedKeys = () => {
const moduleCall = restoreCacheSpy.mock.calls.find(
([paths]) => paths[0] === modulePath
);
const buildCall = restoreCacheSpy.mock.calls.find(
([paths]) => paths[0] === buildPath
);
expect(moduleCall).toBeDefined();
expect(buildCall).toBeDefined();
return {modules: moduleCall![1], build: buildCall![1]};
};
it('should throw if dependency file path is not valid', async () => { it('should throw if dependency file path is not valid', async () => {
// Arrange hashFilesSpy.mockResolvedValue('');
hashFilesSpy.mockImplementation(() => Promise.resolve(''));
// Act + Assert await expect(restore()).rejects.toThrow(
await expect(
cacheRestore.restoreCache(
versionSpec,
packageManager,
cacheDependencyPath
)
).rejects.toThrow(
'Some specified paths were not resolved, unable to cache dependencies.' 'Some specified paths were not resolved, unable to cache dependencies.'
); );
expect(restoreCacheSpy).not.toHaveBeenCalled();
expect(setOutputSpy).toHaveBeenLastCalledWith('cache-hit', false);
}); });
it('should inform if cache hit is not occurred', async () => { it('restores modules and build outputs as separate cache entries', async () => {
// Arrange await restore();
hashFilesSpy.mockImplementation(() => Promise.resolve('file_hash'));
restoreCacheSpy.mockImplementation(() => Promise.resolve('')); const keys = requestedKeys();
// Act + Assert expect(keys.modules).not.toBe(keys.build);
expect(restoreCacheSpy).toHaveBeenCalledTimes(2);
expect(restoreCacheSpy).toHaveBeenCalledWith([modulePath], keys.modules);
expect(restoreCacheSpy).toHaveBeenCalledWith([buildPath], keys.build);
expect(infoSpy).toHaveBeenCalledWith('modules cache is not found');
expect(infoSpy).toHaveBeenCalledWith('build cache is not found');
});
it.each([false, true])(
'restores entries sequentially and waits for both (first fails=%s)',
async firstFails => {
const started = [deferred(), deferred()];
const release = [deferred(), deferred()];
let completed = false;
restoreCacheSpy.mockImplementation(async (paths, key) => {
const index = paths[0] === modulePath ? 0 : 1;
started[index].resolve();
await release[index].promise;
if (index === 0 && firstFails) {
throw new Error('Module cache unavailable');
}
return key;
});
const pending = restore().then(() => {
completed = true;
});
try {
await started[0].promise;
expect(restoreCacheSpy).toHaveBeenCalledTimes(1);
expect(core.saveState).not.toHaveBeenCalled();
expect(setOutputSpy).not.toHaveBeenCalledWith('cache-hit', true);
release[0].resolve();
await started[1].promise;
expect(restoreCacheSpy).toHaveBeenCalledTimes(2);
expect(completed).toBe(false);
expect(core.saveState).not.toHaveBeenCalled();
expect(setOutputSpy).not.toHaveBeenCalledWith('cache-hit', true);
} finally {
release.forEach(signal => signal.resolve());
await pending;
}
expect(setOutputSpy).toHaveBeenLastCalledWith('cache-hit', !firstFails);
expect(core.saveState).toHaveBeenCalledTimes(1);
}
);
it.each([
{modules: false, build: false},
{modules: true, build: false},
{modules: false, build: true},
{modules: true, build: true}
])(
'reports hits and saves misses independently (modules=$modules, build=$build)',
async hits => {
const state = new Map<string, string>();
(core.saveState as jest.Mock<typeof core.saveState>).mockImplementation(
(name, value) => {
state.set(name, JSON.stringify(value));
}
);
(core.getState as jest.Mock<typeof core.getState>).mockImplementation(
name => state.get(name) || ''
);
(
core.getBooleanInput as jest.Mock<typeof core.getBooleanInput>
).mockReturnValue(true);
jest.spyOn(fs, 'existsSync').mockReturnValue(true);
restoreCacheSpy.mockImplementation(async (paths, key) =>
hits[paths[0] === modulePath ? 'modules' : 'build'] ? key : undefined
);
await restore();
const keys = requestedKeys();
expect(setOutputSpy).toHaveBeenLastCalledWith(
'cache-hit',
hits.modules && hits.build
);
// Changing the Go environment later must not change the saved paths.
process.env.GOMODCACHE = 'different_module_cache';
process.env.GOCACHE = 'different_build_cache';
await saveCaches();
for (const {kind, path} of directories) {
if (hits[kind]) {
expect(saveCacheSpy).not.toHaveBeenCalledWith([path], keys[kind]);
} else {
expect(saveCacheSpy).toHaveBeenCalledWith([path], keys[kind]);
}
}
expect(saveCacheSpy).toHaveBeenCalledTimes(
Number(!hits.modules) + Number(!hits.build)
);
}
);
it('does not report a full hit for a non-primary cache match', async () => {
restoreCacheSpy.mockImplementation(async (_paths, key) => `${key}-other`);
await restore();
expect(setOutputSpy).toHaveBeenLastCalledWith('cache-hit', false);
});
it.each(directories)(
'continues restoring when the $kind cache fails',
async ({kind, path}) => {
restoreCacheSpy.mockImplementation(async (paths, key) => {
if (paths[0] === path) {
throw new Error('Unable to reach the service');
}
return key;
});
await restore();
expect(restoreCacheSpy).toHaveBeenCalledTimes(2);
expect(core.warning).toHaveBeenCalledWith(
`Restore ${kind} cache failed: Unable to reach the service`
);
expect(setOutputSpy).toHaveBeenLastCalledWith('cache-hit', false);
}
);
it.each(directories)(
'restores only $kind when the other directory cannot be resolved',
async directory => {
getCacheDirectoryPathSpy.mockResolvedValue([directory]);
restoreCacheSpy.mockImplementation(async (_paths, key) => key);
await restore();
expect(restoreCacheSpy).toHaveBeenCalledTimes(1);
expect(restoreCacheSpy).toHaveBeenCalledWith(
[directory.path],
expect.any(String)
);
expect(setOutputSpy).toHaveBeenLastCalledWith('cache-hit', false);
}
);
it('reuses modules across Go versions without reusing build outputs', async () => {
await restore();
const before = requestedKeys();
restoreCacheSpy.mockClear();
await restore('1.26.1');
const after = requestedKeys();
expect(after.modules).toBe(before.modules);
expect(after.build).not.toBe(before.build);
});
it.each([
{
name: 'runner architecture',
change: () => Object.defineProperty(process, 'arch', {value: 'arm64'})
},
{
name: 'runner image',
change: () => {
process.env.ImageOS = 'ubuntu26';
}
}
])('reuses only modules when the $name changes', async ({change}) => {
await restore();
const before = requestedKeys();
restoreCacheSpy.mockClear();
change();
await restore();
const after = requestedKeys();
expect(after.modules).toBe(before.modules);
expect(after.build).not.toBe(before.build);
});
it('keeps both cache entries isolated by runner OS', async () => {
await restore();
const before = requestedKeys();
restoreCacheSpy.mockClear();
process.env.RUNNER_OS = 'Windows';
await restore();
const after = requestedKeys();
expect(after.modules).not.toBe(before.modules);
expect(after.build).not.toBe(before.build);
});
it('invalidates both cache entries when the dependency hash changes', async () => {
await restore();
const before = requestedKeys();
restoreCacheSpy.mockClear();
hashFilesSpy.mockResolvedValue('different_file_hash');
await restore();
const after = requestedKeys();
expect(after.modules).not.toBe(before.modules);
expect(after.build).not.toBe(before.build);
});
it('hashes the configured dependency paths for both cache entries', async () => {
const dependencyPaths = 'go.sum\ntools/go.sum';
await cacheRestore.restoreCache( await cacheRestore.restoreCache(
versionSpec, versionSpec,
packageManager, packageManager,
cacheDependencyPath dependencyPaths
); );
expect(infoSpy).toHaveBeenCalledWith('Cache is not found');
});
it('should set output if cache hit is occurred', async () => { expect(hashFilesSpy).toHaveBeenCalledWith(dependencyPaths);
// Arrange expect(restoreCacheSpy).toHaveBeenCalledTimes(2);
hashFilesSpy.mockImplementation(() => Promise.resolve('file_hash'));
restoreCacheSpy.mockImplementation(() => Promise.resolve('cache_key'));
// Act + Assert
await cacheRestore.restoreCache(
versionSpec,
packageManager,
cacheDependencyPath
);
expect(setOutputSpy).toHaveBeenCalledWith('cache-hit', true);
}); });
it('should throw if dependency file is not found in workspace', async () => { it('should throw if dependency file is not found in workspace', async () => {
+198 -105
View File
@@ -1,3 +1,5 @@
/// <reference types="node" />
import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals'; import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals';
jest.unstable_mockModule('@actions/cache', () => ({ jest.unstable_mockModule('@actions/cache', () => ({
@@ -22,87 +24,55 @@ const realFs = (await import('fs')).default;
const fsExports = {...realFs, existsSync: jest.fn()}; const fsExports = {...realFs, existsSync: jest.fn()};
jest.unstable_mockModule('fs', () => ({...fsExports, default: fsExports})); jest.unstable_mockModule('fs', () => ({...fsExports, default: fsExports}));
// Import real cache-utils (with mocked @actions) before mocking it
const realCacheUtils = await import('../src/cache-utils.js');
jest.unstable_mockModule('../src/cache-utils.js', () => ({
...realCacheUtils,
getCacheDirectoryPath: jest.fn()
}));
const cache = await import('@actions/cache'); const cache = await import('@actions/cache');
const core = await import('@actions/core'); const core = await import('@actions/core');
const fs = (await import('fs')).default; const fs = (await import('fs')).default;
const cacheUtils = await import('../src/cache-utils.js');
const {run} = await import('../src/cache-save.js'); const {run} = await import('../src/cache-save.js');
const {State} = await import('../src/constants.js'); import type {CacheEntry} from '../src/cache-utils.js';
function deferred() {
let resolve!: () => void;
const promise = new Promise<void>(done => {
resolve = done;
});
return {promise, resolve};
}
describe('cache-save', () => { describe('cache-save', () => {
const primaryKey = 'primary-key'; let entries: CacheEntry[];
let primaryKeyValue: string; const getBooleanInputSpy = jest.mocked(core.getBooleanInput);
let matchedKeyValue: string; const getStateSpy = jest.mocked(core.getState);
const infoSpy = jest.mocked(core.info);
let getBooleanInputSpy: jest.Mock<typeof core.getBooleanInput>; const warningSpy = jest.mocked(core.warning);
let getStateSpy: jest.Mock<typeof core.getState>; const debugSpy = jest.mocked(core.debug);
let infoSpy: jest.Mock<typeof core.info>; const setFailedSpy = jest.mocked(core.setFailed);
let warningSpy: jest.Mock<typeof core.warning>; const saveCacheSpy = jest.mocked(cache.saveCache);
let debugSpy: jest.Mock<typeof core.debug>; const existsSpy = jest.mocked(fs.existsSync);
let setFailedSpy: jest.Mock<typeof core.setFailed>;
let saveCacheSpy: jest.Mock<typeof cache.saveCache>;
let getCacheDirectoryPathSpy: jest.Mock<
typeof cacheUtils.getCacheDirectoryPath
>;
let existsSpy: jest.Mock<typeof fs.existsSync>;
beforeEach(() => { beforeEach(() => {
primaryKeyValue = primaryKey; jest.resetAllMocks();
matchedKeyValue = 'matched-key'; entries = [
{
kind: 'modules',
path: 'module_cache_directory',
primaryKey: 'modules-primary-key'
},
{
kind: 'build',
path: 'build_cache_directory',
primaryKey: 'build-primary-key'
}
];
getBooleanInputSpy = core.getBooleanInput as jest.Mock<
typeof core.getBooleanInput
>;
getBooleanInputSpy.mockReturnValue(true); getBooleanInputSpy.mockReturnValue(true);
getStateSpy.mockImplementation(() => JSON.stringify(entries));
getStateSpy = core.getState as jest.Mock<typeof core.getState>; saveCacheSpy.mockResolvedValue(0);
getStateSpy.mockImplementation((key: string) => { existsSpy.mockReturnValue(true);
if (key === State.CachePrimaryKey) {
return primaryKeyValue;
}
if (key === State.CacheMatchedKey) {
return matchedKeyValue;
}
return '';
});
infoSpy = core.info as jest.Mock<typeof core.info>;
infoSpy.mockImplementation(() => undefined);
warningSpy = core.warning as jest.Mock<typeof core.warning>;
warningSpy.mockImplementation(() => undefined);
debugSpy = core.debug as jest.Mock<typeof core.debug>;
debugSpy.mockImplementation(() => undefined);
setFailedSpy = core.setFailed as jest.Mock<typeof core.setFailed>;
setFailedSpy.mockImplementation(() => undefined);
saveCacheSpy = cache.saveCache as jest.Mock<typeof cache.saveCache>;
saveCacheSpy.mockImplementation(() => Promise.resolve(0));
getCacheDirectoryPathSpy = cacheUtils.getCacheDirectoryPath as jest.Mock<
typeof cacheUtils.getCacheDirectoryPath
>;
getCacheDirectoryPathSpy.mockImplementation(() =>
Promise.resolve(['cache_directory_path', 'cache_directory_path'])
);
existsSpy = fs.existsSync as jest.Mock<typeof fs.existsSync>;
existsSpy.mockImplementation(() => true);
}); });
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.restoreAllMocks();
}); });
it('does not save cache when the cache input is false', async () => { it('does not save cache when the cache input is false', async () => {
@@ -115,78 +85,201 @@ describe('cache-save', () => {
expect(setFailedSpy).not.toHaveBeenCalled(); expect(setFailedSpy).not.toHaveBeenCalled();
}); });
it.each([false, true])(
'starts both saves concurrently and waits before exiting (first fails=%s)',
async firstFails => {
const started = [deferred(), deferred()];
const release = [deferred(), deferred()];
const exitSpy = jest.spyOn(process, 'exit').mockImplementation(() => {
return undefined as never;
});
saveCacheSpy.mockImplementation(async paths => {
const index = paths[0] === entries[0].path ? 0 : 1;
started[index].resolve();
await release[index].promise;
if (index === 0 && firstFails) {
throw new Error('Module cache unavailable');
}
return 1;
});
const pending = run(true);
try {
await Promise.all(started.map(signal => signal.promise));
release[0].resolve();
// Let the first completion propagate while the second stays blocked.
await new Promise<void>(resolve => setImmediate(resolve));
expect(exitSpy).not.toHaveBeenCalled();
} finally {
release.forEach(signal => signal.resolve());
await pending;
}
expect(exitSpy).toHaveBeenCalledTimes(1);
expect(exitSpy).toHaveBeenCalledWith(0);
expect(infoSpy).toHaveBeenCalledWith(
`Cache saved with the key: ${entries[1].primaryKey}`
);
expect(setFailedSpy).not.toHaveBeenCalled();
}
);
it('does not save cache when there are no cache folders on the disk', async () => { it('does not save cache when there are no cache folders on the disk', async () => {
existsSpy.mockImplementation(() => false); existsSpy.mockReturnValue(false);
await run(); await run();
expect(warningSpy).toHaveBeenCalledWith( for (const {kind, path} of entries) {
'There are no cache folders on the disk' expect(infoSpy).toHaveBeenCalledWith(
`[warning]${kind} cache folder doesn't exist on disk: ${path}`
);
}
expect(saveCacheSpy).not.toHaveBeenCalled();
expect(setFailedSpy).not.toHaveBeenCalled();
});
it.each(['modules', 'build'])(
'saves the other cache when the %s directory is missing',
async kind => {
const missing = entries.find(entry => entry.kind === kind)!;
const existing = entries.find(entry => entry.kind !== kind)!;
existsSpy.mockImplementation(path => path !== missing.path);
await run();
expect(saveCacheSpy).toHaveBeenCalledTimes(1);
expect(saveCacheSpy).toHaveBeenCalledWith(
[existing.path],
existing.primaryKey
);
expect(setFailedSpy).not.toHaveBeenCalled();
}
);
it('does not save cache when no cache entries were prepared', async () => {
getStateSpy.mockReturnValue('');
await run();
expect(infoSpy).toHaveBeenCalledWith(
'Cache keys were not generated. Please check the log messages above for more errors or information'
); );
expect(saveCacheSpy).not.toHaveBeenCalled(); expect(saveCacheSpy).not.toHaveBeenCalled();
expect(setFailedSpy).not.toHaveBeenCalled(); expect(setFailedSpy).not.toHaveBeenCalled();
}); });
it('does not save cache when the primary key was not generated', async () => { it('does not fail the workflow if the saved state is invalid', async () => {
primaryKeyValue = ''; getStateSpy.mockReturnValue('{');
await run(); await run();
expect(infoSpy).toHaveBeenCalledWith( expect(warningSpy).toHaveBeenCalledWith(expect.any(String));
'Primary key was not generated. Please check the log messages above for more errors or information'
);
expect(saveCacheSpy).not.toHaveBeenCalled(); expect(saveCacheSpy).not.toHaveBeenCalled();
expect(setFailedSpy).not.toHaveBeenCalled(); expect(setFailedSpy).not.toHaveBeenCalled();
}); });
it('does not save cache when a cache hit occurred on the primary key', async () => { it('does not save either cache when both primary keys were hit', async () => {
matchedKeyValue = primaryKey; for (const entry of entries) {
entry.matchedKey = entry.primaryKey;
}
await run(); await run();
expect(infoSpy).toHaveBeenCalledWith(
`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`
);
expect(saveCacheSpy).not.toHaveBeenCalled(); expect(saveCacheSpy).not.toHaveBeenCalled();
expect(setFailedSpy).not.toHaveBeenCalled();
});
it('saves cache when the primary key differs from the matched key', async () => {
await run();
expect(saveCacheSpy).toHaveBeenCalled();
expect(infoSpy).toHaveBeenCalledWith(
`Cache saved with the key: ${primaryKey}`
);
expect(warningSpy).not.toHaveBeenCalled(); expect(warningSpy).not.toHaveBeenCalled();
expect(setFailedSpy).not.toHaveBeenCalled(); expect(setFailedSpy).not.toHaveBeenCalled();
}); });
it('save with -1 cacheId , should not fail workflow', async () => { it.each(['modules', 'build'])(
saveCacheSpy.mockImplementation(() => Promise.resolve(-1)); 'skips only the %s cache when its primary key was hit',
async kind => {
const hit = entries.find(entry => entry.kind === kind)!;
const miss = entries.find(entry => entry.kind !== kind)!;
hit.matchedKey = hit.primaryKey;
await run();
expect(saveCacheSpy).toHaveBeenCalledTimes(1);
expect(saveCacheSpy).toHaveBeenCalledWith([miss.path], miss.primaryKey);
expect(warningSpy).not.toHaveBeenCalled();
expect(setFailedSpy).not.toHaveBeenCalled();
}
);
it('saves both cache directories under separate keys on a cold run', async () => {
await run(); await run();
expect(saveCacheSpy).toHaveBeenCalled(); expect(saveCacheSpy).toHaveBeenCalledTimes(2);
expect(debugSpy).toHaveBeenCalledWith( for (const {path, primaryKey} of entries) {
`Cache was not saved for the key: ${primaryKey}` expect(saveCacheSpy).toHaveBeenCalledWith([path], primaryKey);
); expect(infoSpy).toHaveBeenCalledWith(
expect(infoSpy).not.toHaveBeenCalledWith( `Cache saved with the key: ${primaryKey}`
`Cache saved with the key: ${primaryKey}` );
); }
expect(warningSpy).not.toHaveBeenCalled(); expect(warningSpy).not.toHaveBeenCalled();
expect(setFailedSpy).not.toHaveBeenCalled(); expect(setFailedSpy).not.toHaveBeenCalled();
}); });
it('saves with error from toolkit, should not fail workflow', async () => { it('saves caches restored from non-primary matches', async () => {
saveCacheSpy.mockImplementation(() => for (const entry of entries) {
Promise.reject(new Error('Unable to reach the service')) entry.matchedKey = `${entry.primaryKey}-other`;
); }
await run(); await run();
expect(saveCacheSpy).toHaveBeenCalled(); expect(saveCacheSpy).toHaveBeenCalledTimes(2);
expect(warningSpy).toHaveBeenCalledWith('Unable to reach the service'); expect(warningSpy).not.toHaveBeenCalled();
expect(setFailedSpy).not.toHaveBeenCalled(); expect(setFailedSpy).not.toHaveBeenCalled();
}); });
it.each(['modules', 'build'])(
'continues saving when the %s cache reservation fails',
async kind => {
const failed = entries.find(entry => entry.kind === kind)!;
const saved = entries.find(entry => entry.kind !== kind)!;
saveCacheSpy.mockImplementation(async paths =>
paths[0] === failed.path ? -1 : 1
);
await run();
expect(saveCacheSpy).toHaveBeenCalledTimes(2);
expect(debugSpy).toHaveBeenCalledWith(
`Cache was not saved for the key: ${failed.primaryKey}`
);
expect(infoSpy).not.toHaveBeenCalledWith(
`Cache saved with the key: ${failed.primaryKey}`
);
expect(infoSpy).toHaveBeenCalledWith(
`Cache saved with the key: ${saved.primaryKey}`
);
expect(warningSpy).not.toHaveBeenCalled();
expect(setFailedSpy).not.toHaveBeenCalled();
}
);
it.each(['modules', 'build'])(
'continues saving when the %s cache upload throws',
async kind => {
const failed = entries.find(entry => entry.kind === kind)!;
const saved = entries.find(entry => entry.kind !== kind)!;
saveCacheSpy.mockImplementation(async paths => {
if (paths[0] === failed.path) {
throw new Error('Unable to reach the service');
}
return 1;
});
await run();
expect(saveCacheSpy).toHaveBeenCalledTimes(2);
expect(warningSpy).toHaveBeenCalledWith(
`Save ${kind} cache failed: Unable to reach the service`
);
expect(infoSpy).toHaveBeenCalledWith(
`Cache saved with the key: ${saved.primaryKey}`
);
expect(setFailedSpy).not.toHaveBeenCalled();
}
);
}); });
+52 -20
View File
@@ -84,7 +84,10 @@ describe('getPackageManagerInfo', () => {
const packageManagerName = 'default'; const packageManagerName = 'default';
const expectedResult = { const expectedResult = {
dependencyFilePattern: 'go.mod', dependencyFilePattern: 'go.mod',
cacheFolderCommandList: ['go env GOMODCACHE', 'go env GOCACHE'] cacheFolderCommandList: [
{kind: 'modules', command: 'go env GOMODCACHE'},
{kind: 'build', command: 'go env GOCACHE'}
]
}; };
//Act + Assert //Act + Assert
@@ -112,16 +115,29 @@ describe('getCacheDirectoryPath', () => {
const validPackageManager: PackageManagerInfo = { const validPackageManager: PackageManagerInfo = {
dependencyFilePattern: 'go.mod', dependencyFilePattern: 'go.mod',
cacheFolderCommandList: ['go env GOMODCACHE', 'go env GOCACHE'] cacheFolderCommandList: [
{kind: 'modules', command: 'go env GOMODCACHE'},
{kind: 'build', command: 'go env GOCACHE'}
]
}; };
it('should return path to the cache folders which specified package manager uses', async () => { it('should return path to the cache folders which specified package manager uses', async () => {
//Arrange //Arrange
getExecOutputSpy.mockImplementation(async (commandLine: string) => { getExecOutputSpy.mockImplementation(async (commandLine: string) => {
return {exitCode: 0, stdout: 'path/to/cache/folder', stderr: ''}; return {
exitCode: 0,
stdout:
commandLine === 'go env GOMODCACHE'
? 'path/to/modules'
: 'path/to/build',
stderr: ''
};
}); });
const expectedResult = ['path/to/cache/folder', 'path/to/cache/folder']; const expectedResult = [
{kind: 'modules', path: 'path/to/modules'},
{kind: 'build', path: 'path/to/build'}
];
//Act + Assert //Act + Assert
return cacheUtils return cacheUtils
@@ -129,27 +145,43 @@ describe('getCacheDirectoryPath', () => {
.then(data => expect(data).toEqual(expectedResult)); .then(data => expect(data).toEqual(expectedResult));
}); });
it('should return path to the cache folder if one command return empty str', async () => { it.each(validPackageManager.cacheFolderCommandList)(
//Arrange 'preserves the $kind identity when the other command returns an empty path',
getExecOutputSpy.mockImplementationOnce(async (commandLine: string) => { async ({kind, command}) => {
return {exitCode: 0, stdout: 'path/to/cache/folder', stderr: ''}; getExecOutputSpy.mockImplementation(async commandLine => ({
}); exitCode: 0,
stdout: commandLine === command ? 'path/to/cache/folder' : '',
stderr: ''
}));
getExecOutputSpy.mockImplementationOnce(async (commandLine: string) => { await expect(
return {exitCode: 0, stdout: '', stderr: ''}; cacheUtils.getCacheDirectoryPath(validPackageManager)
}); ).resolves.toEqual([{kind, path: 'path/to/cache/folder'}]);
}
);
const expectedResult = ['path/to/cache/folder']; it.each(validPackageManager.cacheFolderCommandList)(
'preserves the $kind identity when the other command fails',
async ({kind, command}) => {
getExecOutputSpy.mockImplementation(async commandLine => {
if (commandLine !== command) {
throw new Error('Could not run go env');
}
return {exitCode: 0, stdout: 'path/to/cache/folder', stderr: ''};
});
//Act + Assert await expect(
return cacheUtils cacheUtils.getCacheDirectoryPath(validPackageManager)
.getCacheDirectoryPath(validPackageManager) ).resolves.toEqual([{kind, path: 'path/to/cache/folder'}]);
.then(data => expect(data).toEqual(expectedResult)); expect(core.info).toHaveBeenCalledWith(
}); expect.stringContaining('Could not run go env')
);
}
);
it('should throw if the both commands return empty str', async () => { it('should throw if the both commands return empty str', async () => {
getExecOutputSpy.mockImplementation(async (commandLine: string) => { getExecOutputSpy.mockImplementation(async (commandLine: string) => {
return {exitCode: 10, stdout: '', stderr: ''}; return {exitCode: 0, stdout: '', stderr: ''};
}); });
//Act + Assert //Act + Assert
@@ -158,7 +190,7 @@ describe('getCacheDirectoryPath', () => {
}).rejects.toThrow(); }).rejects.toThrow();
}); });
it('should throw if the specified package name is invalid', async () => { it('should throw if both commands fail', async () => {
getExecOutputSpy.mockImplementation(async (commandLine: string) => { getExecOutputSpy.mockImplementation(async (commandLine: string) => {
return {exitCode: 10, stdout: '', stderr: 'Error message'}; return {exitCode: 10, stdout: '', stderr: 'Error message'};
}); });
+177
View File
@@ -1,4 +1,181 @@
[ [
{
"version": "go1.18beta2",
"stable": false,
"files": [
{
"filename": "go1.18beta2.src.tar.gz",
"os": "",
"arch": "",
"version": "go1.18beta2",
"sha256": "3cb14e2c82da366f7393c988f1f3fc2c16b71a5492bd3d49d35886cdf27a9d13",
"size": 22816245,
"kind": "source"
},
{
"filename": "go1.18beta2.darwin-amd64.tar.gz",
"os": "darwin",
"arch": "amd64",
"version": "go1.18beta2",
"sha256": "83fa94b3101d1a00dc5685645e4b49809a5dad18ce19ab449392806a85c05125",
"size": 143466224,
"kind": "archive"
},
{
"filename": "go1.18beta2.darwin-amd64.pkg",
"os": "darwin",
"arch": "amd64",
"version": "go1.18beta2",
"sha256": "fcab5fbe2b9a78bd677c008914df4ee1079178e1c96592b85fa0bd04e2e8e099",
"size": 143951639,
"kind": "installer"
},
{
"filename": "go1.18beta2.darwin-arm64.tar.gz",
"os": "darwin",
"arch": "arm64",
"version": "go1.18beta2",
"sha256": "b442585cbd50759bd11d7a9971e02ec3b2e8cfc1ff1094fa23afadc9e3889689",
"size": 137682754,
"kind": "archive"
},
{
"filename": "go1.18beta2.darwin-arm64.pkg",
"os": "darwin",
"arch": "arm64",
"version": "go1.18beta2",
"sha256": "61425e05dfffce91066bf3625d945baa377c13c659b4ca6fded39bcb391ef2c7",
"size": 138172943,
"kind": "installer"
},
{
"filename": "go1.18beta2.freebsd-386.tar.gz",
"os": "freebsd",
"arch": "386",
"version": "go1.18beta2",
"sha256": "f45899dcc440c9943b3af11a2856959e1ffd9fb11d0dbdbe6398615a96715751",
"size": 112424968,
"kind": "archive"
},
{
"filename": "go1.18beta2.freebsd-amd64.tar.gz",
"os": "freebsd",
"arch": "amd64",
"version": "go1.18beta2",
"sha256": "f5688d21a0e02991445b7992f01fc5fda459c84a1812b3b08c2ada4a98e74b5e",
"size": 141351456,
"kind": "archive"
},
{
"filename": "go1.18beta2.linux-386.tar.gz",
"os": "linux",
"arch": "386",
"version": "go1.18beta2",
"sha256": "74ac524d7d17df606cc74059bf30efce35bb6930f950110dd79cc58ba057f186",
"size": 112609338,
"kind": "archive"
},
{
"filename": "go1.18beta2.linux-amd64.tar.gz",
"os": "linux",
"arch": "amd64",
"version": "go1.18beta2",
"sha256": "b5dacafa59737cfb0d657902b70c2ad1b6bb4ed15e85ea2806f72ce3d4824688",
"size": 141429704,
"kind": "archive"
},
{
"filename": "go1.18beta2.linux-arm64.tar.gz",
"os": "linux",
"arch": "arm64",
"version": "go1.18beta2",
"sha256": "21e4248594401568c2e8704b9d26c6185a61f46b4f17e1a628bf1b5d9a010503",
"size": 108461508,
"kind": "archive"
},
{
"filename": "go1.18beta2.linux-armv6l.tar.gz",
"os": "linux",
"arch": "armv6l",
"version": "go1.18beta2",
"sha256": "bc958a63b51c44762ec026ab587b0261e94cf6337613bfbbcfbd0414fb95f7b6",
"size": 109806288,
"kind": "archive"
},
{
"filename": "go1.18beta2.linux-ppc64le.tar.gz",
"os": "linux",
"arch": "ppc64le",
"version": "go1.18beta2",
"sha256": "573916974201745360883102c80482e1d6730683d1a4a6bb4b469978d4f99d30",
"size": 108654946,
"kind": "archive"
},
{
"filename": "go1.18beta2.linux-s390x.tar.gz",
"os": "linux",
"arch": "s390x",
"version": "go1.18beta2",
"sha256": "860ee3e5cd68fd36d3d49654adc37b9450584d07f0745f7f461080d9cc7749e1",
"size": 111316368,
"kind": "archive"
},
{
"filename": "go1.18beta2.windows-386.zip",
"os": "windows",
"arch": "386",
"version": "go1.18beta2",
"sha256": "666b808f6835f928aa9d8ffa065304af61540b579b4d0eb5c55b7f2a7ec9fff2",
"size": 128931729,
"kind": "archive"
},
{
"filename": "go1.18beta2.windows-386.msi",
"os": "windows",
"arch": "386",
"version": "go1.18beta2",
"sha256": "b3ea5bb064c87e47871488cd15bc99ebd0919529acc97a684e44ef683e459acb",
"size": 113459200,
"kind": "installer"
},
{
"filename": "go1.18beta2.windows-amd64.zip",
"os": "windows",
"arch": "amd64",
"version": "go1.18beta2",
"sha256": "e2a3e0ee984205be36d59f333a7e327ab14517b7c3a11d9b8651e02895ced69a",
"size": 157785083,
"kind": "archive"
},
{
"filename": "go1.18beta2.windows-amd64.msi",
"os": "windows",
"arch": "amd64",
"version": "go1.18beta2",
"sha256": "36df8cad76eff69033b748cf71343c8d3f73b72067d57be52ec4996eb05539e4",
"size": 138551296,
"kind": "installer"
},
{
"filename": "go1.18beta2.windows-arm64.zip",
"os": "windows",
"arch": "arm64",
"version": "go1.18beta2",
"sha256": "9ed027803361cab0b8c338e698e16586d83d973f01815e17d2ab2990e29b8c66",
"size": 123458965,
"kind": "archive"
},
{
"filename": "go1.18beta2.windows-arm64.msi",
"os": "windows",
"arch": "arm64",
"version": "go1.18beta2",
"sha256": "cfbe500daed74dd26e556619a9f0e0b3d20f8a4cf31b48618c4285f47dca1f0c",
"size": 108797952,
"kind": "installer"
}
]
},
{ {
"version": "go1.13.7", "version": "go1.13.7",
"stable": true, "stable": true,
+353 -3
View File
@@ -17,6 +17,7 @@ import goTestManifest from './data/versions-manifest.json' with {type: 'json'};
import type {IGoVersion} from '../src/installer.js'; import type {IGoVersion} from '../src/installer.js';
import type {IToolRelease} from '@actions/tool-cache'; import type {IToolRelease} from '@actions/tool-cache';
import {GO_ENV_OUTPUTS} from '../src/constants.js';
const httpClientGetJson = jest.fn(); const httpClientGetJson = jest.fn();
@@ -28,6 +29,8 @@ jest.unstable_mockModule('@actions/core', () => ({
getBooleanInput: jest.fn(), getBooleanInput: jest.fn(),
info: jest.fn(), info: jest.fn(),
debug: jest.fn(), debug: jest.fn(),
warning: jest.fn(),
setOutput: jest.fn(),
exportVariable: jest.fn() exportVariable: jest.fn()
})); }));
@@ -110,6 +113,8 @@ describe('setup-go', () => {
let findSpy: jest.Mock; let findSpy: jest.Mock;
let cnSpy: jest.SpiedFunction<typeof process.stdout.write>; let cnSpy: jest.SpiedFunction<typeof process.stdout.write>;
let logSpy: jest.Mock; let logSpy: jest.Mock;
let setOutputSpy: jest.Mock<typeof core.setOutput>;
let warningSpy: jest.Mock<typeof core.warning>;
let getSpy: jest.Mock; let getSpy: jest.Mock;
let platSpy: jest.Mock; let platSpy: jest.Mock;
let archSpy: jest.Mock; let archSpy: jest.Mock;
@@ -198,6 +203,8 @@ describe('setup-go', () => {
// writes // writes
cnSpy = jest.spyOn(process.stdout, 'write'); cnSpy = jest.spyOn(process.stdout, 'write');
logSpy = core.info as jest.Mock; logSpy = core.info as jest.Mock;
setOutputSpy = core.setOutput as jest.Mock<typeof core.setOutput>;
warningSpy = core.warning as jest.Mock<typeof core.warning>;
dbgSpy = core.debug as jest.Mock; dbgSpy = core.debug as jest.Mock;
getSpy.mockImplementation(() => goJsonData as IGoVersion[] | null); getSpy.mockImplementation(() => goJsonData as IGoVersion[] | null);
cnSpy.mockImplementation(() => true); cnSpy.mockImplementation(() => true);
@@ -336,11 +343,11 @@ describe('setup-go', () => {
expect(fileName).toBe('go1.13.7.windows-386.zip'); expect(fileName).toBe('go1.13.7.windows-386.zip');
}); });
it('finds unstable pre-release version', async () => { it('finds unstable release candidate', async () => {
os.platform = 'linux'; os.platform = 'linux';
os.arch = 'x64'; os.arch = 'x64';
// spec: 1.14, stable=false => go1.14rc1 // spec: 1.14.0-rc.1, stable=false => go1.14rc1
const match: IGoVersion | undefined = await im.findMatch('1.14.0-rc.1'); const match: IGoVersion | undefined = await im.findMatch('1.14.0-rc.1');
expect(match).toBeDefined(); expect(match).toBeDefined();
const version: string = match ? match.version : ''; const version: string = match ? match.version : '';
@@ -349,6 +356,46 @@ describe('setup-go', () => {
expect(fileName).toBe('go1.14rc1.linux-amd64.tar.gz'); expect(fileName).toBe('go1.14rc1.linux-amd64.tar.gz');
}); });
it('finds unstable beta version', async () => {
os.platform = 'linux';
os.arch = 'x64';
// spec: 1.18.0-beta.2, stable=false => go1.18beta2
const match: im.IGoVersion | undefined =
await im.findMatch('1.18.0-beta.2');
expect(match).toBeDefined();
const version: string = match ? match.version : '';
expect(version).toBe('go1.18beta2');
const fileName = match ? match.files[0].filename : '';
expect(fileName).toBe('go1.18beta2.linux-amd64.tar.gz');
});
it('finds unstable release candidate (go version format)', async () => {
os.platform = 'linux';
os.arch = 'x64';
// spec: 1.14rc1, stable=false => go1.14rc1
const match: im.IGoVersion | undefined = await im.findMatch('1.14rc1');
expect(match).toBeDefined();
const version: string = match ? match.version : '';
expect(version).toBe('go1.14rc1');
const fileName = match ? match.files[0].filename : '';
expect(fileName).toBe('go1.14rc1.linux-amd64.tar.gz');
});
it('finds unstable beta version (go version format)', async () => {
os.platform = 'linux';
os.arch = 'x64';
// spec: 1.18beta2, stable=false => go1.18beta2
const match: im.IGoVersion | undefined = await im.findMatch('1.18beta2');
expect(match).toBeDefined();
const version: string = match ? match.version : '';
expect(version).toBe('go1.18beta2');
const fileName = match ? match.files[0].filename : '';
expect(fileName).toBe('go1.18beta2.linux-amd64.tar.gz');
});
it('evaluates to stable with input as true', async () => { it('evaluates to stable with input as true', async () => {
inputs['go-version'] = '1.13.0'; inputs['go-version'] = '1.13.0';
inputs.stable = 'true'; inputs.stable = 'true';
@@ -424,6 +471,26 @@ describe('setup-go', () => {
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
}); });
it('finds a rc version of go already in the cache', async () => {
inputs['go-version'] = '1.14rc1';
const toolPath = path.normalize('/cache/go/1.14.0rc.1/x64');
findSpy.mockImplementation(() => toolPath);
await main.run();
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
});
it('finds a rc version in the cache and adds it to the path', async () => {
inputs['go-version'] = '1.14rc1';
const toolPath = path.normalize('/cache/go/1.14.0.rc.1/x64');
findSpy.mockImplementation(() => toolPath);
await main.run();
const expPath = path.join(toolPath, 'bin');
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
});
it('handles unhandled error and reports error', async () => { it('handles unhandled error and reports error', async () => {
const errMsg = 'unhandled error message'; const errMsg = 'unhandled error message';
inputs['go-version'] = '1.13.0'; inputs['go-version'] = '1.13.0';
@@ -480,6 +547,51 @@ describe('setup-go', () => {
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
}); });
it('downloads a rc version not in the cache', async () => {
os.platform = 'linux';
os.arch = 'x64';
inputs['go-version'] = '1.14rc1';
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(() => '/some/temp/path');
const toolPath = path.normalize('/cache/go/1.14.0-rc.1/x64');
extractTarSpy.mockImplementation(() => '/some/other/temp/path');
cacheSpy.mockImplementation(() => toolPath);
await main.run();
const expPath = path.join(toolPath, 'bin');
expect(dlSpy).toHaveBeenCalled();
expect(extractTarSpy).toHaveBeenCalled();
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
});
it('downloads a rc version not in the cache (windows)', async () => {
os.platform = 'win32';
os.arch = 'x64';
inputs['go-version'] = '1.14rc1';
process.env['RUNNER_TEMP'] = 'C:\\temp\\';
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(() => 'C:\\temp\\some\\path');
extractZipSpy.mockImplementation(() => 'C:\\temp\\some\\other\\path');
const toolPath = path.normalize('C:\\cache\\go\\1.21.0-rc.2\\x64');
cacheSpy.mockImplementation(() => toolPath);
await main.run();
const expPath = path.win32.join(toolPath, 'bin');
expect(dlSpy).toHaveBeenCalledWith(
'https://go.dev/dl/go1.14rc1.windows-amd64.zip',
'C:\\temp\\go1.14rc1.windows-amd64.zip',
undefined
);
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
});
it('does not find a version that does not exist', async () => { it('does not find a version that does not exist', async () => {
os.platform = 'linux'; os.platform = 'linux';
os.arch = 'x64'; os.arch = 'x64';
@@ -646,6 +758,106 @@ describe('setup-go', () => {
expect(added).toBeTruthy(); expect(added).toBeTruthy();
}); });
describe('go env outputs', () => {
const goEnv = {
GOPATH: '/Users/testuser/go',
GOBIN: '',
GOROOT: '/usr/local/go',
GOCACHE: '/Users/testuser/.cache/go-build',
GOMODCACHE: '/Users/testuser/go/pkg/mod',
GOOS: 'darwin',
GOARCH: 'arm64',
GOTOOLDIR: '/usr/local/go/pkg/tool/darwin_arm64'
};
it('parses the output of go env -json', () => {
execFileSpy.mockImplementation(() => JSON.stringify(goEnv));
expect(main.readGoEnv('/usr/local/go/bin/go')).toEqual(goEnv);
});
it('returns undefined when go env -json is not supported', () => {
execFileSpy.mockImplementation(() => {
throw new Error('flag provided but not defined: -json');
});
expect(main.readGoEnv('/usr/local/go/bin/go')).toBeUndefined();
expect(logSpy).toHaveBeenCalledWith(
expect.stringContaining('flag provided but not defined: -json')
);
expect(warningSpy).not.toHaveBeenCalled();
});
it('returns undefined when the output is not valid JSON', () => {
execFileSpy.mockImplementation(() => 'GOPATH="/Users/testuser/go"');
expect(main.readGoEnv('/usr/local/go/bin/go')).toBeUndefined();
});
it('returns undefined when the output is not a JSON object', () => {
execFileSpy.mockImplementation(() => '[]');
expect(main.readGoEnv('/usr/local/go/bin/go')).toBeUndefined();
});
it('sets an output for each exposed variable', () => {
main.setGoEnvOutputs(goEnv);
expect(GO_ENV_OUTPUTS).toEqual([
'GOPATH',
'GOBIN',
'GOROOT',
'GOCACHE',
'GOMODCACHE',
'GOOS',
'GOARCH',
'GOTOOLDIR'
]);
for (const name of GO_ENV_OUTPUTS) {
expect(setOutputSpy).toHaveBeenCalledWith(name, goEnv[name] ?? '');
}
});
it('falls back to $GOPATH/bin when GOBIN is empty', () => {
main.setGoEnvOutputs(goEnv);
expect(setOutputSpy).toHaveBeenCalledWith(
'go-bin-path',
'/Users/testuser/go/bin'
);
});
it('prefers GOBIN over $GOPATH/bin when it is set', () => {
main.setGoEnvOutputs({...goEnv, GOBIN: '/Users/testuser/bin'});
expect(setOutputSpy).toHaveBeenCalledWith(
'go-bin-path',
'/Users/testuser/bin'
);
});
it('uses the first entry of a multi-entry GOPATH', () => {
const GOPATH = ['/Users/testuser/go', '/Users/testuser/other'].join(
path.delimiter
);
main.setGoEnvOutputs({...goEnv, GOPATH});
expect(setOutputSpy).toHaveBeenCalledWith('GOPATH', GOPATH);
expect(setOutputSpy).toHaveBeenCalledWith(
'go-bin-path',
'/Users/testuser/go/bin'
);
});
it('leaves variables missing from go env -json empty', () => {
main.setGoEnvOutputs({});
expect(setOutputSpy).toHaveBeenCalledWith('GOPATH', '');
expect(setOutputSpy).toHaveBeenCalledWith('go-bin-path', '');
});
});
interface Annotation { interface Annotation {
file: string; file: string;
line: number; line: number;
@@ -759,6 +971,11 @@ describe('setup-go', () => {
expect(im.makeSemver('1.10rc1')).toBe('1.10.0-rc.1'); expect(im.makeSemver('1.10rc1')).toBe('1.10.0-rc.1');
}); });
it('preserves already-normalized prerelease versions', () => {
expect(im.makeSemver('1.18.0-beta.2')).toBe('1.18.0-beta.2');
expect(im.makeSemver('1.21.0-rc.2')).toBe('1.21.0-rc.2');
});
it('converts dot zero versions', async () => { it('converts dot zero versions', async () => {
expect(im.makeSemver('1.13')).toBe('1.13.0'); expect(im.makeSemver('1.13')).toBe('1.13.0');
}); });
@@ -767,6 +984,102 @@ describe('setup-go', () => {
expect(im.makeSemver('1.13.1')).toBe('1.13.1'); expect(im.makeSemver('1.13.1')).toBe('1.13.1');
}); });
it('isGoNativeVersion accepts supported Go-native version formats', () => {
expect(im.isGoNativeVersion('go1.21')).toBe(true);
expect(im.isGoNativeVersion('go1.21.5')).toBe(true);
expect(im.isGoNativeVersion('go1.18beta2')).toBe(true);
expect(im.isGoNativeVersion('go1.21rc2')).toBe(true);
expect(im.isGoNativeVersion('go1.21.x')).toBe(false);
expect(im.isGoNativeVersion('go^1.21')).toBe(false);
expect(im.isGoNativeVersion('1.21')).toBe(false);
expect(im.isGoNativeVersion('go1')).toBe(false);
expect(im.isGoNativeVersion('go1.21.5beta1')).toBe(false);
expect(im.isGoNativeVersion('go1.21.0rc1')).toBe(false);
});
it('accepts a Go-native go-version input and normalizes it', async () => {
os.platform = 'linux';
os.arch = 'x64';
inputs['go-version'] = 'go1.21';
findSpy.mockImplementation(() => path.normalize('/cache/go/1.21.0/x64'));
await main.run();
expect(logSpy).toHaveBeenCalledWith('Setup go version spec go1.21');
expect(findSpy).toHaveBeenCalledWith('go', '1.21.0', 'x64');
expect(logSpy).toHaveBeenCalledWith(
'Successfully set up Go version go1.21'
);
});
it('rejects a malformed Go-native go-version input', async () => {
os.platform = 'linux';
os.arch = 'x64';
inputs['go-version'] = 'go1.21.x';
await main.run();
expect(cnSpy).toHaveBeenCalledWith(
expect.stringContaining('Invalid Go version "go1.21.x"')
);
});
it('accepts a Go-native go-version input with beta suffix and normalizes it', async () => {
os.platform = 'linux';
os.arch = 'x64';
inputs['go-version'] = 'go1.18beta2';
findSpy.mockImplementation(() =>
path.normalize('/cache/go/1.18.0-beta.2/x64')
);
await main.run();
expect(logSpy).toHaveBeenCalledWith('Setup go version spec go1.18beta2');
expect(findSpy).toHaveBeenCalledWith('go', '1.18.0-beta.2', 'x64');
expect(logSpy).toHaveBeenCalledWith(
'Successfully set up Go version go1.18beta2'
);
});
it('accepts a Go-native go-version input with rc suffix and normalizes it', async () => {
os.platform = 'linux';
os.arch = 'x64';
inputs['go-version'] = 'go1.21rc2';
findSpy.mockImplementation(() =>
path.normalize('/cache/go/1.21.0-rc.2/x64')
);
await main.run();
expect(logSpy).toHaveBeenCalledWith('Setup go version spec go1.21rc2');
expect(findSpy).toHaveBeenCalledWith('go', '1.21.0-rc.2', 'x64');
expect(logSpy).toHaveBeenCalledWith(
'Successfully set up Go version go1.21rc2'
);
});
it('downloads a normalized Go-native version on cache miss', async () => {
os.platform = 'linux';
os.arch = 'x64';
inputs['go-version'] = 'go1.13';
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path');
extractTarSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () =>
path.normalize('/cache/go/1.13.0/x64')
);
await main.run();
expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.13.0...');
expect(dlSpy).toHaveBeenCalled();
expect(logSpy).toHaveBeenCalledWith(
'Successfully set up Go version go1.13'
);
});
describe('check-latest flag', () => { describe('check-latest flag', () => {
it("use local version and don't check manifest if check-latest is not specified", async () => { it("use local version and don't check manifest if check-latest is not specified", async () => {
os.platform = 'linux'; os.platform = 'linux';
@@ -1090,7 +1403,7 @@ use .
}); });
describe('go-version-file-toolchain', () => { describe('go-version-file-toolchain', () => {
const goVersions = ['1.22.0', '1.21rc2', '1.18']; const goVersions = ['1.22.0', '1.21rc2', '1.18', '1.18beta2'];
const placeholderVersion = '1.19'; const placeholderVersion = '1.19';
const buildGoMod = ( const buildGoMod = (
goVersion: string, goVersion: string,
@@ -1190,6 +1503,43 @@ use .
}); });
describe('go-download-base-url', () => { describe('go-download-base-url', () => {
it('normalizes native versions but preserves custom download filenames', async () => {
os.platform = 'linux';
os.arch = 'x64';
const versionSpec = 'go1.21rc2';
const customBaseUrl = 'https://example.com/golang';
const toolName = im.customToolCacheName(customBaseUrl);
const toolPath = path.normalize(`/cache/${toolName}/1.21.0-rc.2/x64`);
inputs['go-version'] = versionSpec;
inputs['go-download-base-url'] = customBaseUrl;
getSpy.mockImplementationOnce(() => {
throw new Error('Not a JSON endpoint');
});
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path');
extractTarSpy.mockImplementation(async () => '/some/other/temp/path');
execFileSpy.mockImplementation(() => 'go version go1.21rc2 linux/amd64');
cacheSpy.mockImplementation(async () => toolPath);
await main.run();
expect(findSpy).toHaveBeenCalledWith(toolName, '1.21.0-rc.2', 'x64');
expect(getSpy).toHaveBeenCalledWith(
`${customBaseUrl}/?mode=json&include=all`
);
expect(dlSpy).toHaveBeenCalledWith(
`${customBaseUrl}/go1.21rc2.linux-amd64.tar.gz`,
undefined,
undefined
);
expect(cnSpy).toHaveBeenCalledWith(
`::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
);
});
it('downloads a version from custom base URL using version listing', async () => { it('downloads a version from custom base URL using version listing', async () => {
os.platform = 'linux'; os.platform = 'linux';
os.arch = 'x64'; os.arch = 'x64';
+20 -2
View File
@@ -3,7 +3,7 @@ description: 'Setup a Go environment and add it to the PATH'
author: 'GitHub' author: 'GitHub'
inputs: inputs:
go-version: go-version:
description: 'The Go version to download (if necessary) and use. Supports semver spec and ranges. Be sure to enclose this option in single quotation marks.' description: 'The Go version to download (if necessary) and use. Supports native Go versions (e.g. go1.21.5), semver specs and ranges. Be sure to enclose this option in single quotation marks.'
go-version-file: go-version-file:
description: 'Path to the go.mod, go.work, .go-version, or .tool-versions file.' description: 'Path to the go.mod, go.work, .go-version, or .tool-versions file.'
check-latest: check-latest:
@@ -25,7 +25,25 @@ outputs:
go-version: go-version:
description: 'The installed Go version. Useful when given a version range as input.' description: 'The installed Go version. Useful when given a version range as input.'
cache-hit: cache-hit:
description: 'A boolean value to indicate if a cache was hit' description: 'A boolean value indicating whether both module and build cache entries were restored on their primary keys'
GOPATH:
description: 'The value of `go env GOPATH`.'
GOBIN:
description: 'The value of `go env GOBIN`.'
go-bin-path:
description: 'The base Go binary directory: the `GOBIN` value, otherwise `bin` under the first `GOPATH` entry when `GOBIN` is empty.'
GOROOT:
description: 'The value of `go env GOROOT`.'
GOCACHE:
description: 'The value of `go env GOCACHE`, the build cache directory.'
GOMODCACHE:
description: 'The value of `go env GOMODCACHE`, the module cache directory.'
GOOS:
description: 'The value of `go env GOOS`, the target OS in Go notation (linux, darwin, windows).'
GOARCH:
description: 'The value of `go env GOARCH`, the target architecture in Go notation (amd64, arm64).'
GOTOOLDIR:
description: 'The value of `go env GOTOOLDIR`, the directory holding the toolchain binaries.'
runs: runs:
using: 'node24' using: 'node24'
main: 'dist/setup/index.js' main: 'dist/setup/index.js'
+4374 -2797
View File
File diff suppressed because it is too large Load Diff
+4583 -6228
View File
File diff suppressed because it is too large Load Diff
+119 -64
View File
@@ -12,6 +12,9 @@
- [Restore-only caches](advanced-usage.md#restore-only-caches) - [Restore-only caches](advanced-usage.md#restore-only-caches)
- [Parallel builds](advanced-usage.md#parallel-builds) - [Parallel builds](advanced-usage.md#parallel-builds)
- [Outputs](advanced-usage.md#outputs) - [Outputs](advanced-usage.md#outputs)
- [go-version](advanced-usage.md#go-version)
- [cache-hit](advanced-usage.md#cache-hit)
- [Go environment outputs](advanced-usage.md#go-environment-outputs)
- [Custom download URL](advanced-usage.md#custom-download-url) - [Custom download URL](advanced-usage.md#custom-download-url)
- [Using `setup-go` on GHES](advanced-usage.md#using-setup-go-on-ghes) - [Using `setup-go` on GHES](advanced-usage.md#using-setup-go-on-ghes)
@@ -23,8 +26,8 @@ For repeatable builds, specify the **exact major, minor, and patch version** (su
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: '1.25.5' go-version: '1.25.5'
- run: go run hello.go - run: go run hello.go
@@ -36,8 +39,8 @@ You can specify **only a major and minor version** if you are okay with the most
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: '1.25' go-version: '1.25'
- run: go run hello.go - run: go run hello.go
@@ -47,14 +50,18 @@ steps:
- The preinstalled patch version is generally the latest available. When a new patch is released, it replaces the previously preinstalled version on the runner. - The preinstalled patch version is generally the latest available. When a new patch is released, it replaces the previously preinstalled version on the runner.
- Using the most recent patch version speeds up setup because the required Go version is already installed on the runner and no download is needed. - Using the most recent patch version speeds up setup because the required Go version is already installed on the runner and no download is needed.
The `go-version` input also accepts native Go version strings: `go1.21.5`, `go1.18beta2`, and `go1.21rc2` normalize to `1.21.5`, `1.18.0-beta.2`, and `1.21.0-rc.2`, respectively. `go1.21` resolves to exactly `1.21.0`; use `1.21` for matching patch releases. For ranges and wildcards, use SemVer syntax such as `~1.21` or `1.21.x`, not `go1.21.x`.
To try a **pre-release**: To try a **pre-release**:
Download and use beta or RC Go versions as needed. Download and use beta or RC Go versions as needed.
The `go-version` input also accepts native Go version strings: `go1.21.5`, `go1.18beta2`, and `go1.21rc2` normalize to `1.21.5`, `1.18.0-beta.2`, and `1.21.0-rc.2`, respectively. `go1.21` resolves to exactly `1.21.0`; use `1.21` for matching patch releases. For ranges and wildcards, use SemVer syntax such as `~1.21` or `1.21.x`, not `go1.21.x`.
```yaml ```yaml
# RC version # RC version
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: '1.25.0-rc.2' go-version: '1.25.0-rc.2'
- run: go version - run: go version
@@ -63,8 +70,8 @@ steps:
```yaml ```yaml
# Beta version # Beta version
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: '1.19.0-beta.1' go-version: '1.19.0-beta.1'
- run: go version - run: go version
@@ -80,8 +87,8 @@ If `oldstable` is provided, the action resolves it to the latest patch release o
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: 'stable' go-version: 'stable'
- run: go run hello.go - run: go run hello.go
@@ -89,8 +96,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: 'oldstable' go-version: 'oldstable'
- run: go run hello.go - run: go run hello.go
@@ -100,8 +107,8 @@ You can also use **SemVer's version range syntax**, for instance:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: '^1.25.1' go-version: '^1.25.1'
- run: go version - run: go version
@@ -109,8 +116,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: '>=1.24.0-rc.1' go-version: '>=1.24.0-rc.1'
- run: go version - run: go version
@@ -129,9 +136,9 @@ jobs:
go: [ '1.24', '1.25' ] go: [ '1.24', '1.25' ]
name: Go ${{ matrix.go }} sample name: Go ${{ matrix.go }} sample
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- name: Setup go - name: Setup go
uses: actions/setup-go@v6 uses: actions/setup-go@v7
with: with:
go-version: ${{ matrix.go }} go-version: ${{ matrix.go }}
- run: go run hello.go - run: go run hello.go
@@ -154,9 +161,9 @@ jobs:
- os: windows-latest - os: windows-latest
go: '1.25' go: '1.25'
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- name: Setup go - name: Setup go
uses: actions/setup-go@v6 uses: actions/setup-go@v7
with: with:
go-version: ${{ matrix.go }} go-version: ${{ matrix.go }}
- run: go run hello.go - run: go run hello.go
@@ -170,8 +177,8 @@ If both the `go-version` and the `go-version-file` inputs are provided then the
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version-file: 'path/to/go.mod' # Read Go version from go.mod go-version-file: 'path/to/go.mod' # Read Go version from go.mod
- run: go version - run: go version
@@ -187,8 +194,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version-file: '.go-version' # Read Go version from .go-version go-version-file: '.go-version' # Read Go version from .go-version
- run: go version - run: go version
@@ -196,8 +203,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version-file: '.tool-versions' # Read Go version from .tool-versions go-version-file: '.tool-versions' # Read Go version from .tool-versions
- run: go version - run: go version
@@ -205,8 +212,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version-file: 'go.work' # Read Go version from go.work go-version-file: 'go.work' # Read Go version from go.work
- run: go version - run: go version
@@ -228,8 +235,8 @@ want the most up-to-date Go version to always be used. It supports major (e.g.,
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: '1.25' go-version: '1.25'
check-latest: true check-latest: true
@@ -238,12 +245,21 @@ steps:
## Caching ## Caching
The action restores and saves two independent cache entries:
- **Module sources (`GOMODCACHE`)**: keyed by the runner OS and dependency-file hash. These sources can be reused across Go versions, runner architectures, and runner images on the same OS.
- **Build outputs (`GOCACHE`)**: keyed by the runner OS, runner architecture, Linux runner image (when applicable), Go version, and dependency-file hash.
Both entries use the content hash of files listed by `cache-dependency-path`, or the root `go.mod` by default. Adding source files or build settings to that input invalidates both entries when those files change. Custom cache locations and the cache service's normal access restrictions still apply.
Each entry is restored and saved independently. Restores run sequentially to avoid concurrent extraction into overlapping custom cache directories. An exact hit is not uploaded again. A failure for one entry does not prevent caching the other. The `cache-hit` output is `true` only when both entries are restored on their primary keys.
### Caching in monorepos ### Caching in monorepos
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: '1.25' go-version: '1.25'
cache-dependency-path: subdir/go.sum cache-dependency-path: subdir/go.sum
@@ -256,8 +272,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: '1.25' go-version: '1.25'
cache-dependency-path: '**/go.sum' cache-dependency-path: '**/go.sum'
@@ -266,8 +282,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: '1.25' go-version: '1.25'
cache-dependency-path: | cache-dependency-path: |
@@ -278,7 +294,9 @@ steps:
### Multi-target builds ### Multi-target builds
`cache-dependency-path` isn’t limited to dependency files (like `go.sum`). It can also include files that capture build settings (for example, `GOOS`/`GOARCH`). This allows separate caches per target platform (OS/architecture) and helps avoid reusing caches across incompatible builds. `GOOS` and `GOARCH` are not automatically included in the cache keys. A workflow that builds for multiple targets without accounting for this may result in a race to fill the cache due to the cache key collision. One target wins the race, causing the cache to be less useful for other targets.
`cache-dependency-path` can be used to implement a workaround. It can point to files with arbitrary content, not only dependency files like `go.sum`. Writing `GOOS` and `GOARCH` to a file and including that file separates the module cache and build cache of each target:
```yaml ```yaml
env: env:
@@ -286,16 +304,15 @@ env:
GOARCH: ... GOARCH: ...
steps: steps:
- uses: actions/checkout@v7
- run: echo "$GOOS $GOARCH" > env.txt - run: echo "$GOOS $GOARCH" > env.txt
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with: with:
go-version: '1.25' go-version: '1.25'
cache-dependency-path: | cache-dependency-path: |
go.sum go.sum
env.txt env.txt
- run: go run hello.go - run: go build ./...
``` ```
### Cache invalidation on source changes ### Cache invalidation on source changes
@@ -306,8 +323,8 @@ Besides dependencies, the action can also cache build outputs (the [`GOCACHE`](h
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: '1.25' go-version: '1.25'
cache-dependency-path: | cache-dependency-path: |
@@ -328,10 +345,10 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- name: Setup go - name: Setup go
id: setup-go id: setup-go
uses: actions/setup-go@v6 uses: actions/setup-go@v7
with: with:
go-version: '1.25.5' go-version: '1.25.5'
cache: false cache: false
@@ -362,20 +379,26 @@ jobs:
if: runner.os == 'Linux' if: runner.os == 'Linux'
shell: bash shell: bash
run: echo "CACHE_OS_SUFFIX=$ImageOS-" >> $GITHUB_ENV run: echo "CACHE_OS_SUFFIX=$ImageOS-" >> $GITHUB_ENV
- name: Restore Go cache - name: Restore Go module cache
id: go-cache id: go-module-cache
uses: actions/cache/restore@v5 uses: actions/cache/restore@v5
with: with:
path: | path: ${{ env.GO_MOD_CACHE }}
${{ env.GO_MOD_CACHE }} key: setup-go-modules-${{ runner.os }}-${{ hashFiles('go.mod') }}
${{ env.GO_BUILD_CACHE }} - name: Restore Go build cache
key: setup-go-${{ runner.os }}-${{ env.ARCH }}-${{ env.CACHE_OS_SUFFIX }}go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('**/go.mod') }} id: go-build-cache
uses: actions/cache/restore@v5
with:
path: ${{ env.GO_BUILD_CACHE }}
key: setup-go-build-${{ runner.os }}-${{ env.ARCH }}-${{ env.CACHE_OS_SUFFIX }}go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod') }}
- name: Download modules - name: Download modules
run: go mod download run: go mod download
- name: Build - name: Build
run: go build ./... run: go build ./...
``` ```
Use the same file patterns in `hashFiles` as the `cache-dependency-path` of the workflow that saves the caches. The example above matches the default root `go.mod` input.
> If there are several builds on the same repo, it may make sense to create a cache in one build and use it in others. The action [actions/cache/restore](https://github.com/actions/cache/tree/main/restore#only-restore-cache) > If there are several builds on the same repo, it may make sense to create a cache in one build and use it in others. The action [actions/cache/restore](https://github.com/actions/cache/tree/main/restore#only-restore-cache)
should be used in this case. should be used in this case.
@@ -394,8 +417,8 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
id: go124 id: go124
with: with:
go-version: '^1.24' go-version: '^1.24'
@@ -404,34 +427,66 @@ jobs:
### `cache-hit` ### `cache-hit`
**cache-hit** output is available with a boolean value that indicates whether a cache hit occurred on the primary key: **cache-hit** is `true` only when both the module cache and the build cache are restored on their primary keys. If only one entry hits its primary key, the output is `false`, but that entry is still used and is not saved again. An entry restored from a non-primary key can still be saved under its primary key:
```yaml ```yaml
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
id: go124 id: go124
with: with:
go-version: '1.24' go-version: '1.24'
cache: true cache: true
- run: echo "Was the Go cache restored? ${{ steps.go124.outputs.cache-hit }}" # true if cache-hit occurred - run: echo "Were both Go caches restored? ${{ steps.go124.outputs.cache-hit }}"
``` ```
### Go environment outputs
Once Go is on the `PATH`, the action exposes the most commonly needed `go env` variables as outputs, so workflows don't have to query them in duplicated `bash`/`pwsh` steps — one expression works on Linux, macOS, and Windows. The values are a snapshot from setup time: anything a later step changes, such as setting `GOOS`/`GOARCH` to cross-compile, is not reflected.
| Output | Notes |
| --- | --- |
| `GOPATH` | Go workspace root; `bin` and `pkg/mod` live under it |
| `GOBIN` | Go 1.27+ reports an implicit `$GOPATH/bin` default; earlier releases are empty unless `GOBIN` is set |
| `go-bin-path` | Uses `GOBIN`, or falls back to `bin` under the first `GOPATH` entry when `GOBIN` is empty. It normally matches `GOBIN` on Go 1.27+; the fallback is a convenience for earlier releases. When `GOBIN` is not explicitly set (in the environment or via `go env -w`), cross-compiled binaries go one level deeper, in `$GOPATH/bin/${GOOS}_${GOARCH}` |
| `GOROOT` | Installation directory of the Go toolchain in use |
| `GOCACHE` | Build cache directory |
| `GOMODCACHE` | Module cache directory |
| `GOOS` | Go notation (`linux`, `darwin`, `windows`), unlike `runner.os` |
| `GOARCH` | Go notation (`amd64`, `arm64`), unlike `runner.arch` or the `x64` in the action's cache key |
| `GOTOOLDIR` | Holds `compile`, `link`, `vet` and the other toolchain binaries |
```yaml
steps:
- uses: actions/setup-go@v7
id: setup-go
with:
go-version: '1.25.5'
- run: echo "Modules are cached in ${{ steps.setup-go.outputs.GOMODCACHE }}"
```
Quote `go-bin-path` in shell commands, since it may contain spaces. Variables without a dedicated output are not exposed; run `go env <NAME>` in a step when you need one.
> [!NOTE]
> These outputs need Go 1.9 or newer (`go env -json`); on older releases the action logs a message, leaves them unset and does not fail. `GOCACHE` needs Go 1.10 and `GOMODCACHE` needs Go 1.15.
## Custom download URL ## Custom download URL
The `go-download-base-url` input lets you download Go from a mirror or alternative source instead of the default `https://go.dev/dl`. This can also be set via the `GO_DOWNLOAD_BASE_URL` environment variable; the input takes precedence over the environment variable. The `go-download-base-url` input lets you download Go from a mirror or alternative source instead of the default `https://go.dev/dl`. This can also be set via the `GO_DOWNLOAD_BASE_URL` environment variable; the input takes precedence over the environment variable.
When a custom base URL is provided, the action skips the `actions/go-versions` manifest lookup and downloads directly from the specified URL. When a custom base URL is provided, the action skips the `actions/go-versions` manifest lookup and downloads directly from the specified URL.
> **Note:** When constructing direct-download filenames, the original version string is preserved; native Go version normalization is used only for matching and tool cache lookups.
**Using the [Microsoft build of Go](https://github.com/microsoft/go):** **Using the [Microsoft build of Go](https://github.com/microsoft/go):**
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: '1.25' go-version: '1.25'
go-download-base-url: 'https://aka.ms/golang/release/latest' go-download-base-url: 'https://aka.ms/golang/release/latest'
@@ -445,8 +500,8 @@ env:
GO_DOWNLOAD_BASE_URL: 'https://aka.ms/golang/release/latest' GO_DOWNLOAD_BASE_URL: 'https://aka.ms/golang/release/latest'
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: '1.25' go-version: '1.25'
- run: go version - run: go version
@@ -462,8 +517,8 @@ If your custom download source requires authentication, the `token` input is for
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v7
- uses: actions/setup-go@v6 - uses: actions/setup-go@v7
with: with:
go-version: '1.25' go-version: '1.25'
go-download-base-url: 'https://private-mirror.example.com/golang' go-download-base-url: 'https://private-mirror.example.com/golang'
@@ -485,7 +540,7 @@ If that fails as well the action will try to download versions directly from [go
If that fails as well you can get a higher rate limit with [generating a personal access token on github.com](https://github.com/settings/tokens/new) and passing it as the `token` input to the action: If that fails as well you can get a higher rate limit with [generating a personal access token on github.com](https://github.com/settings/tokens/new) and passing it as the `token` input to the action:
```yaml ```yaml
uses: actions/setup-go@v6 uses: actions/setup-go@v7
with: with:
token: ${{ secrets.GH_DOTCOM_TOKEN }} token: ${{ secrets.GH_DOTCOM_TOKEN }}
go-version: '1.25' go-version: '1.25'
+297 -230
View File
@@ -1,15 +1,15 @@
{ {
"name": "setup-go", "name": "setup-go",
"version": "7.0.0", "version": "7.1.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "setup-go", "name": "setup-go",
"version": "7.0.0", "version": "7.1.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/cache": "^6.2.0", "@actions/cache": "^6.3.0",
"@actions/core": "^3.0.1", "@actions/core": "^3.0.1",
"@actions/exec": "^3.0.0", "@actions/exec": "^3.0.0",
"@actions/glob": "^0.7.0", "@actions/glob": "^0.7.0",
@@ -23,17 +23,17 @@
"@jest/globals": "^30.4.1", "@jest/globals": "^30.4.1",
"@types/node": "^24.0.0", "@types/node": "^24.0.0",
"@types/semver": "^7.7.0", "@types/semver": "^7.7.0",
"@typescript-eslint/eslint-plugin": "^8.62.0", "@typescript-eslint/eslint-plugin": "^8.72.1",
"@typescript-eslint/parser": "^8.62.0", "@typescript-eslint/parser": "^8.72.1",
"@vercel/ncc": "^0.44.0", "@vercel/ncc": "^0.44.0",
"eslint": "^10.5.0", "eslint": "^10.5.0",
"eslint-config-prettier": "^10.0.0", "eslint-config-prettier": "^10.0.0",
"eslint-plugin-jest": "^29.15.2", "eslint-plugin-jest": "^29.17.0",
"eslint-plugin-n": "^18.1.0", "eslint-plugin-n": "^18.1.0",
"globals": "^17.7.0", "globals": "^17.7.0",
"jest": "^30.4.2", "jest": "^30.4.2",
"nock": "^14.0.0", "nock": "^15.0.0",
"prettier": "^3.8.4", "prettier": "^3.9.10",
"ts-jest": "^29.4.11", "ts-jest": "^29.4.11",
"typescript": "^6.0.3" "typescript": "^6.0.3"
}, },
@@ -42,58 +42,20 @@
} }
}, },
"node_modules/@actions/cache": { "node_modules/@actions/cache": {
"version": "6.2.0", "version": "6.3.0",
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-6.2.0.tgz", "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-6.3.0.tgz",
"integrity": "sha512-Nv0xWRmbxfDbAn/70flO/F6tj2Nv4XTYMAsQHiDFSojCDfso/Zni+fRKa14ToI9hnmOW/rQcY1WYb6wsM7Pgwg==", "integrity": "sha512-SJKaVMqTgetQgJF0wifi5N2+2mffCLy/D4w/3sJtRanBBGECdi1/OD0wswyLVmqEmPbYB/rVJk41Qn/xEbFjAw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^3.0.1", "@actions/core": "^3.0.1",
"@actions/exec": "^3.0.0", "@actions/exec": "^3.0.0",
"@actions/glob": "^0.6.1", "@actions/glob": "^0.7.0",
"@actions/http-client": "^4.0.1", "@actions/http-client": "^4.0.1",
"@actions/io": "^3.0.2", "@actions/io": "^3.0.2",
"@azure/core-rest-pipeline": "^1.23.0", "@azure/core-rest-pipeline": "~1.23.0",
"@azure/storage-blob": "^12.31.0", "@azure/storage-blob": "~12.31.0",
"@protobuf-ts/runtime-rpc": "^2.11.1", "@protobuf-ts/runtime-rpc": "^2.11.1",
"semver": "^7.7.4" "semver": "^7.8.5"
}
},
"node_modules/@actions/cache/node_modules/@actions/glob": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.6.1.tgz",
"integrity": "sha512-K4+2Ac5ILcf2ySdJCha+Pop9NcKjxqCL4xL4zI50dgB2PbXgC0+AcP011xfH4Of6b4QEJJg8dyZYv7zl4byTsw==",
"license": "MIT",
"dependencies": {
"@actions/core": "^3.0.0",
"minimatch": "^3.0.4"
}
},
"node_modules/@actions/cache/node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"license": "MIT"
},
"node_modules/@actions/cache/node_modules/brace-expansion": {
"version": "1.1.15",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz",
"integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==",
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/@actions/cache/node_modules/minimatch": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
"integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
"license": "ISC",
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
} }
}, },
"node_modules/@actions/core": { "node_modules/@actions/core": {
@@ -242,9 +204,9 @@
} }
}, },
"node_modules/@azure/core-rest-pipeline": { "node_modules/@azure/core-rest-pipeline": {
"version": "1.24.0", "version": "1.23.0",
"resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.24.0.tgz", "resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.23.0.tgz",
"integrity": "sha512-PpLsoDQ3AMmKZ0VU+0GrmqMxgp/sExjlVm4R+nLWngeoEGAzOIPVifaxKGU5gMv+nWELUoHfvrolWD+ZS/nFJg==", "integrity": "sha512-Evs1INHo+jUjwHi1T6SG6Ua/LHOQBCLuKEEE6efIpt4ZOoNonaT1kP32GoOcdNDbfqsD2445CPri3MubBy5DEQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@azure/abort-controller": "^2.1.2", "@azure/abort-controller": "^2.1.2",
@@ -312,9 +274,9 @@
} }
}, },
"node_modules/@azure/storage-blob": { "node_modules/@azure/storage-blob": {
"version": "12.32.0", "version": "12.31.0",
"resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.32.0.tgz", "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.31.0.tgz",
"integrity": "sha512-80LzSNnFQye2LCCBFghAJS6jJQJ7N4bfgZ6qDMgVGRtugZ7TLDKQZ2hczMigmZH3jAcMRdma/IygsC5+0gT7Tw==", "integrity": "sha512-DBgNv10aCSxopt92DkTDD0o9xScXeBqPKGmR50FPZQaEcH4JLQ+GEOGEDv19V5BMkB7kxr+m4h6il/cCDPvmHg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@azure/abort-controller": "^2.1.2", "@azure/abort-controller": "^2.1.2",
@@ -328,7 +290,7 @@
"@azure/core-util": "^1.11.0", "@azure/core-util": "^1.11.0",
"@azure/core-xml": "^1.4.5", "@azure/core-xml": "^1.4.5",
"@azure/logger": "^1.1.4", "@azure/logger": "^1.1.4",
"@azure/storage-common": "^12.4.0", "@azure/storage-common": "^12.3.0",
"events": "^3.0.0", "events": "^3.0.0",
"tslib": "^2.8.1" "tslib": "^2.8.1"
}, },
@@ -1590,9 +1552,9 @@
} }
}, },
"node_modules/@mswjs/interceptors": { "node_modules/@mswjs/interceptors": {
"version": "0.41.9", "version": "0.39.8",
"resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.41.9.tgz", "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.39.8.tgz",
"integrity": "sha512-VVPPgHyQ6ShqnrmDWuxjmUIsO9gWyOZFmuOfLd9LfBGQJwZfy0gvv9pbHSJuoFNIYC7ZDX9aoFwowjcdSC4E8w==", "integrity": "sha512-2+BzZbjRO7Ct61k8fMNHEtoKjeWI9pIlHFTqBwZ5icHpqszIgEZbjb1MW5Z0+bITTCTl3gk4PDBxs9tA/csXvA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -1627,9 +1589,9 @@
} }
}, },
"node_modules/@nodable/entities": { "node_modules/@nodable/entities": {
"version": "2.2.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-2.2.0.tgz", "resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-3.0.0.tgz",
"integrity": "sha512-9uGyhaQavEUMC8AIddIjau4NsnsXhou+j5sBAGojCM1oxmQpVKTWR/9JxABD6UAv12vpIms55fPZKFQEhG6uBg==", "integrity": "sha512-8L9xFeTYKhm49xfIypoe2W5wV1m/3Z58kT+7kR9A8OyFxcPduI4VmxaUMQyKYrRjUoLLSXv6EKKID5Tvj9cUVw==",
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
@@ -1875,17 +1837,17 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@typescript-eslint/eslint-plugin": { "node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.62.0", "version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.62.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.72.1.tgz",
"integrity": "sha512-o+mpz7EYiMzXoySXiKmzlabIvTVqUuK5yLrAedRPRDA0IpPFMUV1IXt6OqljIxX/kumN6EjUYp41Hqelh6p/Dw==", "integrity": "sha512-5CokTWXpmbylfFabsbvHC0CAw3XLaGnoa+nFJX5FR592h/LoZsENUE6p/rg5xvkKrFEXz6pYmgI29AgXc2N3BQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@eslint-community/regexpp": "^4.12.2", "@eslint-community/regexpp": "^4.12.2",
"@typescript-eslint/scope-manager": "8.62.0", "@typescript-eslint/scope-manager": "8.72.1",
"@typescript-eslint/type-utils": "8.62.0", "@typescript-eslint/type-utils": "8.72.1",
"@typescript-eslint/utils": "8.62.0", "@typescript-eslint/utils": "8.72.1",
"@typescript-eslint/visitor-keys": "8.62.0", "@typescript-eslint/visitor-keys": "8.72.1",
"ignore": "^7.0.5", "ignore": "^7.0.5",
"natural-compare": "^1.4.0", "natural-compare": "^1.4.0",
"ts-api-utils": "^2.5.0" "ts-api-utils": "^2.5.0"
@@ -1898,22 +1860,22 @@
"url": "https://opencollective.com/typescript-eslint" "url": "https://opencollective.com/typescript-eslint"
}, },
"peerDependencies": { "peerDependencies": {
"@typescript-eslint/parser": "^8.62.0", "@typescript-eslint/parser": "^8.72.1",
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
"typescript": ">=4.8.4 <6.1.0" "typescript": ">=4.8.4 <6.1.0"
} }
}, },
"node_modules/@typescript-eslint/parser": { "node_modules/@typescript-eslint/parser": {
"version": "8.62.0", "version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.62.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.72.1.tgz",
"integrity": "sha512-dzHeT2gySzZtLDsuqxU9AkYgIsQoHAHtRBpOqM+Ofzx1Bwrd2RcCjQJ+6iQbsHOIR6NS33bF2W1k3blN1zLDrA==", "integrity": "sha512-ZGwZP4OCfyA0AQTpEAMWz+rtX01DRhQWW5hB0ucKDEIX5U7jdmPSaMx94rQfaPAQzIYz2BimOgKOJtjfpRFQ9g==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": "8.62.0", "@typescript-eslint/scope-manager": "8.72.1",
"@typescript-eslint/types": "8.62.0", "@typescript-eslint/types": "8.72.1",
"@typescript-eslint/typescript-estree": "8.62.0", "@typescript-eslint/typescript-estree": "8.72.1",
"@typescript-eslint/visitor-keys": "8.62.0", "@typescript-eslint/visitor-keys": "8.72.1",
"debug": "^4.4.3" "debug": "^4.4.3"
}, },
"engines": { "engines": {
@@ -1928,15 +1890,145 @@
"typescript": ">=4.8.4 <6.1.0" "typescript": ">=4.8.4 <6.1.0"
} }
}, },
"node_modules/@typescript-eslint/project-service": { "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/project-service": {
"version": "8.62.0", "version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.62.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.72.1.tgz",
"integrity": "sha512-wexnCqiTg7BOGtbLDftYpRWlmLq4xfoMd7BKFR6Y75sZS3QmRKLdN3yWLhmIYgqMmP/OXWpj3H8odkb5nGURCQ==", "integrity": "sha512-fAuVMkwdO/huI8nyo/WKnNKf6Gag93S56Rh3Ts5mGcavwSdaN8tRg1gCeIGX8PF+nzp1BjGfO4gHhGzW1J6jTg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.62.0", "@typescript-eslint/tsconfig-utils": "^8.72.1",
"@typescript-eslint/types": "^8.62.0", "@typescript-eslint/types": "^8.72.1",
"debug": "^4.4.3"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
"version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.72.1.tgz",
"integrity": "sha512-lC/t6eMCZZQAAKZEYGL6RDVSuFehpdmMT6h+nJIjIa6oylN/PwDgDVtEIbB7O9xFfZYtZAYLoLlDNWKJhtF+uQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.72.1",
"@typescript-eslint/visitor-keys": "8.72.1"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.72.1.tgz",
"integrity": "sha512-e4D5R5vpeAEPBxT2BAzsFQL3sbwyeeeo5+aczgNSRK1V734jE7pTqaGFU+fXapWEQwnZbpFaTn32+Z8DwS6OTg==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
"version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.72.1.tgz",
"integrity": "sha512-LmE5IhQet1BWOWEXqBrVtBPsMAOQ6Nzk35d+WLh3mk4EUF33sqlfxjio1MdYeSvKSG5skactKKuixBIKXhL4Rw==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
"version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.72.1.tgz",
"integrity": "sha512-DAlUoUV93hIvrtIQLwCbmZQYVZwOMhiHJrOVUUIWicFZaIYjTRqlY3I/NZevfkLmSqkNHRu2qYDcq9lrn16oOQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/project-service": "8.72.1",
"@typescript-eslint/tsconfig-utils": "8.72.1",
"@typescript-eslint/types": "8.72.1",
"@typescript-eslint/visitor-keys": "8.72.1",
"debug": "^4.4.3",
"minimatch": "^10.2.2",
"semver": "^7.7.3",
"tinyglobby": "^0.2.15",
"ts-api-utils": "^2.5.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": {
"version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.72.1.tgz",
"integrity": "sha512-SB8xqipSzZHUePCCLNeYxqnxq83X61/qzNhjQGbTfjxGZIeOEP7tBgWYX05Tcd6CgE02WdTJnh5b8kMZJ/+bnQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.72.1",
"eslint-visitor-keys": "^5.0.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/parser/node_modules/eslint-visitor-keys": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz",
"integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==",
"dev": true,
"license": "Apache-2.0",
"engines": {
"node": "^20.19.0 || ^22.13.0 || >=24"
},
"funding": {
"url": "https://opencollective.com/eslint"
}
},
"node_modules/@typescript-eslint/project-service": {
"version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.72.1.tgz",
"integrity": "sha512-fAuVMkwdO/huI8nyo/WKnNKf6Gag93S56Rh3Ts5mGcavwSdaN8tRg1gCeIGX8PF+nzp1BjGfO4gHhGzW1J6jTg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.72.1",
"@typescript-eslint/types": "^8.72.1",
"debug": "^4.4.3" "debug": "^4.4.3"
}, },
"engines": { "engines": {
@@ -1951,14 +2043,14 @@
} }
}, },
"node_modules/@typescript-eslint/scope-manager": { "node_modules/@typescript-eslint/scope-manager": {
"version": "8.62.0", "version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.62.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.72.1.tgz",
"integrity": "sha512-1lX38kNxXIRb8mEc3lbq5mdHq1Pf2+U0nFU65KfT18mtPxxl0fvjuEE92mHuXPuCtElJhOrddOpyMlM3Z0umEA==", "integrity": "sha512-lC/t6eMCZZQAAKZEYGL6RDVSuFehpdmMT6h+nJIjIa6oylN/PwDgDVtEIbB7O9xFfZYtZAYLoLlDNWKJhtF+uQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/types": "8.62.0", "@typescript-eslint/types": "8.72.1",
"@typescript-eslint/visitor-keys": "8.62.0" "@typescript-eslint/visitor-keys": "8.72.1"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -1969,9 +2061,9 @@
} }
}, },
"node_modules/@typescript-eslint/tsconfig-utils": { "node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.62.0", "version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.62.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.72.1.tgz",
"integrity": "sha512-y2GAdB6ykaXUvuspbYnizQc4oDDz0Tz/Yc7iWrXf9mx8vm/L/0vLHCe0tS2boG96Zy+DivnVDQ9ZUEWoHqqx1g==", "integrity": "sha512-e4D5R5vpeAEPBxT2BAzsFQL3sbwyeeeo5+aczgNSRK1V734jE7pTqaGFU+fXapWEQwnZbpFaTn32+Z8DwS6OTg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -1986,15 +2078,15 @@
} }
}, },
"node_modules/@typescript-eslint/type-utils": { "node_modules/@typescript-eslint/type-utils": {
"version": "8.62.0", "version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.62.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.72.1.tgz",
"integrity": "sha512-+g5O3j0w2ldzC86Pv6fvbO/xhAonbJFIdf/MKQ1d30gndlsVzUOE83ldfSE15Qrl9fhFjK6AovHs5Wpp6vx86w==", "integrity": "sha512-iY2wlmyrXJmx4yxUGP3aYCFF3cA/6ShddOKmLU2dx7LnEykbAM8WThlxZEfd1NddqceF6eJmZUayxx9oKIYNlg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/types": "8.62.0", "@typescript-eslint/types": "8.72.1",
"@typescript-eslint/typescript-estree": "8.62.0", "@typescript-eslint/typescript-estree": "8.72.1",
"@typescript-eslint/utils": "8.62.0", "@typescript-eslint/utils": "8.72.1",
"debug": "^4.4.3", "debug": "^4.4.3",
"ts-api-utils": "^2.5.0" "ts-api-utils": "^2.5.0"
}, },
@@ -2011,9 +2103,9 @@
} }
}, },
"node_modules/@typescript-eslint/types": { "node_modules/@typescript-eslint/types": {
"version": "8.62.0", "version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.62.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.72.1.tgz",
"integrity": "sha512-KvAclkktORPvM54TgLgA4z9HIV1M8zOgw9ZVNXl9f/8dLYfXYX1wkMXP7qmabpijQRV5bHJLOmoyGQbLMaUYeg==", "integrity": "sha512-LmE5IhQet1BWOWEXqBrVtBPsMAOQ6Nzk35d+WLh3mk4EUF33sqlfxjio1MdYeSvKSG5skactKKuixBIKXhL4Rw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -2025,16 +2117,16 @@
} }
}, },
"node_modules/@typescript-eslint/typescript-estree": { "node_modules/@typescript-eslint/typescript-estree": {
"version": "8.62.0", "version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.62.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.72.1.tgz",
"integrity": "sha512-+hVbNxtW64pIcZWDPGbyaKF7vp2IBTVY5ma1blwwksrjdsbdqqEKvJWMGbBofei4F6Dovx1M0RJgoFeNu2279A==", "integrity": "sha512-DAlUoUV93hIvrtIQLwCbmZQYVZwOMhiHJrOVUUIWicFZaIYjTRqlY3I/NZevfkLmSqkNHRu2qYDcq9lrn16oOQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/project-service": "8.62.0", "@typescript-eslint/project-service": "8.72.1",
"@typescript-eslint/tsconfig-utils": "8.62.0", "@typescript-eslint/tsconfig-utils": "8.72.1",
"@typescript-eslint/types": "8.62.0", "@typescript-eslint/types": "8.72.1",
"@typescript-eslint/visitor-keys": "8.62.0", "@typescript-eslint/visitor-keys": "8.72.1",
"debug": "^4.4.3", "debug": "^4.4.3",
"minimatch": "^10.2.2", "minimatch": "^10.2.2",
"semver": "^7.7.3", "semver": "^7.7.3",
@@ -2053,16 +2145,16 @@
} }
}, },
"node_modules/@typescript-eslint/utils": { "node_modules/@typescript-eslint/utils": {
"version": "8.62.0", "version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.62.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.72.1.tgz",
"integrity": "sha512-82r66fi9zYwZ+mTq3vKgwjbZ1PVk/DJzrXFLpG6RnBbdvH8TEGVHIs9H4d2drhkOzf0syZuD/OZvvlu6GDbP4g==", "integrity": "sha512-5v5liypurJBFHCBNqh/RjsymAD+VWcE0djuGY/BUqp5fC3Qn+luWDEksjuTtWjPn6i5zQlUtkZCRG/CYG0yCkA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.9.1", "@eslint-community/eslint-utils": "^4.9.1",
"@typescript-eslint/scope-manager": "8.62.0", "@typescript-eslint/scope-manager": "8.72.1",
"@typescript-eslint/types": "8.62.0", "@typescript-eslint/types": "8.72.1",
"@typescript-eslint/typescript-estree": "8.62.0" "@typescript-eslint/typescript-estree": "8.72.1"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -2077,13 +2169,13 @@
} }
}, },
"node_modules/@typescript-eslint/visitor-keys": { "node_modules/@typescript-eslint/visitor-keys": {
"version": "8.62.0", "version": "8.72.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.62.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.72.1.tgz",
"integrity": "sha512-CY3uyFSRbcQv3nnSv8S0+lDftMVz6P963PoRlxrV7ew/Md564g9ut60PYzdLM5qW4jFn93GBF+Soi90ISAN+GQ==", "integrity": "sha512-SB8xqipSzZHUePCCLNeYxqnxq83X61/qzNhjQGbTfjxGZIeOEP7tBgWYX05Tcd6CgE02WdTJnh5b8kMZJ/+bnQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/types": "8.62.0", "@typescript-eslint/types": "8.72.1",
"eslint-visitor-keys": "^5.0.0" "eslint-visitor-keys": "^5.0.0"
}, },
"engines": { "engines": {
@@ -2234,9 +2326,6 @@
"arm64" "arm64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2251,9 +2340,6 @@
"arm64" "arm64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2268,9 +2354,6 @@
"loong64" "loong64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2285,9 +2368,6 @@
"loong64" "loong64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2302,9 +2382,6 @@
"ppc64" "ppc64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2319,9 +2396,6 @@
"riscv64" "riscv64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2336,9 +2410,6 @@
"riscv64" "riscv64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2353,9 +2424,6 @@
"s390x" "s390x"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2370,9 +2438,6 @@
"x64" "x64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2387,9 +2452,6 @@
"x64" "x64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2733,9 +2795,9 @@
} }
}, },
"node_modules/baseline-browser-mapping": { "node_modules/baseline-browser-mapping": {
"version": "2.10.38", "version": "2.11.20",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.38.tgz", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.20.tgz",
"integrity": "sha512-31/02mVB4yuQU6adKk5SlY6m+mxDwUq5KZkyYgnLrrKl7TEm1+3PyDtDBz2kOv/wxZz41GHsvV1A/u6RmiyBvw==", "integrity": "sha512-H0ulySigv6icDJ1F7SjtdCD6PrhTpdYCmP0CactWy1+ekh0AFd0o1Wn5T8b+hnTmdBx19u9yhL6wvCylXMY7zw==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {
@@ -2746,21 +2808,21 @@
} }
}, },
"node_modules/brace-expansion": { "node_modules/brace-expansion": {
"version": "5.0.6", "version": "5.0.9",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz",
"integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==", "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"balanced-match": "^4.0.2" "balanced-match": "^4.0.2"
}, },
"engines": { "engines": {
"node": "18 || 20 || >=22" "node": "20 || >=22"
} }
}, },
"node_modules/browserslist": { "node_modules/browserslist": {
"version": "4.28.2", "version": "4.28.8",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.8.tgz",
"integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", "integrity": "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -2778,11 +2840,11 @@
], ],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"baseline-browser-mapping": "^2.10.12", "baseline-browser-mapping": "^2.11.12",
"caniuse-lite": "^1.0.30001782", "caniuse-lite": "^1.0.30001809",
"electron-to-chromium": "^1.5.328", "electron-to-chromium": "^1.5.402",
"node-releases": "^2.0.36", "node-releases": "^2.0.53",
"update-browserslist-db": "^1.2.3" "update-browserslist-db": "^1.3.0"
}, },
"bin": { "bin": {
"browserslist": "cli.js" "browserslist": "cli.js"
@@ -2842,9 +2904,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001799", "version": "1.0.30001810",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001799.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz",
"integrity": "sha512-hG1bReV+OUU+MOqK4t/ZWI0tZOyz3rqS9XuhOUz1cIcbwBKjOyJEJuw9ER5JuNyqxNk8u/JUVbGibBOL1yrjFw==", "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -3032,6 +3094,7 @@
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/convert-source-map": { "node_modules/convert-source-map": {
@@ -3123,9 +3186,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.5.376", "version": "1.5.418",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.376.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.418.tgz",
"integrity": "sha512-cUVA7/RvbFTEuw/i3obUwDTRIXojaxkResf+ibByPFxjc6XK3VNtcQXV0NSbAlJ0FMjcJGgftVVB4Qo184EXvA==", "integrity": "sha512-UzS26r3AEbG5wSoGVpJKqwHIU9zwQN7LHdVIThDrJpS0I5KdlXFMEb8543fhc9dVnIIAST6ar8rhwa00AL5MlA==",
"dev": true, "dev": true,
"license": "ISC" "license": "ISC"
}, },
@@ -3310,9 +3373,9 @@
} }
}, },
"node_modules/eslint-plugin-jest": { "node_modules/eslint-plugin-jest": {
"version": "29.15.2", "version": "29.17.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-29.15.2.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-29.17.0.tgz",
"integrity": "sha512-kEN4r9RZl1xcsb4arGq89LrcVdOUFII/JSCwtTPJyv16mDwmPrcuEQwpxqZHeINvcsd7oK5O/rhdGlxFRaZwvQ==", "integrity": "sha512-6jtpU6MhYKbagkES02TupWAUUooJpZtKg94Ax0b8HhUorv3InSTBU8RRtlSBe0LocOcShXOpyec3PHzPDkJCSg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -3325,7 +3388,7 @@
"@typescript-eslint/eslint-plugin": "^8.0.0", "@typescript-eslint/eslint-plugin": "^8.0.0",
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
"jest": "*", "jest": "*",
"typescript": ">=4.8.4 <7.0.0" "typescript": ">=4.8.4 <8.0.0"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"@typescript-eslint/eslint-plugin": { "@typescript-eslint/eslint-plugin": {
@@ -3650,9 +3713,9 @@
} }
}, },
"node_modules/fast-xml-parser": { "node_modules/fast-xml-parser": {
"version": "5.9.3", "version": "5.10.1",
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.9.3.tgz", "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.10.1.tgz",
"integrity": "sha512-brCNCeScma/kqa54J4PIDriSSSLssRkuYaUCpvHJulGc3HGI/xxKUCTDcYkAdqJsyb//ydpbxecjC3hB9+tb/g==", "integrity": "sha512-IEMIf7298kXuZSRFoGfMYrl7is8LpavODgbNz1cwIudv7KwVFnuU+UsMporfq6PD6aXSlawZlARiA3UywCTfMw==",
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
@@ -3661,17 +3724,32 @@
], ],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@nodable/entities": "^2.2.0", "@nodable/entities": "^3.0.0",
"fast-xml-builder": "^1.2.0", "fast-xml-builder": "^1.2.0",
"is-unsafe": "^1.0.1", "is-unsafe": "^2.0.0",
"path-expression-matcher": "^1.5.0", "path-expression-matcher": "^1.6.2",
"strnum": "^2.4.1", "strnum": "^2.4.1",
"xml-naming": "^0.1.0" "xml-naming": "^0.3.0"
}, },
"bin": { "bin": {
"fxparser": "src/cli/cli.js" "fxparser": "src/cli/cli.js"
} }
}, },
"node_modules/fast-xml-parser/node_modules/xml-naming": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/xml-naming/-/xml-naming-0.3.0.tgz",
"integrity": "sha512-ghig2TBE/H11aOVgmahA3MhimvkBr6JIYknH/Dhdk10nXwdbIqBJsbfMxpvFPG8bAw77gN29aQWvKpmVoPlvPQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/NaturalIntelligence"
}
],
"license": "MIT",
"engines": {
"node": ">=16.0.0"
}
},
"node_modules/fb-watchman": { "node_modules/fb-watchman": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz",
@@ -3889,9 +3967,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/glob/node_modules/brace-expansion": { "node_modules/glob/node_modules/brace-expansion": {
"version": "2.1.1", "version": "2.1.4",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.1.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz",
"integrity": "sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA==", "integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -3942,13 +4020,13 @@
"license": "ISC" "license": "ISC"
}, },
"node_modules/handlebars": { "node_modules/handlebars": {
"version": "4.7.9", "version": "4.7.10",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.9.tgz", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.10.tgz",
"integrity": "sha512-4E71E0rpOaQuJR2A3xDZ+GM1HyWYv1clR58tC8emQNeQe3RH7MAzSbat+V0wG78LQBo6m6bzSG/L4pBuCsgnUQ==", "integrity": "sha512-P5VJMVM7qgBn6vjXMw8WG9uVI+ncf2pi72j4de4yz5ZULLj2RGqLYaKOYGsgyrViQ0tePOVlN1tDCCXXtFqXKg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"minimist": "^1.2.5", "minimist": "^1.2.8",
"neo-async": "^2.6.2", "neo-async": "^2.6.2",
"source-map": "^0.6.1", "source-map": "^0.6.1",
"wordwrap": "^1.0.0" "wordwrap": "^1.0.0"
@@ -4146,9 +4224,9 @@
} }
}, },
"node_modules/is-unsafe": { "node_modules/is-unsafe": {
"version": "1.0.1", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-unsafe/-/is-unsafe-1.0.1.tgz", "resolved": "https://registry.npmjs.org/is-unsafe/-/is-unsafe-2.0.0.tgz",
"integrity": "sha512-CLK2+VdgERgD96EYm5lUQssZYlRg2tkZnbsxZoacmSiRxiFJ4Nk4SzjCl+Ur+v3kXIY9dTIdb3IH22y1mZ56LA==", "integrity": "sha512-2LdV822R+wmI86unXA93WCFpL6g+av8ynWk0nrHyJqGop5VoocYsSLFgN8jrfalT6iGeLNM4KXuVSsULP53kEA==",
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
@@ -4839,9 +4917,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/js-yaml": { "node_modules/js-yaml": {
"version": "3.15.0", "version": "3.15.2",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.15.0.tgz", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.15.2.tgz",
"integrity": "sha512-ttBQIIQPDeLjpPOohtUdXuXUVoA2uIB6fEH9HyJ7234s5mBJ5wTx20njxplLZQgLaOfpmPQA7X2t5AX6tIPbog==", "integrity": "sha512-6EuL879VkRA+1Cz578mKMiKvjPNEuk6+r1JaFzoSWejZmtf7xWbIyw1e3KkxlkzTIt9Taw6JBhEppG7utc1P+w==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -5109,15 +5187,14 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/nock": { "node_modules/nock": {
"version": "14.0.15", "version": "15.0.0",
"resolved": "https://registry.npmjs.org/nock/-/nock-14.0.15.tgz", "resolved": "https://registry.npmjs.org/nock/-/nock-15.0.0.tgz",
"integrity": "sha512-S0a47C9pLvcYx/Ugf0H30BVBEcUgMMBDk9VJIDlJ8XGrfH2QDUD4Tgdp45qDIiHttokBG+IbsOtsvIjGR/j3bg==", "integrity": "sha512-EoAVk4Y8Yv4JUQz62sv8zmv+DoBblD/pht/q7aW/td1WietaFWrivzhMGGCLmx2qjpLcOrbyammedW8IRUU5TA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@mswjs/interceptors": "^0.41.0", "@mswjs/interceptors": "^0.39.5",
"json-stringify-safe": "^5.0.1", "json-stringify-safe": "^5.0.1"
"propagate": "^2.0.0"
}, },
"engines": { "engines": {
"node": ">=18.20.0 <20 || >=20.12.1" "node": ">=18.20.0 <20 || >=20.12.1"
@@ -5131,9 +5208,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/node-releases": { "node_modules/node-releases": {
"version": "2.0.48", "version": "2.0.54",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.48.tgz", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.54.tgz",
"integrity": "sha512-1uz8041X6LoI6ZSdZacM9lVY28vuzDlSKitnpbSNK0RfKoIJkX29NBPVEFXhnuSuEOA9Ww0xnPJ+ILWbGAv8DA==", "integrity": "sha512-YHs7BmmcsdAI5Ozuf8JZo6PT0mv2GIWC9vMfvUC3dp65M8hn7Ux8CPL+2oBI7juNuj9d0ndhTcznq2ODBps9cQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -5293,9 +5370,9 @@
} }
}, },
"node_modules/path-expression-matcher": { "node_modules/path-expression-matcher": {
"version": "1.6.0", "version": "1.6.2",
"resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.6.0.tgz", "resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.6.2.tgz",
"integrity": "sha512-e5y7RCLHKjemsgQ4eqGJtPyr10ILz25HO7flzxhTV8bgvd5yHx98DGtCAtbVW9f2TqnYI/gEVZd+vz7snrdPTw==", "integrity": "sha512-enSlaiat05iasnzmgNxRj8reFdj3puY2QpNgP1aPIaVfT6nn9ICuPoFlKHk8EN22HcwewshO+mN2DGbkCEOtqQ==",
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
@@ -5461,9 +5538,9 @@
} }
}, },
"node_modules/prettier": { "node_modules/prettier": {
"version": "3.8.4", "version": "3.9.10",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.4.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.10.tgz",
"integrity": "sha512-N2MylSdi48+5N/6S5j+maeHbUSIzzZ5uOcX5Hm4QpV8Dkb1HFjfAKTKX6yNPJQD9AhcT3ifHNB66tWTTJDi11Q==", "integrity": "sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"bin": { "bin": {
@@ -5505,16 +5582,6 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1" "url": "https://github.com/chalk/ansi-styles?sponsor=1"
} }
}, },
"node_modules/propagate": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/propagate/-/propagate-2.0.1.tgz",
"integrity": "sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 8"
}
},
"node_modules/punycode": { "node_modules/punycode": {
"version": "2.3.1", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
@@ -5972,9 +6039,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/test-exclude/node_modules/brace-expansion": { "node_modules/test-exclude/node_modules/brace-expansion": {
"version": "1.1.15", "version": "1.1.18",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz",
"integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==", "integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -6200,9 +6267,9 @@
} }
}, },
"node_modules/undici": { "node_modules/undici": {
"version": "6.27.0", "version": "6.29.1",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.27.0.tgz", "resolved": "https://registry.npmjs.org/undici/-/undici-6.29.1.tgz",
"integrity": "sha512-YmfV3YnEDzXRC5lZ2jWtWWHKGUm1zIt8AhesR1tens+HTNv+YZlN/dp6G727LOvMJ8xjP9Be7Y2Sdr96LDm+pg==", "integrity": "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=18.17" "node": ">=18.17"
@@ -6254,9 +6321,9 @@
} }
}, },
"node_modules/update-browserslist-db": { "node_modules/update-browserslist-db": {
"version": "1.2.3", "version": "1.3.2",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.2.tgz",
"integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", "integrity": "sha512-UQ+MSxlhRm1bzjhU+DcuXfjFO1FzNtqhK5+9Yvlp90ItDLk5vT932A0rFu619nf7RVS+Y/VeaUW1jaRDqZ8VJw==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
+7 -7
View File
@@ -1,6 +1,6 @@
{ {
"name": "setup-go", "name": "setup-go",
"version": "7.0.0", "version": "7.1.0",
"type": "module", "type": "module",
"private": true, "private": true,
"description": "setup go action", "description": "setup go action",
@@ -29,7 +29,7 @@
"author": "GitHub", "author": "GitHub",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/cache": "^6.2.0", "@actions/cache": "^6.3.0",
"@actions/core": "^3.0.1", "@actions/core": "^3.0.1",
"@actions/exec": "^3.0.0", "@actions/exec": "^3.0.0",
"@actions/glob": "^0.7.0", "@actions/glob": "^0.7.0",
@@ -43,17 +43,17 @@
"@jest/globals": "^30.4.1", "@jest/globals": "^30.4.1",
"@types/node": "^24.0.0", "@types/node": "^24.0.0",
"@types/semver": "^7.7.0", "@types/semver": "^7.7.0",
"@typescript-eslint/eslint-plugin": "^8.62.0", "@typescript-eslint/eslint-plugin": "^8.72.1",
"@typescript-eslint/parser": "^8.62.0", "@typescript-eslint/parser": "^8.72.1",
"@vercel/ncc": "^0.44.0", "@vercel/ncc": "^0.44.0",
"eslint": "^10.5.0", "eslint": "^10.5.0",
"eslint-config-prettier": "^10.0.0", "eslint-config-prettier": "^10.0.0",
"eslint-plugin-jest": "^29.15.2", "eslint-plugin-jest": "^29.17.0",
"eslint-plugin-n": "^18.1.0", "eslint-plugin-n": "^18.1.0",
"globals": "^17.7.0", "globals": "^17.7.0",
"jest": "^30.4.2", "jest": "^30.4.2",
"nock": "^14.0.0", "nock": "^15.0.0",
"prettier": "^3.8.4", "prettier": "^3.9.10",
"ts-jest": "^29.4.11", "ts-jest": "^29.4.11",
"typescript": "^6.0.3" "typescript": "^6.0.3"
} }
+40 -14
View File
@@ -6,13 +6,18 @@ import fs from 'fs';
import {State, Outputs} from './constants.js'; import {State, Outputs} from './constants.js';
import {PackageManagerInfo} from './package-managers.js'; import {PackageManagerInfo} from './package-managers.js';
import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils.js'; import {
CacheEntry,
getCacheDirectoryPath,
getPackageManagerInfo
} from './cache-utils.js';
export const restoreCache = async ( export const restoreCache = async (
versionSpec: string, versionSpec: string,
packageManager: string, packageManager: string,
cacheDependencyPath?: string cacheDependencyPath?: string
) => { ) => {
core.setOutput(Outputs.CacheHit, false);
const packageManagerInfo = await getPackageManagerInfo(packageManager); const packageManagerInfo = await getPackageManagerInfo(packageManager);
const platform = process.env.RUNNER_OS; const platform = process.env.RUNNER_OS;
const arch = process.arch; const arch = process.arch;
@@ -32,22 +37,43 @@ export const restoreCache = async (
const linuxVersion = const linuxVersion =
process.env.RUNNER_OS === 'Linux' ? `${process.env.ImageOS}-` : ''; process.env.RUNNER_OS === 'Linux' ? `${process.env.ImageOS}-` : '';
const primaryKey = `setup-go-${platform}-${arch}-${linuxVersion}go-${versionSpec}-${fileHash}`; const primaryKeys = {
core.debug(`primary key is ${primaryKey}`); // Downloaded module sources can be reused across Go versions and runner
// architectures. Keep OS isolation for filesystem compatibility.
modules: `setup-go-modules-${platform}-${fileHash}`,
build: `setup-go-build-${platform}-${arch}-${linuxVersion}go-${versionSpec}-${fileHash}`
};
const entries: CacheEntry[] = cachePaths.map(directory => ({
...directory,
primaryKey: primaryKeys[directory.kind]
}));
core.saveState(State.CachePrimaryKey, primaryKey); for (const entry of entries) {
core.debug(`${entry.kind} primary key is ${entry.primaryKey}`);
const cacheKey = await cache.restoreCache(cachePaths, primaryKey); try {
core.setOutput(Outputs.CacheHit, Boolean(cacheKey)); entry.matchedKey = await cache.restoreCache(
[entry.path],
if (!cacheKey) { entry.primaryKey
core.info(`Cache is not found`); );
core.setOutput(Outputs.CacheHit, false); if (entry.matchedKey) {
return; core.info(`${entry.kind} cache restored from key: ${entry.matchedKey}`);
} else {
core.info(`${entry.kind} cache is not found`);
}
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
core.warning(`Restore ${entry.kind} cache failed: ${message}`);
}
} }
core.saveState(State.CacheMatchedKey, cacheKey); // Preserve the resolved paths so the post step uses the same cache versions,
core.info(`Cache restored from key: ${cacheKey}`); // even if a later step changes the Go environment.
core.saveState(State.CacheEntries, entries);
core.setOutput(
Outputs.CacheHit,
entries.length === packageManagerInfo.cacheFolderCommandList.length &&
entries.every(entry => entry.matchedKey === entry.primaryKey)
);
}; };
const findDependencyFile = (packageManager: PackageManagerInfo) => { const findDependencyFile = (packageManager: PackageManagerInfo) => {
+34 -42
View File
@@ -2,7 +2,7 @@ import * as core from '@actions/core';
import * as cache from '@actions/cache'; import * as cache from '@actions/cache';
import fs from 'fs'; import fs from 'fs';
import {State} from './constants.js'; import {State} from './constants.js';
import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils.js'; import type {CacheEntry} from './cache-utils.js';
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in // Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to // @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
@@ -39,55 +39,47 @@ export async function run(earlyExit?: boolean) {
} }
const cachePackages = async () => { const cachePackages = async () => {
const packageManager = 'default'; const entries: CacheEntry[] = JSON.parse(
core.getState(State.CacheEntries) || '[]'
const state = core.getState(State.CacheMatchedKey);
const primaryKey = core.getState(State.CachePrimaryKey);
const packageManagerInfo = await getPackageManagerInfo(packageManager);
const cachePaths = await getCacheDirectoryPath(packageManagerInfo);
const nonExistingPaths = cachePaths.filter(
cachePath => !fs.existsSync(cachePath)
); );
if (!entries.length) {
if (nonExistingPaths.length === cachePaths.length) {
core.warning('There are no cache folders on the disk');
return;
}
if (nonExistingPaths.length) {
logWarning(
`Cache folder path is retrieved but doesn't exist on disk: ${nonExistingPaths.join(
', '
)}`
);
}
if (!primaryKey) {
core.info( core.info(
'Primary key was not generated. Please check the log messages above for more errors or information' 'Cache keys were not generated. Please check the log messages above for more errors or information'
); );
return; return;
} }
if (primaryKey === state) { await Promise.all(entries.map(saveCacheEntry));
core.info( };
`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`
);
return;
}
const cacheId = await cache.saveCache(cachePaths, primaryKey); const saveCacheEntry = async (entry: CacheEntry) => {
if (cacheId === -1) { try {
// saveCache returns -1 without throwing when the cache was not saved, e.g. const {kind, path, primaryKey, matchedKey} = entry;
// a reserve collision or a read-only token (fork PR). @actions/cache has if (primaryKey === matchedKey) {
// already logged the reason at the appropriate severity, so just trace it. core.info(
core.debug(`Cache was not saved for the key: ${primaryKey}`); `Cache hit occurred on the primary key ${primaryKey}, not saving cache.`
return; );
return;
}
if (!fs.existsSync(path)) {
logWarning(`${kind} cache folder doesn't exist on disk: ${path}`);
return;
}
const cacheId = await cache.saveCache([path], primaryKey);
if (cacheId === -1) {
// saveCache returns -1 without throwing when the cache was not saved, e.g.
// a reserve collision or a read-only token (fork PR). @actions/cache has
// already logged the reason at the appropriate severity, so just trace it.
core.debug(`Cache was not saved for the key: ${primaryKey}`);
return;
}
core.info(`Cache saved with the key: ${primaryKey}`);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
core.warning(`Save ${entry.kind} cache failed: ${message}`);
} }
core.info(`Cache saved with the key: ${primaryKey}`);
}; };
function logWarning(message: string): void { function logWarning(message: string): void {
+23 -12
View File
@@ -3,9 +3,20 @@ import * as core from '@actions/core';
import * as exec from '@actions/exec'; import * as exec from '@actions/exec';
import { import {
supportedPackageManagers, supportedPackageManagers,
PackageManagerInfo PackageManagerInfo,
CacheKind
} from './package-managers.js'; } from './package-managers.js';
export interface CacheDirectory {
kind: CacheKind;
path: string;
}
export interface CacheEntry extends CacheDirectory {
primaryKey: string;
matchedKey?: string;
}
export const getCommandOutput = async (toolCommand: string) => { export const getCommandOutput = async (toolCommand: string) => {
let {stdout, stderr, exitCode} = await exec.getExecOutput( let {stdout, stderr, exitCode} = await exec.getExecOutput(
toolCommand, toolCommand,
@@ -36,24 +47,24 @@ export const getPackageManagerInfo = async (packageManager: string) => {
export const getCacheDirectoryPath = async ( export const getCacheDirectoryPath = async (
packageManagerInfo: PackageManagerInfo packageManagerInfo: PackageManagerInfo
) => { ): Promise<CacheDirectory[]> => {
const pathOutputs = await Promise.allSettled( const pathOutputs = await Promise.allSettled(
packageManagerInfo.cacheFolderCommandList.map(async command => packageManagerInfo.cacheFolderCommandList.map(async ({kind, command}) => ({
getCommandOutput(command) kind,
) path: await getCommandOutput(command)
}))
); );
const results = pathOutputs.map(item => { const cachePaths: CacheDirectory[] = [];
for (const item of pathOutputs) {
if (item.status === 'fulfilled') { if (item.status === 'fulfilled') {
return item.value; if (item.value.path) {
cachePaths.push(item.value);
}
} else { } else {
core.info(`[warning]getting cache directory path failed: ${item.reason}`); core.info(`[warning]getting cache directory path failed: ${item.reason}`);
} }
}
return '';
});
const cachePaths = results.filter(item => item);
if (!cachePaths.length) { if (!cachePaths.length) {
throw new Error(`Could not get cache folder paths.`); throw new Error(`Could not get cache folder paths.`);
+17 -3
View File
@@ -1,8 +1,22 @@
export enum State { export enum State {
CachePrimaryKey = 'CACHE_KEY', CacheEntries = 'CACHE_ENTRIES'
CacheMatchedKey = 'CACHE_RESULT'
} }
export enum Outputs { export enum Outputs {
CacheHit = 'cache-hit' CacheHit = 'cache-hit',
GoBinPath = 'go-bin-path'
} }
export const GO_ENV_OUTPUTS = [
'GOPATH',
'GOBIN',
'GOROOT',
'GOCACHE',
'GOMODCACHE',
'GOOS',
'GOARCH',
'GOTOOLDIR'
] as const;
export type GoEnvVar = (typeof GO_ENV_OUTPUTS)[number];
export type GoEnv = Partial<Record<GoEnvVar, string>>;
+39 -8
View File
@@ -60,6 +60,11 @@ export async function getGo(
const osPlat: string = os.platform(); const osPlat: string = os.platform();
const customBaseUrl = goDownloadBaseUrl?.replace(/\/+$/, ''); const customBaseUrl = goDownloadBaseUrl?.replace(/\/+$/, '');
const originalVersionSpec = versionSpec;
if (isGoNativeVersion(versionSpec)) {
versionSpec = makeSemver(versionSpec);
}
if ( if (
versionSpec === StableReleaseAlias.Stable || versionSpec === StableReleaseAlias.Stable ||
versionSpec === StableReleaseAlias.OldStable versionSpec === StableReleaseAlias.OldStable
@@ -123,8 +128,13 @@ export async function getGo(
? customToolCacheName(customBaseUrl) ? customToolCacheName(customBaseUrl)
: 'go'; : 'go';
// Convert prerelease specs (1.21rc2) to semver (1.21.0-rc.2).
const cacheSpec = /^\d+\.\d+(\.\d+)?(beta|rc)\d+$/.test(versionSpec)
? makeSemver(versionSpec)
: versionSpec;
// check cache // check cache
const toolPath = tc.find(toolCacheName, versionSpec, arch); const toolPath = tc.find(toolCacheName, cacheSpec, arch);
// If not found in cache, download // If not found in cache, download
if (toolPath) { if (toolPath) {
core.info(`Found in cache @ ${toolPath}`); core.info(`Found in cache @ ${toolPath}`);
@@ -146,7 +156,11 @@ export async function getGo(
core.info( core.info(
'Skipping version listing for known direct-download URL. Constructing download URL directly.' 'Skipping version listing for known direct-download URL. Constructing download URL directly.'
); );
info = getInfoFromDirectDownload(versionSpec, arch, customBaseUrl); info = getInfoFromDirectDownload(
originalVersionSpec,
arch,
customBaseUrl
);
} else { } else {
try { try {
info = await getInfoFromDist(versionSpec, arch, customBaseUrl); info = await getInfoFromDist(versionSpec, arch, customBaseUrl);
@@ -156,7 +170,11 @@ export async function getGo(
); );
} }
if (!info) { if (!info) {
info = getInfoFromDirectDownload(versionSpec, arch, customBaseUrl); info = getInfoFromDirectDownload(
originalVersionSpec,
arch,
customBaseUrl
);
} }
} }
@@ -167,13 +185,13 @@ export async function getGo(
const downloadUrl = info?.downloadUrl || customBaseUrl; const downloadUrl = info?.downloadUrl || customBaseUrl;
if (err instanceof tc.HTTPError && err.httpStatusCode === 404) { if (err instanceof tc.HTTPError && err.httpStatusCode === 404) {
throw new Error( throw new Error(
`The requested Go version ${versionSpec} is not available for platform ${osPlat}/${arch}. ` + `The requested Go version ${originalVersionSpec} is not available for platform ${osPlat}/${arch}. ` +
`Download URL returned HTTP 404: ${downloadUrl}`, `Download URL returned HTTP 404: ${downloadUrl}`,
{cause: err} {cause: err}
); );
} }
throw new Error( throw new Error(
`Failed to download Go ${versionSpec} for platform ${osPlat}/${arch} ` + `Failed to download Go ${originalVersionSpec} for platform ${osPlat}/${arch} ` +
`from ${downloadUrl}: ${err}`, `from ${downloadUrl}: ${err}`,
{cause: err} {cause: err}
); );
@@ -585,7 +603,10 @@ export async function findMatch(
const version = makeSemver(candidate.version); const version = makeSemver(candidate.version);
core.debug(`check ${version} satisfies ${versionSpec}`); core.debug(`check ${version} satisfies ${versionSpec}`);
if (semver.satisfies(version, versionSpec)) { if (
candidate.version.replace(/^go/, '') === versionSpec ||
semver.satisfies(version, versionSpec)
) {
goFile = candidate.files.find(file => { goFile = candidate.files.find(file => {
core.debug( core.debug(
`${file.arch}===${archFilter} && ${file.os}===${platFilter}` `${file.arch}===${archFilter} && ${file.os}===${platFilter}`
@@ -610,6 +631,12 @@ export async function findMatch(
return result; return result;
} }
export function isGoNativeVersion(version: string): boolean {
const expression =
/^go[1-9]\d*\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*)|(?:beta|rc)[1-9]\d*)?$/;
return expression.test(version);
}
// //
// Convert the go version syntax into semver for semver matching // Convert the go version syntax into semver for semver matching
// 1.13.1 => 1.13.1 // 1.13.1 => 1.13.1
@@ -617,6 +644,10 @@ export async function findMatch(
// 1.10beta1 => 1.10.0-beta.1, 1.10rc1 => 1.10.0-rc.1 // 1.10beta1 => 1.10.0-beta.1, 1.10rc1 => 1.10.0-rc.1
// 1.8.5beta1 => 1.8.5-beta.1, 1.8.5rc1 => 1.8.5-rc.1 // 1.8.5beta1 => 1.8.5-beta.1, 1.8.5rc1 => 1.8.5-rc.1
export function makeSemver(version: string): string { export function makeSemver(version: string): string {
const validVersion = semver.valid(version);
if (validVersion) {
return validVersion;
}
version = version.replace('go', ''); version = version.replace('go', '');
version = version.replace('beta', '-beta.').replace('rc', '-rc.'); version = version.replace('beta', '-beta.').replace('rc', '-rc.');
const parts = version.split('-'); const parts = version.split('-');
@@ -654,7 +685,7 @@ export function parseGoVersionFile(versionFilePath: string): string {
if (process.env[GOTOOLCHAIN_ENV_VAR] !== GOTOOLCHAIN_LOCAL_VAL) { if (process.env[GOTOOLCHAIN_ENV_VAR] !== GOTOOLCHAIN_LOCAL_VAL) {
// toolchain directive: https://go.dev/ref/mod#go-mod-file-toolchain // toolchain directive: https://go.dev/ref/mod#go-mod-file-toolchain
const matchToolchain = contents.match( const matchToolchain = contents.match(
/^toolchain go(1\.\d+(?:\.\d+|rc\d+)?)/m /^toolchain go(1\.\d+(?:\.\d+|(beta|rc)\d+)?)/m
); );
if (matchToolchain) { if (matchToolchain) {
return matchToolchain[1]; return matchToolchain[1];
@@ -662,7 +693,7 @@ export function parseGoVersionFile(versionFilePath: string): string {
} }
// go directive: https://go.dev/ref/mod#go-mod-file-go // go directive: https://go.dev/ref/mod#go-mod-file-go
const matchGo = contents.match(/^go (\d+(\.\d+)*)/m); const matchGo = contents.match(/^go (\d+(\.\d+)*(?:\.\d+|(beta|rc)\d+)?)/m);
return matchGo ? matchGo[1] : ''; return matchGo ? matchGo[1] : '';
} else if (path.basename(versionFilePath) === '.tool-versions') { } else if (path.basename(versionFilePath) === '.tool-versions') {
const match = contents.match(/^golang\s+([^\n#]+)/m); const match = contents.match(/^golang\s+([^\n#]+)/m);
+96 -32
View File
@@ -10,6 +10,7 @@ import cp from 'child_process';
import fs from 'fs'; import fs from 'fs';
import os from 'os'; import os from 'os';
import {Architecture} from './types.js'; import {Architecture} from './types.js';
import {GO_ENV_OUTPUTS, GoEnv, Outputs} from './constants.js';
export async function run() { export async function run() {
try { try {
@@ -21,7 +22,6 @@ export async function run() {
setGoToolchain(); setGoToolchain();
const cache = core.getBooleanInput('cache'); const cache = core.getBooleanInput('cache');
core.info(`Setup go version spec ${versionSpec}`);
let arch = core.getInput('architecture') as Architecture; let arch = core.getInput('architecture') as Architecture;
@@ -30,41 +30,48 @@ export async function run() {
} }
if (versionSpec) { if (versionSpec) {
const token = core.getInput('token'); core.startGroup('Installed version');
const auth = !token ? undefined : `token ${token}`; try {
core.info(`Setup go version spec ${versionSpec}`);
const checkLatest = core.getBooleanInput('check-latest'); const token = core.getInput('token');
const auth = !token ? undefined : `token ${token}`;
const goDownloadBaseUrl = const checkLatest = core.getBooleanInput('check-latest');
core.getInput('go-download-base-url') ||
process.env['GO_DOWNLOAD_BASE_URL'] ||
undefined;
if (goDownloadBaseUrl) { const goDownloadBaseUrl =
core.info(`Using custom Go download base URL: ${goDownloadBaseUrl}`); core.getInput('go-download-base-url') ||
process.env['GO_DOWNLOAD_BASE_URL'] ||
undefined;
if (goDownloadBaseUrl) {
core.info(`Using custom Go download base URL: ${goDownloadBaseUrl}`);
}
const installDir = await installer.getGo(
versionSpec,
checkLatest,
auth,
arch,
goDownloadBaseUrl
);
const installDirVersion = path.basename(path.dirname(installDir));
core.addPath(path.join(installDir, 'bin'));
core.info('Added go to the path');
const version = installer.makeSemver(installDirVersion);
// Go versions less than 1.9 require GOROOT to be set
if (semver.lt(version, '1.9.0')) {
core.info('Setting GOROOT for Go version < 1.9');
core.exportVariable('GOROOT', installDir);
}
core.info(`Successfully set up Go version ${versionSpec}`);
} finally {
core.endGroup();
} }
const installDir = await installer.getGo(
versionSpec,
checkLatest,
auth,
arch,
goDownloadBaseUrl
);
const installDirVersion = path.basename(path.dirname(installDir));
core.addPath(path.join(installDir, 'bin'));
core.info('Added go to the path');
const version = installer.makeSemver(installDirVersion);
// Go versions less than 1.9 require GOROOT to be set
if (semver.lt(version, '1.9.0')) {
core.info('Setting GOROOT for Go version < 1.9');
core.exportVariable('GOROOT', installDir);
}
core.info(`Successfully set up Go version ${versionSpec}`);
} else { } else {
core.info( core.info(
'[warning]go-version input was not specified. The action will try to use pre-installed version.' '[warning]go-version input was not specified. The action will try to use pre-installed version.'
@@ -76,6 +83,11 @@ export async function run() {
const goPath = await io.which('go'); const goPath = await io.which('go');
const goVersion = (cp.execSync(`${goPath} version`) || '').toString(); const goVersion = (cp.execSync(`${goPath} version`) || '').toString();
const goEnvJson = readGoEnv(goPath);
if (goEnvJson) {
setGoEnvOutputs(goEnvJson);
}
if (cache && isCacheFeatureAvailable()) { if (cache && isCacheFeatureAvailable()) {
const packageManager = 'default'; const packageManager = 'default';
@@ -113,6 +125,46 @@ export async function run() {
} }
} }
export function readGoEnv(goPath: string): GoEnv | undefined {
try {
const rawGoEnv = cp.execFileSync(goPath, ['env', '-json'], {
encoding: 'utf8',
stdio: ['ignore', 'pipe', 'pipe']
});
const parsed: unknown = JSON.parse(rawGoEnv);
if (
typeof parsed !== 'object' ||
parsed === null ||
Array.isArray(parsed)
) {
throw new Error("'go env -json' did not return a JSON object");
}
return parsed as GoEnv;
} catch (error) {
core.info(
`Unable to read 'go env -json', the Go environment outputs will not be set: ${
(error as Error).message
}`
);
return undefined;
}
}
export function setGoEnvOutputs(goEnv: GoEnv): void {
for (const name of GO_ENV_OUTPUTS) {
core.setOutput(name, goEnv[name] ?? '');
}
core.setOutput(Outputs.GoBinPath, goEnv.GOBIN || goPathBin(goEnv));
}
function goPathBin(goEnv: GoEnv): string {
const goPath = (goEnv.GOPATH ?? '').split(path.delimiter)[0];
return goPath ? path.join(goPath, 'bin') : '';
}
export async function addBinToPath(): Promise<boolean> { export async function addBinToPath(): Promise<boolean> {
let added = false; let added = false;
const g = await io.which('go'); const g = await io.which('go');
@@ -163,6 +215,18 @@ function resolveVersionInput(): string {
} }
if (version) { if (version) {
const customBaseUrl =
core.getInput('go-download-base-url') ||
process.env['GO_DOWNLOAD_BASE_URL'];
if (
version.startsWith('go') &&
!customBaseUrl &&
!installer.isGoNativeVersion(version)
) {
throw new Error(
`Invalid Go version "${version}". Go-native versions must look like go1.21, go1.21.5, go1.18beta2, or go1.21rc2. For version ranges, use SemVer syntax (e.g. ~1.21, ^1.21).`
);
}
return version; return version;
} }
+7 -2
View File
@@ -2,14 +2,19 @@ type SupportedPackageManagers = {
[prop: string]: PackageManagerInfo; [prop: string]: PackageManagerInfo;
}; };
export type CacheKind = 'modules' | 'build';
export interface PackageManagerInfo { export interface PackageManagerInfo {
dependencyFilePattern: string; dependencyFilePattern: string;
cacheFolderCommandList: string[]; cacheFolderCommandList: {kind: CacheKind; command: string}[];
} }
export const supportedPackageManagers: SupportedPackageManagers = { export const supportedPackageManagers: SupportedPackageManagers = {
default: { default: {
dependencyFilePattern: 'go.mod', dependencyFilePattern: 'go.mod',
cacheFolderCommandList: ['go env GOMODCACHE', 'go env GOCACHE'] cacheFolderCommandList: [
{kind: 'modules', command: 'go env GOMODCACHE'},
{kind: 'build', command: 'go env GOCACHE'}
]
} }
}; };