Compare commits

..
Author SHA1 Message Date
github-actions[bot] 6cd31b3efb Update configuration files 2026-07-12 04:11:08 +00:00
66 changed files with 102772 additions and 115127 deletions
+6
View File
@@ -0,0 +1,6 @@
# Ignore list
/*
# Do not ignore these folders:
!__tests__/
!src/
+51
View File
@@ -0,0 +1,51 @@
// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:eslint-plugin-jest/recommended',
'eslint-config-prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'eslint-plugin-node', 'eslint-plugin-jest'],
rules: {
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description'
}
],
'no-console': 'error',
'yoda': 'error',
'prefer-const': [
'error',
{
destructuring: 'all'
}
],
'no-control-regex': 'off',
'no-constant-condition': ['error', {checkLoops: false}],
'node/no-extraneous-import': 'error'
},
overrides: [
{
files: ['**/*{test,spec}.ts'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'jest/no-standalone-expect': 'off',
'jest/no-conditional-expect': 'off',
'no-console': 'off',
}
}
],
env: {
node: true,
es6: true,
'jest/globals': true
}
};
+4 -4
View File
@@ -20,7 +20,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
go-version: ['1.25', '1.24']
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: Setup Microsoft build of Go ${{ matrix.go-version }}
uses: ./
@@ -59,7 +59,7 @@ jobs:
env:
GO_DOWNLOAD_BASE_URL: 'https://aka.ms/golang/release/latest'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: Setup Microsoft build of Go via environment variable
uses: ./
@@ -95,7 +95,7 @@ jobs:
- os: macos-latest
architecture: arm64
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: Setup Microsoft build of Go with architecture
uses: ./
@@ -116,7 +116,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: Setup Microsoft build of Go with caching
uses: ./
@@ -14,7 +14,7 @@ jobs:
steps:
- name: Checking out
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@v6
- name: Publish
id: publish
uses: actions/publish-immutable-action@v0.0.4
+26 -51
View File
@@ -18,9 +18,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: Setup Go Stable
uses: ./
with:
@@ -33,9 +33,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: Setup Go oldStable
uses: ./
with:
@@ -43,46 +43,21 @@ jobs:
- name: Verify Go
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:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
version: [stable, oldstable]
architecture: [x64, x32]
exclude:
- os: macos-latest
architecture: x32
- os: macos-15-intel
- os: macos-latest-large
architecture: x32
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: Setup Go ${{ matrix.version }} ${{ matrix.architecture }}
uses: ./
with:
@@ -97,7 +72,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest, macos-15-intel]
os: [macos-latest, windows-latest, ubuntu-latest, macos-latest-large]
go: [1.21.13, 1.22.8, 1.23.2]
include:
- os: windows-latest
@@ -107,7 +82,7 @@ jobs:
go: 1.23.2
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@v6
- name: setup-go ${{ matrix.go }}
uses: ./
@@ -123,10 +98,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
go-version: ['1.20', '1.21', '1.22', '1.23']
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: Setup Go and check latest
uses: ./
with:
@@ -140,9 +115,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: Setup Go and check latest
uses: ./
with:
@@ -156,9 +131,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: Setup Go and check latest
uses: ./
with:
@@ -172,9 +147,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: Setup Go and check latest
uses: ./
with:
@@ -188,9 +163,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: Setup Go from .go-version file
uses: ./
with:
@@ -204,11 +179,11 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest, macos-15-intel]
os: [macos-latest, windows-latest, ubuntu-latest, macos-latest-large]
go: [1.20.14, 1.21.10, 1.22.8, 1.23.2]
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@v6
- name: setup-go ${{ matrix.go }}
uses: ./
@@ -224,11 +199,11 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-15-intel]
os: [windows-latest, ubuntu-latest, macos-latest-large]
go: [1.11.12]
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@v6
- name: setup-go ${{ matrix.go }}
uses: ./
@@ -244,7 +219,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-15-intel]
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
go-version: [1.20.14, 1.21, 1.22, 1.23]
include:
- os: macos-latest
@@ -253,10 +228,10 @@ jobs:
architecture: x64
- os: windows-latest
architecture: x64
- os: macos-15-intel
- os: macos-latest-large
architecture: x64
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: Setup Go and check latest
uses: ./
with:
+3 -3
View File
@@ -19,7 +19,7 @@ jobs:
cache: [false, true]
go: [1.20.1]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: 'Setup ${{ matrix.cache }}, cache: ${{ matrix.go }}'
uses: ./
@@ -88,7 +88,7 @@ jobs:
matrix:
cache: [false, true]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: 'Setup default go, cache: ${{ matrix.cache }}'
uses: ./
@@ -121,7 +121,7 @@ jobs:
cache: [false]
go: [1.20.1]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v6
- name: 'Setup ${{ matrix.go }}, cache: ${{ matrix.cache }}'
uses: ./
+1 -4
View File
@@ -10,10 +10,7 @@ allowed:
- cc0-1.0
- unlicense
- 0bsd
- blueoak-1.0.0
reviewed:
npm:
- "@actions/http-client"
- "balanced-match"
- "brace-expansion"
- "@actions/http-client"
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: "@actions/cache"
version: 6.3.0
version: 5.1.0
type: npm
summary: Actions cache lib
homepage: https://github.com/actions/toolkit/tree/main/packages/cache
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: "@actions/core"
version: 3.0.1
version: 2.0.3
type: npm
summary: Actions core lib
homepage: https://github.com/actions/toolkit/tree/main/packages/core
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: "@actions/exec"
version: 3.0.0
version: 2.0.0
type: npm
summary: Actions exec lib
homepage: https://github.com/actions/toolkit/tree/main/packages/exec
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: "@actions/glob"
version: 0.7.0
version: 0.5.1
type: npm
summary: Actions glob lib
homepage: https://github.com/actions/toolkit/tree/main/packages/glob
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: "@actions/http-client"
version: 4.0.1
version: 3.0.2
type: npm
summary: Actions Http Client
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: "@actions/io"
version: 3.0.2
version: 2.0.0
type: npm
summary: Actions io lib
homepage: https://github.com/actions/toolkit/tree/main/packages/io
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: "@actions/tool-cache"
version: 4.0.0
version: 3.0.1
type: npm
summary: Actions tool-cache lib
homepage: https://github.com/actions/toolkit/tree/main/packages/tool-cache
@@ -1,17 +1,16 @@
---
name: xml-naming
version: 0.3.0
name: "@azure/abort-controller"
version: 1.1.0
type: npm
summary: Validates XML name productions — Name, NCName, QName, NMToken, NMTokens —
for XML 1.0 and 1.1
homepage:
summary: Microsoft Azure SDK for JavaScript - Aborter
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/abort-controller/README.md
license: mit
licenses:
- sources: LICENSE
text: |
MIT License
The MIT License (MIT)
Copyright (c) 2026 Natural Intelligence
Copyright (c) 2020 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +29,4 @@ licenses:
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: []
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: "@azure/core-client"
version: 1.10.2
version: 1.10.1
type: npm
summary: Core library for interfacing with AutoRest generated code
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-client/
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: "@azure/core-http-compat"
version: 2.4.0
version: 2.3.1
type: npm
summary: Core HTTP Compatibility Library to bridge the gap between Core V1 & V2 packages.
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-compat/
+2 -2
View File
@@ -1,9 +1,9 @@
---
name: "@azure/core-rest-pipeline"
version: 1.23.0
version: 1.22.2
type: npm
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/blob/main/sdk/core/core-rest-pipeline/
license: mit
licenses:
- sources: LICENSE
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: "@azure/core-xml"
version: 1.5.1
version: 1.5.0
type: npm
summary: Core library for interacting with XML payloads
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-xml/
+2 -2
View File
@@ -1,9 +1,9 @@
---
name: "@azure/storage-blob"
version: 12.31.0
version: 12.29.1
type: npm
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/blob/main/sdk/storage/storage-blob/
license: mit
licenses:
- sources: LICENSE
+2 -2
View File
@@ -1,9 +1,9 @@
---
name: "@azure/storage-common"
version: 12.4.0
version: 12.1.1
type: npm
summary: Azure Storage Common Client Library for JavaScript
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-common/README.md
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-internal-avro/
license: mit
licenses:
- sources: LICENSE
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: "@nodable/entities"
version: 3.0.0
version: 2.2.0
type: npm
summary: Entity parser for XML, HTML, External entites with security and NCR control
homepage:
+2 -2
View File
@@ -1,9 +1,9 @@
---
name: "@typespec/ts-http-runtime"
version: 0.3.6
version: 0.3.2
type: npm
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/ts-http-runtime/README.md
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/ts-http-runtime/
license: mit
licenses:
- sources: LICENSE
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: anynum
version: 1.0.1
version: 1.0.0
type: npm
summary: Normalize all Unicode decimal digits (Devanagari, Arabic, Thai, etc.) to
ASCII numerals. Zero dependencies, performance-first.
+26 -5
View File
@@ -1,18 +1,39 @@
---
name: balanced-match
version: 4.0.4
version: 1.0.2
type: npm
summary: Match balanced character pairs, like "{" and "}"
homepage:
license: other
homepage: https://github.com/juliangruber/balanced-match
license: mit
licenses:
- sources: LICENSE.md
text: |
(MIT)
Original code Copyright Julian Gruber <julian@juliangruber.com>
Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
Port to TypeScript Copyright Isaac Z. Schlueter <i@izs.me>
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
+27 -6
View File
@@ -1,18 +1,16 @@
---
name: brace-expansion
version: 5.0.9
version: 1.1.13
type: npm
summary: Brace expansion as known from sh/bash
homepage:
license: other
homepage: https://github.com/juliangruber/brace-expansion
license: mit
licenses:
- sources: LICENSE
text: |
MIT License
Copyright Julian Gruber <julian@juliangruber.com>
TypeScript port Copyright Isaac Z. Schlueter <i@izs.me>
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
@@ -24,6 +22,29 @@ licenses:
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
+31
View File
@@ -0,0 +1,31 @@
---
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
version: 5.10.1
version: 5.8.0
type: npm
summary: Validate XML, Parse XML, Build XML without C/C++ based libraries
homepage:
-35
View File
@@ -1,35 +0,0 @@
---
name: is-unsafe
version: 2.0.0
type: npm
summary: Zero-dependency, DOM-free, pure predicate for detecting unsafe strings across
HTML, XML, SVG, SQL, SHELL, and REGEX contexts
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: []
+15 -55
View File
@@ -1,66 +1,26 @@
---
name: minimatch
version: 10.2.5
version: 3.1.5
type: npm
summary: a glob matcher in javascript
homepage:
license: blueoak-1.0.0
license: isc
licenses:
- sources: LICENSE.md
- sources: LICENSE
text: |
# Blue Oak Model License
The ISC License
Version 1.0.0
Copyright (c) Isaac Z. Schlueter and Contributors
## Purpose
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.
This license gives everyone as much permission to work with
this software as possible, while protecting contributors
from liability.
## Acceptance
In order to receive this license, you must agree to its
rules. The rules of this license are both obligations
under that agreement and conditions to your license.
You must not do anything with this software that triggers
a rule that you cannot or will not follow.
## Copyright
Each contributor licenses you to do everything with this
software that would otherwise infringe that contributor's
copyright in it.
## Notices
You must ensure that everyone who gets a copy of
any part of this software from you, with or without
changes, also gets the text of this license or a link to
<https://blueoakcouncil.org/license/1.0.0>.
## Excuse
If anyone notifies you in writing that you have not
complied with [Notices](#notices), you can keep your
license by taking all practical steps to comply within 30
days after the notice. If you do not do so, your license
ends immediately.
## Patent
Each contributor licenses you to do everything with this
software that would otherwise infringe any patent claims
they can license or become able to license.
## Reliability
No contributor can revoke this license.
## No Liability
**_As far as the law allows, this software comes as is,
without any warranty or condition, and no contributor
will be liable to anyone for any damages related to this
software or this license, under any kind of legal claim._**
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
version: 1.6.2
version: 1.5.0
type: npm
summary: Efficient path tracking and pattern matching for XML/JSON parsers
homepage: https://github.com/NaturalIntelligence/path-expression-matcher#readme
+26
View File
@@ -0,0 +1,26 @@
---
name: semver
version: 6.3.1
type: npm
summary: The semantic version parser used by npm.
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: strnum
version: 2.4.1
version: 2.4.0
type: npm
summary: Parse String to Number based on configuration
homepage:
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: undici
version: 6.28.0
version: 6.27.0
type: npm
summary: An HTTP/1.1 client, written from scratch for Node.js
homepage: https://undici.nodejs.org
+11
View File
@@ -0,0 +1,11 @@
// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
module.exports = {
printWidth: 80,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: true,
trailingComma: 'none',
bracketSpacing: false,
arrowParens: 'avoid'
};
+3 -10
View File
@@ -9,12 +9,6 @@ This action sets up a Go environment for use in GitHub Actions by:
- Optionally caching Go modules and build outputs
- Registering problem matchers for error output
## What's new in V7
The V7 edition of the action includes:
- Migrated action internals to ESM for compatibility with latest `@actions/*` packages. No changes to action inputs, outputs, or behavior.
## Breaking changes in V6
The V6 edition of the action includes:
@@ -35,7 +29,7 @@ See [action.yml](action.yml).
<!-- start usage -->
```yaml
- uses: actions/setup-go@v7
- uses: actions/setup-go@v6
with:
# Version or version range of Go to use
go-version: '1.23'
@@ -70,8 +64,8 @@ See [action.yml](action.yml).
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.25' # The Go version to download (if necessary) and use.
- run: go run hello.go
@@ -94,7 +88,6 @@ the [check-latest input](docs/advanced-usage.md#check-latest-version).
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`
- 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`
- Aliases: `stable`, `oldstable`
- Wildcards: `1.25.x`, `1.x`
+16 -67
View File
@@ -1,65 +1,18 @@
import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals';
import * as cache from '@actions/cache';
import * as core from '@actions/core';
import * as glob from '@actions/glob';
import fs from 'fs';
jest.unstable_mockModule('@actions/cache', () => ({
saveCache: jest.fn(),
restoreCache: jest.fn(),
isFeatureAvailable: jest.fn()
}));
jest.unstable_mockModule('@actions/glob', () => ({
create: jest.fn(),
hashFiles: jest.fn()
}));
jest.unstable_mockModule('@actions/core', () => ({
info: jest.fn(),
warning: jest.fn(),
debug: jest.fn(),
error: jest.fn(),
notice: jest.fn(),
setFailed: jest.fn(),
setOutput: jest.fn(),
getInput: jest.fn(),
getBooleanInput: jest.fn(),
getMultilineInput: jest.fn(),
addPath: jest.fn(),
exportVariable: jest.fn(),
saveState: jest.fn(),
getState: jest.fn(),
setSecret: jest.fn(),
isDebug: jest.fn(() => false),
startGroup: jest.fn(),
endGroup: jest.fn(),
group: jest.fn((_name: string, fn: () => Promise<unknown>) => fn()),
toPlatformPath: jest.fn((p: string) => p),
toWin32Path: jest.fn((p: string) => p),
toPosixPath: jest.fn((p: string) => p)
}));
// 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 core = await import('@actions/core');
const glob = await import('@actions/glob');
const cacheRestore = await import('../src/cache-restore.js');
const cacheUtils = await import('../src/cache-utils.js');
import type {PackageManagerInfo} from '../src/package-managers.js';
import * as cacheRestore from '../src/cache-restore';
import * as cacheUtils from '../src/cache-utils';
import {PackageManagerInfo} from '../src/package-managers';
describe('restoreCache', () => {
let hashFilesSpy: jest.Mock<typeof glob.hashFiles>;
let getCacheDirectoryPathSpy: jest.Mock<
typeof cacheUtils.getCacheDirectoryPath
>;
let restoreCacheSpy: jest.Mock<typeof cache.restoreCache>;
let infoSpy: jest.Mock<typeof core.info>;
let setOutputSpy: jest.Mock<typeof core.setOutput>;
let hashFilesSpy: jest.SpyInstance;
let getCacheDirectoryPathSpy: jest.SpyInstance;
let restoreCacheSpy: jest.SpyInstance;
let infoSpy: jest.SpyInstance;
let setOutputSpy: jest.SpyInstance;
const versionSpec = '1.13.1';
const packageManager = 'default';
@@ -71,15 +24,11 @@ describe('restoreCache', () => {
originalWorkspace = process.env.GITHUB_WORKSPACE;
process.env.GITHUB_WORKSPACE = '/test/workspace';
//Arrange
hashFilesSpy = glob.hashFiles as jest.Mock<typeof glob.hashFiles>;
getCacheDirectoryPathSpy = cacheUtils.getCacheDirectoryPath as jest.Mock<
typeof cacheUtils.getCacheDirectoryPath
>;
restoreCacheSpy = cache.restoreCache as jest.Mock<
typeof cache.restoreCache
>;
infoSpy = core.info as jest.Mock<typeof core.info>;
setOutputSpy = core.setOutput as jest.Mock<typeof core.setOutput>;
hashFilesSpy = jest.spyOn(glob, 'hashFiles');
getCacheDirectoryPathSpy = jest.spyOn(cacheUtils, 'getCacheDirectoryPath');
restoreCacheSpy = jest.spyOn(cache, 'restoreCache');
infoSpy = jest.spyOn(core, 'info');
setOutputSpy = jest.spyOn(core, 'setOutput');
getCacheDirectoryPathSpy.mockImplementation(
(PackageManager: PackageManagerInfo) => {
+25 -62
View File
@@ -1,41 +1,10 @@
import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals';
import * as cache from '@actions/cache';
import * as core from '@actions/core';
import fs from 'fs';
jest.unstable_mockModule('@actions/cache', () => ({
saveCache: jest.fn(),
restoreCache: jest.fn(),
isFeatureAvailable: jest.fn()
}));
jest.unstable_mockModule('@actions/core', () => ({
info: jest.fn(),
warning: jest.fn(),
debug: jest.fn(),
error: jest.fn(),
setFailed: jest.fn(),
getInput: jest.fn(),
getBooleanInput: jest.fn(),
getState: jest.fn(),
saveState: jest.fn()
}));
const realFs = (await import('fs')).default;
const fsExports = {...realFs, existsSync: jest.fn()};
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 core = await import('@actions/core');
const fs = (await import('fs')).default;
const cacheUtils = await import('../src/cache-utils.js');
const {run} = await import('../src/cache-save.js');
const {State} = await import('../src/constants.js');
import {run} from '../src/cache-save';
import * as cacheUtils from '../src/cache-utils';
import {State} from '../src/constants';
describe('cache-save', () => {
const primaryKey = 'primary-key';
@@ -43,28 +12,24 @@ describe('cache-save', () => {
let primaryKeyValue: string;
let matchedKeyValue: string;
let getBooleanInputSpy: jest.Mock<typeof core.getBooleanInput>;
let getStateSpy: jest.Mock<typeof core.getState>;
let infoSpy: jest.Mock<typeof core.info>;
let warningSpy: jest.Mock<typeof core.warning>;
let debugSpy: jest.Mock<typeof core.debug>;
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>;
let getBooleanInputSpy: jest.SpyInstance;
let getStateSpy: jest.SpyInstance;
let infoSpy: jest.SpyInstance;
let warningSpy: jest.SpyInstance;
let debugSpy: jest.SpyInstance;
let setFailedSpy: jest.SpyInstance;
let saveCacheSpy: jest.SpyInstance;
let getCacheDirectoryPathSpy: jest.SpyInstance;
let existsSpy: jest.SpyInstance;
beforeEach(() => {
primaryKeyValue = primaryKey;
matchedKeyValue = 'matched-key';
getBooleanInputSpy = core.getBooleanInput as jest.Mock<
typeof core.getBooleanInput
>;
getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
getBooleanInputSpy.mockReturnValue(true);
getStateSpy = core.getState as jest.Mock<typeof core.getState>;
getStateSpy = jest.spyOn(core, 'getState');
getStateSpy.mockImplementation((key: string) => {
if (key === State.CachePrimaryKey) {
return primaryKeyValue;
@@ -75,34 +40,32 @@ describe('cache-save', () => {
return '';
});
infoSpy = core.info as jest.Mock<typeof core.info>;
infoSpy = jest.spyOn(core, 'info');
infoSpy.mockImplementation(() => undefined);
warningSpy = core.warning as jest.Mock<typeof core.warning>;
warningSpy = jest.spyOn(core, 'warning');
warningSpy.mockImplementation(() => undefined);
debugSpy = core.debug as jest.Mock<typeof core.debug>;
debugSpy = jest.spyOn(core, 'debug');
debugSpy.mockImplementation(() => undefined);
setFailedSpy = core.setFailed as jest.Mock<typeof core.setFailed>;
setFailedSpy = jest.spyOn(core, 'setFailed');
setFailedSpy.mockImplementation(() => undefined);
saveCacheSpy = cache.saveCache as jest.Mock<typeof cache.saveCache>;
saveCacheSpy = jest.spyOn(cache, 'saveCache');
saveCacheSpy.mockImplementation(() => Promise.resolve(0));
getCacheDirectoryPathSpy = cacheUtils.getCacheDirectoryPath as jest.Mock<
typeof cacheUtils.getCacheDirectoryPath
>;
getCacheDirectoryPathSpy = jest.spyOn(cacheUtils, 'getCacheDirectoryPath');
getCacheDirectoryPathSpy.mockImplementation(() =>
Promise.resolve(['cache_directory_path', 'cache_directory_path'])
);
existsSpy = fs.existsSync as jest.Mock<typeof fs.existsSync>;
existsSpy = jest.spyOn(fs, 'existsSync');
existsSpy.mockImplementation(() => true);
});
afterEach(() => {
jest.clearAllMocks();
jest.restoreAllMocks();
});
it('does not save cache when the cache input is false', async () => {
+39 -68
View File
@@ -1,60 +1,22 @@
import {jest, describe, it, expect, beforeEach, afterAll} from '@jest/globals';
jest.unstable_mockModule('@actions/exec', () => ({
exec: jest.fn(),
getExecOutput: jest.fn()
}));
jest.unstable_mockModule('@actions/cache', () => ({
saveCache: jest.fn(),
restoreCache: jest.fn(),
isFeatureAvailable: jest.fn()
}));
jest.unstable_mockModule('@actions/core', () => ({
info: jest.fn(),
warning: jest.fn(),
debug: jest.fn(),
error: jest.fn(),
notice: jest.fn(),
setFailed: jest.fn(),
setOutput: jest.fn(),
getInput: jest.fn(),
getBooleanInput: jest.fn(),
getMultilineInput: jest.fn(),
addPath: jest.fn(),
exportVariable: jest.fn(),
saveState: jest.fn(),
getState: jest.fn(),
setSecret: jest.fn(),
isDebug: jest.fn(() => false),
startGroup: jest.fn(),
endGroup: jest.fn(),
group: jest.fn((_name: string, fn: () => Promise<unknown>) => fn()),
toPlatformPath: jest.fn((p: string) => p),
toWin32Path: jest.fn((p: string) => p),
toPosixPath: jest.fn((p: string) => p)
}));
const exec = await import('@actions/exec');
const cache = await import('@actions/cache');
const core = await import('@actions/core');
const cacheUtils = await import('../src/cache-utils.js');
import type {PackageManagerInfo} from '../src/package-managers.js';
import * as exec from '@actions/exec';
import * as cache from '@actions/cache';
import * as core from '@actions/core';
import * as cacheUtils from '../src/cache-utils';
import {PackageManagerInfo} from '../src/package-managers';
describe('getCommandOutput', () => {
//Arrange
const getExecOutputSpy = exec.getExecOutput as jest.Mock<
typeof exec.getExecOutput
>;
const getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
it('should return trimmed stdout in case of successful exit code', async () => {
//Arrange
const stdoutResult = ' stdout ';
const trimmedStdout = stdoutResult.trim();
getExecOutputSpy.mockImplementation(async (commandLine: string) => {
return {exitCode: 0, stdout: stdoutResult, stderr: ''};
getExecOutputSpy.mockImplementation((commandLine: string) => {
return new Promise<exec.ExecOutput>(resolve => {
resolve({exitCode: 0, stdout: stdoutResult, stderr: ''});
});
});
//Act + Assert
@@ -67,8 +29,10 @@ describe('getCommandOutput', () => {
//Arrange
const stderrResult = 'error message';
getExecOutputSpy.mockImplementation(async (commandLine: string) => {
return {exitCode: 10, stdout: '', stderr: stderrResult};
getExecOutputSpy.mockImplementation((commandLine: string) => {
return new Promise<exec.ExecOutput>(resolve => {
resolve({exitCode: 10, stdout: '', stderr: stderrResult});
});
});
//Act + Assert
@@ -106,9 +70,7 @@ describe('getPackageManagerInfo', () => {
describe('getCacheDirectoryPath', () => {
//Arrange
const getExecOutputSpy = exec.getExecOutput as jest.Mock<
typeof exec.getExecOutput
>;
const getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
const validPackageManager: PackageManagerInfo = {
dependencyFilePattern: 'go.mod',
@@ -117,8 +79,10 @@ describe('getCacheDirectoryPath', () => {
it('should return path to the cache folders which specified package manager uses', async () => {
//Arrange
getExecOutputSpy.mockImplementation(async (commandLine: string) => {
return {exitCode: 0, stdout: 'path/to/cache/folder', stderr: ''};
getExecOutputSpy.mockImplementation((commandLine: string) => {
return new Promise<exec.ExecOutput>(resolve => {
resolve({exitCode: 0, stdout: 'path/to/cache/folder', stderr: ''});
});
});
const expectedResult = ['path/to/cache/folder', 'path/to/cache/folder'];
@@ -131,12 +95,16 @@ describe('getCacheDirectoryPath', () => {
it('should return path to the cache folder if one command return empty str', async () => {
//Arrange
getExecOutputSpy.mockImplementationOnce(async (commandLine: string) => {
return {exitCode: 0, stdout: 'path/to/cache/folder', stderr: ''};
getExecOutputSpy.mockImplementationOnce((commandLine: string) => {
return new Promise<exec.ExecOutput>(resolve => {
resolve({exitCode: 0, stdout: 'path/to/cache/folder', stderr: ''});
});
});
getExecOutputSpy.mockImplementationOnce(async (commandLine: string) => {
return {exitCode: 0, stdout: '', stderr: ''};
getExecOutputSpy.mockImplementationOnce((commandLine: string) => {
return new Promise<exec.ExecOutput>(resolve => {
resolve({exitCode: 0, stdout: '', stderr: ''});
});
});
const expectedResult = ['path/to/cache/folder'];
@@ -148,8 +116,10 @@ describe('getCacheDirectoryPath', () => {
});
it('should throw if the both commands return empty str', async () => {
getExecOutputSpy.mockImplementation(async (commandLine: string) => {
return {exitCode: 10, stdout: '', stderr: ''};
getExecOutputSpy.mockImplementation((commandLine: string) => {
return new Promise<exec.ExecOutput>(resolve => {
resolve({exitCode: 10, stdout: '', stderr: ''});
});
});
//Act + Assert
@@ -159,8 +129,10 @@ describe('getCacheDirectoryPath', () => {
});
it('should throw if the specified package name is invalid', async () => {
getExecOutputSpy.mockImplementation(async (commandLine: string) => {
return {exitCode: 10, stdout: '', stderr: 'Error message'};
getExecOutputSpy.mockImplementation((commandLine: string) => {
return new Promise<exec.ExecOutput>(resolve => {
resolve({exitCode: 10, stdout: '', stderr: 'Error message'});
});
});
//Act + Assert
@@ -172,10 +144,8 @@ describe('getCacheDirectoryPath', () => {
describe('isCacheFeatureAvailable', () => {
//Arrange
const isFeatureAvailableSpy = cache.isFeatureAvailable as jest.Mock<
typeof cache.isFeatureAvailable
>;
const warningSpy = core.warning as jest.Mock<typeof core.warning>;
const isFeatureAvailableSpy = jest.spyOn(cache, 'isFeatureAvailable');
const warningSpy = jest.spyOn(core, 'warning');
it('should return true when cache feature is available', () => {
//Arrange
@@ -241,9 +211,10 @@ describe('isCacheFeatureAvailable', () => {
});
describe('isGhes', () => {
const pristineEnv = {...process.env};
const pristineEnv = process.env;
beforeEach(() => {
jest.resetModules();
process.env = {...pristineEnv};
});
-177
View File
@@ -1,181 +1,4 @@
[
{
"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",
"stable": true,
+82 -509
View File
@@ -1,101 +1,17 @@
import {
jest,
describe,
it,
expect,
beforeAll,
beforeEach,
afterEach,
afterAll
} from '@jest/globals';
import * as core from '@actions/core';
import * as io from '@actions/io';
import * as tc from '@actions/tool-cache';
import fs from 'fs';
import cp from 'child_process';
import osm, {type} from 'os';
import path from 'path';
import * as main from '../src/main';
import * as im from '../src/installer';
import * as httpm from '@actions/http-client';
import goJsonData from './data/golang-dl.json' with {type: 'json'};
import matchers from '../matchers.json' with {type: 'json'};
import goTestManifest from './data/versions-manifest.json' with {type: 'json'};
import type {IGoVersion} from '../src/installer.js';
import type {IToolRelease} from '@actions/tool-cache';
import {GO_ENV_OUTPUTS} from '../src/constants.js';
const httpClientGetJson = jest.fn();
const realCore = await import('@actions/core');
jest.unstable_mockModule('@actions/core', () => ({
...realCore,
getInput: jest.fn(),
getBooleanInput: jest.fn(),
info: jest.fn(),
debug: jest.fn(),
warning: jest.fn(),
setOutput: jest.fn(),
exportVariable: jest.fn()
}));
const realOs = (await import('os')).default;
const osPlatformMock = jest.fn();
const osArchMock = jest.fn();
const osExports = {
...realOs,
platform: osPlatformMock,
arch: osArchMock
};
jest.unstable_mockModule('os', () => ({...osExports, default: osExports}));
const realPath = (await import('path')).default;
const pathJoinMock = jest.fn();
const pathExports = {
...realPath,
join: pathJoinMock
};
jest.unstable_mockModule('path', () => ({
...pathExports,
default: pathExports
}));
jest.unstable_mockModule('@actions/io', () => ({
which: jest.fn(),
mkdirP: jest.fn(),
rmRF: jest.fn(),
mv: jest.fn(),
cp: jest.fn()
}));
const realTc = await import('@actions/tool-cache');
jest.unstable_mockModule('@actions/tool-cache', () => ({
...realTc,
find: jest.fn(),
downloadTool: jest.fn(),
extractTar: jest.fn(),
extractZip: jest.fn(),
cacheDir: jest.fn(),
getManifestFromRepo: jest.fn()
}));
const realHttp = await import('@actions/http-client');
jest.unstable_mockModule('@actions/http-client', () => ({
...realHttp,
HttpClient: jest.fn().mockImplementation(() => ({
getJson: httpClientGetJson
}))
}));
jest.unstable_mockModule('../src/go-version-fetch.js', () => ({
getVersionsDist: jest.fn()
}));
const core = await import('@actions/core');
const io = await import('@actions/io');
const tc = await import('@actions/tool-cache');
const vf = await import('../src/go-version-fetch.js');
const main = await import('../src/main.js');
const im = await import('../src/installer.js');
const osm = (await import('os')).default;
const path = (await import('path')).default;
import goJsonData from './data/golang-dl.json';
import matchers from '../matchers.json';
import goTestManifest from './data/versions-manifest.json';
const matcherPattern = matchers.problemMatcher[0].pattern[0];
const matcherRegExp = new RegExp(matcherPattern.regexp);
const win32Join = path.win32.join;
@@ -107,33 +23,32 @@ describe('setup-go', () => {
let inputs = {} as any;
let os = {} as any;
let inSpy: jest.Mock<typeof core.getInput>;
let getBooleanInputSpy: jest.Mock<typeof core.getBooleanInput>;
let exportVarSpy: jest.Mock<typeof core.exportVariable>;
let findSpy: jest.Mock;
let cnSpy: jest.SpiedFunction<typeof process.stdout.write>;
let logSpy: jest.Mock;
let setOutputSpy: jest.Mock<typeof core.setOutput>;
let warningSpy: jest.Mock<typeof core.warning>;
let getSpy: jest.Mock;
let platSpy: jest.Mock;
let archSpy: jest.Mock;
let joinSpy: jest.Mock<typeof path.join>;
let dlSpy: jest.Mock;
let extractTarSpy: jest.Mock;
let extractZipSpy: jest.Mock;
let cacheSpy: jest.Mock;
let dbgSpy: jest.Mock;
let whichSpy: jest.Mock;
let existsSpy: jest.SpiedFunction<typeof fs.existsSync>;
let readFileSpy: jest.SpiedFunction<typeof fs.readFileSync>;
let mkdirpSpy: jest.Mock;
let mkdirSpy: jest.SpiedFunction<typeof fs.mkdir>;
let symlinkSpy: jest.SpiedFunction<typeof fs.symlinkSync>;
let execSpy: jest.SpiedFunction<typeof cp.execSync>;
let execFileSpy: jest.SpiedFunction<typeof cp.execFileSync>;
let getManifestSpy: jest.Mock;
let httpmGetJsonSpy: jest.Mock;
let inSpy: jest.SpyInstance;
let getBooleanInputSpy: jest.SpyInstance;
let exportVarSpy: jest.SpyInstance;
let findSpy: jest.SpyInstance;
let cnSpy: jest.SpyInstance;
let logSpy: jest.SpyInstance;
let getSpy: jest.SpyInstance;
let platSpy: jest.SpyInstance;
let archSpy: jest.SpyInstance;
let joinSpy: jest.SpyInstance;
let dlSpy: jest.SpyInstance;
let extractTarSpy: jest.SpyInstance;
let extractZipSpy: jest.SpyInstance;
let cacheSpy: jest.SpyInstance;
let dbgSpy: jest.SpyInstance;
let whichSpy: jest.SpyInstance;
let existsSpy: jest.SpyInstance;
let readFileSpy: jest.SpyInstance;
let mkdirpSpy: jest.SpyInstance;
let mkdirSpy: jest.SpyInstance;
let symlinkSpy: jest.SpyInstance;
let execSpy: jest.SpyInstance;
let execFileSpy: jest.SpyInstance;
let getManifestSpy: jest.SpyInstance;
let getAllVersionsSpy: jest.SpyInstance;
let httpmGetJsonSpy: jest.SpyInstance;
beforeAll(async () => {
process.env['GITHUB_ENV'] = ''; // Stub out Environment file functionality so we can verify it writes to standard out (toolkit is backwards compatible)
@@ -144,19 +59,17 @@ describe('setup-go', () => {
// @actions/core
inputs = {};
inSpy = core.getInput as jest.Mock<typeof core.getInput>;
inSpy = jest.spyOn(core, 'getInput');
inSpy.mockImplementation(name => inputs[name]);
getBooleanInputSpy = core.getBooleanInput as jest.Mock<
typeof core.getBooleanInput
>;
getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
getBooleanInputSpy.mockImplementation(name => inputs[name]);
exportVarSpy = core.exportVariable as jest.Mock<typeof core.exportVariable>;
exportVarSpy = jest.spyOn(core, 'exportVariable');
// node
os = {};
platSpy = osm.platform as jest.Mock;
platSpy = jest.spyOn(osm, 'platform');
platSpy.mockImplementation(() => os['platform']);
archSpy = osm.arch as jest.Mock;
archSpy = jest.spyOn(osm, 'arch');
archSpy.mockImplementation(() => os['arch']);
execSpy = jest.spyOn(cp, 'execSync');
execFileSpy = jest.spyOn(cp, 'execFileSync');
@@ -165,7 +78,7 @@ describe('setup-go', () => {
});
// switch path join behaviour based on set os.platform
joinSpy = path.join as jest.Mock<typeof path.join>;
joinSpy = jest.spyOn(path, 'join');
joinSpy.mockImplementation((...paths: string[]): string => {
if (os['platform'] == 'win32') {
return win32Join(...paths);
@@ -175,22 +88,23 @@ describe('setup-go', () => {
});
// @actions/tool-cache
findSpy = tc.find as jest.Mock;
dlSpy = tc.downloadTool as jest.Mock;
extractTarSpy = tc.extractTar as jest.Mock;
extractZipSpy = tc.extractZip as jest.Mock;
cacheSpy = tc.cacheDir as jest.Mock;
getSpy = vf.getVersionsDist as jest.Mock;
getManifestSpy = tc.getManifestFromRepo as jest.Mock;
findSpy = jest.spyOn(tc, 'find');
dlSpy = jest.spyOn(tc, 'downloadTool');
extractTarSpy = jest.spyOn(tc, 'extractTar');
extractZipSpy = jest.spyOn(tc, 'extractZip');
cacheSpy = jest.spyOn(tc, 'cacheDir');
getSpy = jest.spyOn(im, 'getVersionsDist');
getManifestSpy = jest.spyOn(tc, 'getManifestFromRepo');
getAllVersionsSpy = jest.spyOn(im, 'getManifest');
// httm
httpmGetJsonSpy = httpClientGetJson;
httpmGetJsonSpy = jest.spyOn(httpm.HttpClient.prototype, 'getJson');
// io
whichSpy = io.which as jest.Mock;
whichSpy = jest.spyOn(io, 'which');
existsSpy = jest.spyOn(fs, 'existsSync');
readFileSpy = jest.spyOn(fs, 'readFileSync');
mkdirpSpy = io.mkdirP as jest.Mock;
mkdirpSpy = jest.spyOn(io, 'mkdirP');
// fs
mkdirSpy = jest.spyOn(fs, 'mkdir');
@@ -198,18 +112,25 @@ describe('setup-go', () => {
symlinkSpy.mockImplementation(() => {});
// gets
getManifestSpy.mockImplementation(() => goTestManifest as IToolRelease[]);
getManifestSpy.mockImplementation(() => <tc.IToolRelease[]>goTestManifest);
// writes
cnSpy = jest.spyOn(process.stdout, 'write');
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;
getSpy.mockImplementation(() => goJsonData as IGoVersion[] | null);
cnSpy.mockImplementation(() => true);
logSpy.mockImplementation(() => {});
dbgSpy.mockImplementation(() => {});
logSpy = jest.spyOn(core, 'info');
dbgSpy = jest.spyOn(core, 'debug');
getSpy.mockImplementation(() => <im.IGoVersion[] | null>goJsonData);
cnSpy.mockImplementation(line => {
// uncomment to debug
// process.stderr.write('write:' + line + '\n');
});
logSpy.mockImplementation(line => {
// uncomment to debug
//process.stderr.write('log:' + line + '\n');
});
dbgSpy.mockImplementation(msg => {
// uncomment to see debug output
// process.stderr.write(msg + '\n');
});
});
afterEach(() => {
@@ -217,10 +138,6 @@ describe('setup-go', () => {
delete process.env[im.GOTOOLCHAIN_ENV_VAR];
delete process.env['GO_DOWNLOAD_BASE_URL'];
// reset the exit code that core.setFailed sets on the error-path tests so
// that a passing run does not leak a non-zero process exit code
process.exitCode = 0;
//jest.resetAllMocks();
jest.clearAllMocks();
//jest.restoreAllMocks();
@@ -254,10 +171,8 @@ describe('setup-go', () => {
});
it('should return manifest from raw URL if repo fetch fails', async () => {
(getManifestSpy as jest.Mock<any>).mockRejectedValue(
new Error('Fetch failed')
);
(httpmGetJsonSpy as jest.Mock<any>).mockResolvedValue({
getManifestSpy.mockRejectedValue(new Error('Fetch failed'));
httpmGetJsonSpy.mockResolvedValue({
result: goTestManifest
});
const manifest = await im.getManifest(undefined);
@@ -296,7 +211,7 @@ describe('setup-go', () => {
os.arch = 'x64';
// spec: 1.13.0 => 1.13
const match: IGoVersion | undefined = await im.findMatch('1.13.0');
const match: im.IGoVersion | undefined = await im.findMatch('1.13.0');
expect(match).toBeDefined();
const version: string = match ? match.version : '';
expect(version).toBe('go1.13');
@@ -309,7 +224,7 @@ describe('setup-go', () => {
os.arch = 'x64';
// spec: 1.13 => 1.13.7 (latest)
const match: IGoVersion | undefined = await im.findMatch('1.13');
const match: im.IGoVersion | undefined = await im.findMatch('1.13');
expect(match).toBeDefined();
const version: string = match ? match.version : '';
expect(version).toBe('go1.13.7');
@@ -322,7 +237,7 @@ describe('setup-go', () => {
os.arch = 'x64';
// spec: ^1.13.6 => 1.13.7
const match: IGoVersion | undefined = await im.findMatch('^1.13.6');
const match: im.IGoVersion | undefined = await im.findMatch('^1.13.6');
expect(match).toBeDefined();
const version: string = match ? match.version : '';
expect(version).toBe('go1.13.7');
@@ -335,7 +250,7 @@ describe('setup-go', () => {
os.arch = 'x32';
// spec: 1 => 1.13.7 (latest)
const match: IGoVersion | undefined = await im.findMatch('1');
const match: im.IGoVersion | undefined = await im.findMatch('1');
expect(match).toBeDefined();
const version: string = match ? match.version : '';
expect(version).toBe('go1.13.7');
@@ -343,12 +258,12 @@ describe('setup-go', () => {
expect(fileName).toBe('go1.13.7.windows-386.zip');
});
it('finds unstable release candidate', async () => {
it('finds unstable pre-release version', async () => {
os.platform = 'linux';
os.arch = 'x64';
// spec: 1.14.0-rc.1, stable=false => go1.14rc1
const match: IGoVersion | undefined = await im.findMatch('1.14.0-rc.1');
// spec: 1.14, stable=false => go1.14rc1
const match: im.IGoVersion | undefined = await im.findMatch('1.14.0-rc.1');
expect(match).toBeDefined();
const version: string = match ? match.version : '';
expect(version).toBe('go1.14rc1');
@@ -356,46 +271,6 @@ describe('setup-go', () => {
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 () => {
inputs['go-version'] = '1.13.0';
inputs.stable = 'true';
@@ -471,26 +346,6 @@ describe('setup-go', () => {
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 () => {
const errMsg = 'unhandled error message';
inputs['go-version'] = '1.13.0';
@@ -547,51 +402,6 @@ describe('setup-go', () => {
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 () => {
os.platform = 'linux';
os.arch = 'x64';
@@ -758,106 +568,6 @@ describe('setup-go', () => {
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 {
file: string;
line: number;
@@ -971,11 +681,6 @@ describe('setup-go', () => {
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 () => {
expect(im.makeSemver('1.13')).toBe('1.13.0');
});
@@ -984,102 +689,6 @@ describe('setup-go', () => {
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', () => {
it("use local version and don't check manifest if check-latest is not specified", async () => {
os.platform = 'linux';
@@ -1208,9 +817,10 @@ describe('setup-go', () => {
getManifestSpy.mockImplementation(() => {
throw new Error('Unable to download manifest');
});
(httpmGetJsonSpy as jest.Mock<any>).mockRejectedValue(
httpmGetJsonSpy.mockRejectedValue(
new Error('Unable to download manifest from raw URL')
);
getAllVersionsSpy.mockImplementationOnce(() => undefined);
dlSpy.mockImplementation(async () => '/some/temp/path');
const toolPath = path.normalize('/cache/go/1.13.7/x64');
@@ -1403,7 +1013,7 @@ use .
});
describe('go-version-file-toolchain', () => {
const goVersions = ['1.22.0', '1.21rc2', '1.18', '1.18beta2'];
const goVersions = ['1.22.0', '1.21rc2', '1.18'];
const placeholderVersion = '1.19';
const buildGoMod = (
goVersion: string,
@@ -1503,43 +1113,6 @@ use .
});
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 () => {
os.platform = 'linux';
os.arch = 'x64';
+1 -2
View File
@@ -1,5 +1,4 @@
import {describe, it, expect, beforeEach, afterEach} from '@jest/globals';
import {isSelfHosted} from '../src/utils.js';
import {isSelfHosted} from '../src/utils';
describe('utils', () => {
describe('isSelfHosted', () => {
+26 -45
View File
@@ -1,57 +1,38 @@
import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals';
import fs from 'fs';
import * as io from '@actions/io';
import * as tc from '@actions/tool-cache';
import path from 'path';
const statSyncMock = jest.fn(() => ({
isDirectory: () => true,
isFile: () => true
}));
const readdirSyncMock = jest.fn(() => [] as any);
const writeFileSyncMock = jest.fn();
const mkdirMock = jest.fn();
const symlinkSyncMock = jest.fn();
jest.unstable_mockModule('@actions/io', () => ({
which: jest.fn(),
mkdirP: jest.fn(() => Promise.resolve()),
rmRF: jest.fn(() => Promise.resolve()),
mv: jest.fn(() => Promise.resolve()),
cp: jest.fn(() => Promise.resolve())
}));
const realFs = (await import('fs')).default;
const fsExports = {
...realFs,
statSync: statSyncMock,
readdirSync: readdirSyncMock,
writeFileSync: writeFileSyncMock,
mkdir: mkdirMock,
symlinkSync: symlinkSyncMock
};
jest.unstable_mockModule('fs', () => ({...fsExports, default: fsExports}));
const io = await import('@actions/io');
const tc = await import('@actions/tool-cache');
describe('Windows performance workaround', () => {
let rmRFSpy: jest.Mock;
let mkdirPSpy: jest.Mock;
let cpSpy: jest.Mock;
let mkdirSpy: jest.SpyInstance;
let symlinkSpy: jest.SpyInstance;
let statSpy: jest.SpyInstance;
let readdirSpy: jest.SpyInstance;
let writeFileSpy: jest.SpyInstance;
let rmRFSpy: jest.SpyInstance;
let mkdirPSpy: jest.SpyInstance;
let cpSpy: jest.SpyInstance;
let runnerToolCache: string | undefined;
beforeEach(() => {
rmRFSpy = io.rmRF as jest.Mock;
mkdirPSpy = io.mkdirP as jest.Mock;
cpSpy = io.cp as jest.Mock;
mkdirSpy = jest.spyOn(fs, 'mkdir');
symlinkSpy = jest.spyOn(fs, 'symlinkSync');
statSpy = jest.spyOn(fs, 'statSync');
readdirSpy = jest.spyOn(fs, 'readdirSync');
writeFileSpy = jest.spyOn(fs, 'writeFileSync');
rmRFSpy = jest.spyOn(io, 'rmRF');
mkdirPSpy = jest.spyOn(io, 'mkdirP');
cpSpy = jest.spyOn(io, 'cp');
// default implementations
statSyncMock.mockImplementation(() => ({
isDirectory: () => true,
isFile: () => true
// @ts-ignore - not implement unused methods
statSpy.mockImplementation(() => ({
isDirectory: () => true
}));
readdirSyncMock.mockImplementation(() => []);
writeFileSyncMock.mockImplementation(() => {});
mkdirMock.mockImplementation(() => {});
symlinkSyncMock.mockImplementation(() => {});
readdirSpy.mockImplementation(() => []);
writeFileSpy.mockImplementation(() => {});
mkdirSpy.mockImplementation(() => {});
symlinkSpy.mockImplementation(() => {});
rmRFSpy.mockImplementation(() => Promise.resolve());
mkdirPSpy.mockImplementation(() => Promise.resolve());
cpSpy.mockImplementation(() => Promise.resolve());
+1 -19
View File
@@ -3,7 +3,7 @@ description: 'Setup a Go environment and add it to the PATH'
author: 'GitHub'
inputs:
go-version:
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.'
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.'
go-version-file:
description: 'Path to the go.mod, go.work, .go-version, or .tool-versions file.'
check-latest:
@@ -26,24 +26,6 @@ outputs:
description: 'The installed Go version. Useful when given a version range as input.'
cache-hit:
description: 'A boolean value to indicate if a cache was hit'
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:
using: 'node24'
main: 'dist/setup/index.js'
+48133 -56225
View File
File diff suppressed because one or more lines are too long
-3
View File
@@ -1,3 +0,0 @@
{
"type": "module"
}
+51684 -55072
View File
File diff suppressed because one or more lines are too long
-3
View File
@@ -1,3 +0,0 @@
{
"type": "module"
}
+54 -93
View File
@@ -12,9 +12,6 @@
- [Restore-only caches](advanced-usage.md#restore-only-caches)
- [Parallel builds](advanced-usage.md#parallel-builds)
- [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)
- [Using `setup-go` on GHES](advanced-usage.md#using-setup-go-on-ghes)
@@ -26,8 +23,8 @@ For repeatable builds, specify the **exact major, minor, and patch version** (su
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.25.5'
- run: go run hello.go
@@ -39,8 +36,8 @@ You can specify **only a major and minor version** if you are okay with the most
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.25'
- run: go run hello.go
@@ -50,18 +47,14 @@ 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.
- 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**:
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
# RC version
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.25.0-rc.2'
- run: go version
@@ -70,8 +63,8 @@ steps:
```yaml
# Beta version
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.19.0-beta.1'
- run: go version
@@ -87,8 +80,8 @@ If `oldstable` is provided, the action resolves it to the latest patch release o
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: 'stable'
- run: go run hello.go
@@ -96,8 +89,8 @@ steps:
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: 'oldstable'
- run: go run hello.go
@@ -107,8 +100,8 @@ You can also use **SemVer's version range syntax**, for instance:
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '^1.25.1'
- run: go version
@@ -116,8 +109,8 @@ steps:
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '>=1.24.0-rc.1'
- run: go version
@@ -136,9 +129,9 @@ jobs:
go: [ '1.24', '1.25' ]
name: Go ${{ matrix.go }} sample
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@v6
- name: Setup go
uses: actions/setup-go@v7
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go }}
- run: go run hello.go
@@ -161,9 +154,9 @@ jobs:
- os: windows-latest
go: '1.25'
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@v6
- name: Setup go
uses: actions/setup-go@v7
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go }}
- run: go run hello.go
@@ -177,8 +170,8 @@ If both the `go-version` and the `go-version-file` inputs are provided then the
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: 'path/to/go.mod' # Read Go version from go.mod
- run: go version
@@ -194,8 +187,8 @@ steps:
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: '.go-version' # Read Go version from .go-version
- run: go version
@@ -203,8 +196,8 @@ steps:
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: '.tool-versions' # Read Go version from .tool-versions
- run: go version
@@ -212,8 +205,8 @@ steps:
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: 'go.work' # Read Go version from go.work
- run: go version
@@ -235,8 +228,8 @@ want the most up-to-date Go version to always be used. It supports major (e.g.,
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.25'
check-latest: true
@@ -249,8 +242,8 @@ steps:
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.25'
cache-dependency-path: subdir/go.sum
@@ -263,8 +256,8 @@ steps:
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.25'
cache-dependency-path: '**/go.sum'
@@ -273,8 +266,8 @@ steps:
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.25'
cache-dependency-path: |
@@ -295,8 +288,8 @@ env:
steps:
- run: echo "$GOOS $GOARCH" > env.txt
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.25'
cache-dependency-path: |
@@ -313,8 +306,8 @@ Besides dependencies, the action can also cache build outputs (the [`GOCACHE`](h
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.25'
cache-dependency-path: |
@@ -335,10 +328,10 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@v6
- name: Setup go
id: setup-go
uses: actions/setup-go@v7
uses: actions/setup-go@v6
with:
go-version: '1.25.5'
cache: false
@@ -401,8 +394,8 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
id: go124
with:
go-version: '^1.24'
@@ -418,8 +411,8 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
id: go124
with:
go-version: '1.24'
@@ -427,50 +420,18 @@ jobs:
- run: echo "Was the Go cache restored? ${{ steps.go124.outputs.cache-hit }}" # true if cache-hit occurred
```
### 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
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.
> **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):**
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.25'
go-download-base-url: 'https://aka.ms/golang/release/latest'
@@ -484,8 +445,8 @@ env:
GO_DOWNLOAD_BASE_URL: 'https://aka.ms/golang/release/latest'
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.25'
- run: go version
@@ -501,8 +462,8 @@ If your custom download source requires authentication, the `token` input is for
```yaml
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.25'
go-download-base-url: 'https://private-mirror.example.com/golang'
@@ -524,7 +485,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:
```yaml
uses: actions/setup-go@v7
uses: actions/setup-go@v6
with:
token: ${{ secrets.GH_DOTCOM_TOKEN }}
go-version: '1.25'
@@ -534,4 +495,4 @@ with:
If the runner is not able to access github.com, any Go versions requested during a workflow run must come from the runner's tool cache.
See "[Setting up the tool cache on self-hosted runners without internet access](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access)"
for more information.
for more information.
+11
View File
@@ -0,0 +1,11 @@
module.exports = {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
}
-24
View File
@@ -1,24 +0,0 @@
export default {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
roots: ['<rootDir>'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
transform: {
'^.+\\.ts$': [
'ts-jest',
{
useESM: true,
diagnostics: {
ignoreCodes: [151002]
}
}
]
},
extensionsToTreatAsEsm: ['.ts'],
transformIgnorePatterns: ['node_modules/(?!(@actions)/)'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1'
},
verbose: true
};
+2302 -2290
View File
File diff suppressed because it is too large Load Diff
+58 -60
View File
@@ -1,60 +1,58 @@
{
"name": "setup-go",
"version": "7.0.0",
"type": "module",
"private": true,
"description": "setup go action",
"main": "lib/setup-go.js",
"engines": {
"node": ">=24.0.0"
},
"scripts": {
"build": "tsc && ncc build -o dist/setup src/setup-go.ts && ncc build -o dist/cache-save src/cache-save.ts",
"format": "prettier --no-error-on-unmatched-pattern --write \"**/*.{ts,yml,yaml}\"",
"format-check": "prettier --no-error-on-unmatched-pattern --check \"**/*.{ts,yml,yaml}\"",
"lint": "eslint \"**/*.ts\"",
"lint:fix": "eslint \"**/*.ts\" --fix",
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --runInBand --coverage",
"pre-checkin": "npm run format && npm run lint:fix && npm run build && npm test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/actions/setup-go.git"
},
"keywords": [
"actions",
"go",
"setup"
],
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/cache": "^6.3.0",
"@actions/core": "^3.0.1",
"@actions/exec": "^3.0.0",
"@actions/glob": "^0.7.0",
"@actions/http-client": "^4.0.1",
"@actions/io": "^3.0.2",
"@actions/tool-cache": "^4.0.0",
"semver": "^7.8.5"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@jest/globals": "^30.4.1",
"@types/node": "^24.0.0",
"@types/semver": "^7.7.0",
"@typescript-eslint/eslint-plugin": "^8.62.0",
"@typescript-eslint/parser": "^8.62.0",
"@vercel/ncc": "^0.44.0",
"eslint": "^10.5.0",
"eslint-config-prettier": "^10.0.0",
"eslint-plugin-jest": "^29.15.2",
"eslint-plugin-n": "^18.1.0",
"globals": "^17.7.0",
"jest": "^30.4.2",
"nock": "^14.0.0",
"prettier": "^3.8.4",
"ts-jest": "^29.4.11",
"typescript": "^6.0.3"
}
}
{
"name": "setup-go",
"version": "6.5.0",
"private": true,
"description": "setup go action",
"main": "lib/setup-go.js",
"engines": {
"node": ">=24.0.0"
},
"scripts": {
"build": "tsc && ncc build -o dist/setup src/setup-go.ts && ncc build -o dist/cache-save src/cache-save.ts",
"format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"",
"format-check": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --check \"**/*.{ts,yml,yaml}\"",
"lint": "eslint --config ./.eslintrc.js \"**/*.ts\"",
"lint:fix": "eslint --config ./.eslintrc.js \"**/*.ts\" --fix",
"test": "jest --coverage",
"pre-checkin": "npm run format && npm run lint:fix && npm run build && npm test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/actions/setup-go.git"
},
"keywords": [
"actions",
"go",
"setup"
],
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/cache": "^5.1.0",
"@actions/core": "^2.0.3",
"@actions/exec": "^2.0.0",
"@actions/glob": "^0.5.1",
"@actions/http-client": "^3.0.2",
"@actions/io": "^2.0.0",
"@actions/tool-cache": "^3.0.1",
"semver": "^7.7.3"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^25.9.3",
"@types/semver": "^7.7.1",
"@typescript-eslint/eslint-plugin": "^8.61.0",
"@typescript-eslint/parser": "^8.61.0",
"@vercel/ncc": "^0.38.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-jest": "^29.0.1",
"eslint-plugin-node": "^11.1.0",
"jest": "^29.7.0",
"jest-circus": "^29.7.0",
"nock": "^10.0.6",
"prettier": "^2.8.4",
"ts-jest": "^29.3.2",
"typescript": "^5.8.3"
}
}
+3 -3
View File
@@ -4,9 +4,9 @@ import * as glob from '@actions/glob';
import path from 'path';
import fs from 'fs';
import {State, Outputs} from './constants.js';
import {PackageManagerInfo} from './package-managers.js';
import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils.js';
import {State, Outputs} from './constants';
import {PackageManagerInfo} from './package-managers';
import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils';
export const restoreCache = async (
versionSpec: string,
+2 -2
View File
@@ -1,8 +1,8 @@
import * as core from '@actions/core';
import * as cache from '@actions/cache';
import fs from 'fs';
import {State} from './constants.js';
import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils.js';
import {State} from './constants';
import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils';
// 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
+1 -4
View File
@@ -1,10 +1,7 @@
import * as cache from '@actions/cache';
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import {
supportedPackageManagers,
PackageManagerInfo
} from './package-managers.js';
import {supportedPackageManagers, PackageManagerInfo} from './package-managers';
export const getCommandOutput = async (toolCommand: string) => {
let {stdout, stderr, exitCode} = await exec.getExecOutput(
+1 -16
View File
@@ -4,20 +4,5 @@ export enum State {
}
export enum Outputs {
CacheHit = 'cache-hit',
GoBinPath = 'go-bin-path'
CacheHit = 'cache-hit'
}
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>>;
-13
View File
@@ -1,13 +0,0 @@
import * as httpm from '@actions/http-client';
import type {IGoVersion} from './installer.js';
export async function getVersionsDist(
dlUrl: string
): Promise<IGoVersion[] | null> {
// this returns versions descending so latest is first
const http: httpm.HttpClient = new httpm.HttpClient('setup-go', [], {
allowRedirects: true,
maxRedirects: 3
});
return (await http.getJson<IGoVersion[]>(dlUrl)).result;
}
+29 -51
View File
@@ -3,14 +3,13 @@ import * as core from '@actions/core';
import * as path from 'path';
import * as semver from 'semver';
import * as httpm from '@actions/http-client';
import * as sys from './system.js';
import * as sys from './system';
import crypto from 'crypto';
import cp from 'child_process';
import fs from 'fs';
import os from 'os';
import {StableReleaseAlias, isSelfHosted} from './utils.js';
import {Architecture} from './types.js';
import {getVersionsDist} from './go-version-fetch.js';
import {StableReleaseAlias, isSelfHosted} from './utils';
import {Architecture} from './types';
export const GOTOOLCHAIN_ENV_VAR = 'GOTOOLCHAIN';
export const GOTOOLCHAIN_LOCAL_VAL = 'local';
@@ -60,11 +59,6 @@ export async function getGo(
const osPlat: string = os.platform();
const customBaseUrl = goDownloadBaseUrl?.replace(/\/+$/, '');
const originalVersionSpec = versionSpec;
if (isGoNativeVersion(versionSpec)) {
versionSpec = makeSemver(versionSpec);
}
if (
versionSpec === StableReleaseAlias.Stable ||
versionSpec === StableReleaseAlias.OldStable
@@ -128,13 +122,8 @@ export async function getGo(
? customToolCacheName(customBaseUrl)
: '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
const toolPath = tc.find(toolCacheName, cacheSpec, arch);
const toolPath = tc.find(toolCacheName, versionSpec, arch);
// If not found in cache, download
if (toolPath) {
core.info(`Found in cache @ ${toolPath}`);
@@ -156,11 +145,7 @@ export async function getGo(
core.info(
'Skipping version listing for known direct-download URL. Constructing download URL directly.'
);
info = getInfoFromDirectDownload(
originalVersionSpec,
arch,
customBaseUrl
);
info = getInfoFromDirectDownload(versionSpec, arch, customBaseUrl);
} else {
try {
info = await getInfoFromDist(versionSpec, arch, customBaseUrl);
@@ -170,11 +155,7 @@ export async function getGo(
);
}
if (!info) {
info = getInfoFromDirectDownload(
originalVersionSpec,
arch,
customBaseUrl
);
info = getInfoFromDirectDownload(versionSpec, arch, customBaseUrl);
}
}
@@ -185,15 +166,13 @@ export async function getGo(
const downloadUrl = info?.downloadUrl || customBaseUrl;
if (err instanceof tc.HTTPError && err.httpStatusCode === 404) {
throw new Error(
`The requested Go version ${originalVersionSpec} is not available for platform ${osPlat}/${arch}. ` +
`Download URL returned HTTP 404: ${downloadUrl}`,
{cause: err}
`The requested Go version ${versionSpec} is not available for platform ${osPlat}/${arch}. ` +
`Download URL returned HTTP 404: ${downloadUrl}`
);
}
throw new Error(
`Failed to download Go ${originalVersionSpec} for platform ${osPlat}/${arch} ` +
`from ${downloadUrl}: ${err}`,
{cause: err}
`Failed to download Go ${versionSpec} for platform ${osPlat}/${arch} ` +
`from ${downloadUrl}: ${err}`
);
}
} else {
@@ -239,9 +218,7 @@ export async function getGo(
core.info('Install from dist');
downloadPath = await installGoVersion(info, undefined, arch);
} catch (err) {
throw new Error(`Failed to download version ${versionSpec}: ${err}`, {
cause: err
});
throw new Error(`Failed to download version ${versionSpec}: ${err}`);
}
}
}
@@ -592,7 +569,9 @@ export async function findMatch(
let result: IGoVersion | undefined;
let match: IGoVersion | undefined;
const candidates: IGoVersion[] | null = await getVersionsDist(dlUrl);
const candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
dlUrl
);
if (!candidates) {
throw new Error(`golang download url did not return results`);
}
@@ -603,10 +582,7 @@ export async function findMatch(
const version = makeSemver(candidate.version);
core.debug(`check ${version} satisfies ${versionSpec}`);
if (
candidate.version.replace(/^go/, '') === versionSpec ||
semver.satisfies(version, versionSpec)
) {
if (semver.satisfies(version, versionSpec)) {
goFile = candidate.files.find(file => {
core.debug(
`${file.arch}===${archFilter} && ${file.os}===${platFilter}`
@@ -631,10 +607,15 @@ export async function findMatch(
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);
export async function getVersionsDist(
dlUrl: string
): Promise<IGoVersion[] | null> {
// this returns versions descending so latest is first
const http: httpm.HttpClient = new httpm.HttpClient('setup-go', [], {
allowRedirects: true,
maxRedirects: 3
});
return (await http.getJson<IGoVersion[]>(dlUrl)).result;
}
//
@@ -644,10 +625,6 @@ export function isGoNativeVersion(version: string): boolean {
// 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
export function makeSemver(version: string): string {
const validVersion = semver.valid(version);
if (validVersion) {
return validVersion;
}
version = version.replace('go', '');
version = version.replace('beta', '-beta.').replace('rc', '-rc.');
const parts = version.split('-');
@@ -685,7 +662,7 @@ export function parseGoVersionFile(versionFilePath: string): string {
if (process.env[GOTOOLCHAIN_ENV_VAR] !== GOTOOLCHAIN_LOCAL_VAL) {
// toolchain directive: https://go.dev/ref/mod#go-mod-file-toolchain
const matchToolchain = contents.match(
/^toolchain go(1\.\d+(?:\.\d+|(beta|rc)\d+)?)/m
/^toolchain go(1\.\d+(?:\.\d+|rc\d+)?)/m
);
if (matchToolchain) {
return matchToolchain[1];
@@ -693,7 +670,7 @@ export function parseGoVersionFile(versionFilePath: string): string {
}
// go directive: https://go.dev/ref/mod#go-mod-file-go
const matchGo = contents.match(/^go (\d+(\.\d+)*(?:\.\d+|(beta|rc)\d+)?)/m);
const matchGo = contents.match(/^go (\d+(\.\d+)*)/m);
return matchGo ? matchGo[1] : '';
} else if (path.basename(versionFilePath) === '.tool-versions') {
const match = contents.match(/^golang\s+([^\n#]+)/m);
@@ -709,8 +686,9 @@ async function resolveStableVersionDist(
) {
const archFilter = sys.getArch(arch);
const platFilter = sys.getPlatform();
const candidates: IGoVersion[] | null =
await getVersionsDist(GOLANG_DOWNLOAD_URL);
const candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
GOLANG_DOWNLOAD_URL
);
if (!candidates) {
throw new Error(`golang download url did not return results`);
}
+37 -106
View File
@@ -1,16 +1,14 @@
import * as core from '@actions/core';
import * as io from '@actions/io';
import * as installer from './installer.js';
import * as installer from './installer';
import * as semver from 'semver';
import path from 'path';
import {fileURLToPath} from 'url';
import {restoreCache} from './cache-restore.js';
import {isCacheFeatureAvailable} from './cache-utils.js';
import {restoreCache} from './cache-restore';
import {isCacheFeatureAvailable} from './cache-utils';
import cp from 'child_process';
import fs from 'fs';
import os from 'os';
import {Architecture} from './types.js';
import {GO_ENV_OUTPUTS, GoEnv, Outputs} from './constants.js';
import {Architecture} from './types';
export async function run() {
try {
@@ -22,6 +20,7 @@ export async function run() {
setGoToolchain();
const cache = core.getBooleanInput('cache');
core.info(`Setup go version spec ${versionSpec}`);
let arch = core.getInput('architecture') as Architecture;
@@ -30,48 +29,41 @@ export async function run() {
}
if (versionSpec) {
core.startGroup('Installed version');
try {
core.info(`Setup go version spec ${versionSpec}`);
const token = core.getInput('token');
const auth = !token ? undefined : `token ${token}`;
const token = core.getInput('token');
const auth = !token ? undefined : `token ${token}`;
const checkLatest = core.getBooleanInput('check-latest');
const checkLatest = core.getBooleanInput('check-latest');
const goDownloadBaseUrl =
core.getInput('go-download-base-url') ||
process.env['GO_DOWNLOAD_BASE_URL'] ||
undefined;
const 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();
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}`);
} else {
core.info(
'[warning]go-version input was not specified. The action will try to use pre-installed version.'
@@ -83,11 +75,6 @@ export async function run() {
const goPath = await io.which('go');
const goVersion = (cp.execSync(`${goPath} version`) || '').toString();
const goEnvJson = readGoEnv(goPath);
if (goEnvJson) {
setGoEnvOutputs(goEnvJson);
}
if (cache && isCacheFeatureAvailable()) {
const packageManager = 'default';
@@ -104,11 +91,7 @@ export async function run() {
}
// add problem matchers
const matchersPath = path.join(
path.dirname(fileURLToPath(import.meta.url)),
'../..',
'matchers.json'
);
const matchersPath = path.join(__dirname, '../..', 'matchers.json');
core.info(`##[add-matcher]${matchersPath}`);
// output the version actually being used
@@ -125,46 +108,6 @@ 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> {
let added = false;
const g = await io.which('go');
@@ -215,18 +158,6 @@ function resolveVersionInput(): string {
}
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;
}
+1 -1
View File
@@ -1,3 +1,3 @@
import {run} from './main.js';
import {run} from './main';
run();
+1 -1
View File
@@ -1,5 +1,5 @@
import os from 'os';
import {Architecture} from './types.js';
import {Architecture} from './types';
export function getPlatform(): string {
// darwin and linux match already
+4 -4
View File
@@ -2,8 +2,8 @@
"compilerOptions": {
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "ES2022", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "NodeNext", /* Specify module code generation. */
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
@@ -38,7 +38,7 @@
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "NodeNext", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
@@ -61,5 +61,5 @@
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
},
"exclude": ["node_modules", "**/*.test.ts", "jest.config.ts"]
"exclude": ["node_modules", "**/*.test.ts"]
}