Compare commits

...

79 Commits
v3 ... main

Author SHA1 Message Date
HarithaVattikuti
4ab57d7ea2
Fix versions check failure (#479)
* Update to latest Go versions

* Updated versions

* Update test data

* Update test data
2024-05-10 11:25:20 -05:00
Masahiro Furudate
cdcb360436
Remove the description of the old go.mod specification (#458)
* Fix emoji rendering

* Fix quoting

* Remove the description of the old go.mod specification

* Remove the single quotes from `go-version-file`

* Fix README

* Add description about patch versions to README

* Revert "Remove the single quotes from `go-version-file`"

This reverts commit ca4321abee075cc5dac53a3ef10d60b107460c56.
2024-04-18 08:33:57 -05:00
Andy Brody
99176a8f9a
Update README.md with V5 release notes (#459) 2024-04-15 09:19:11 -05:00
dependabot[bot]
be1aa1186e
Bump undici from 5.28.2 to 5.28.3 (#465)
* Bump undici from 5.28.2 to 5.28.3

Bumps [undici](https://github.com/nodejs/undici) from 5.28.2 to 5.28.3.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.2...v5.28.3)

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

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

* fixed check failures and update dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: HarithaVattikuti <73516759+HarithaVattikuti@users.noreply.github.com>
2024-03-21 15:04:22 -05:00
Rui Chen
6c1fd22b67
docs: bump actions/setup-go to v5 (#449)
Signed-off-by: Rui Chen <rui@chenrui.dev>
2024-01-29 10:18:45 -06:00
Dmitry Shibanov
0c52d547c9
Update dependencies for node20 (#445) 2023-12-05 17:50:42 +01:00
Marko Zivic
bfd2fb341f
Merge pull request #421 from chenrui333/node20-runtime
feat: upgrade to use node 20 runtime and bump checkout action to v4
2023-09-18 06:44:16 +02:00
Rui Chen
3d65fa57fc
feat: bump to use actions/checkout@v4
Signed-off-by: Rui Chen <rui@chenrui.dev>
2023-09-05 11:42:39 -04:00
Rui Chen
8a505c9cf2
feat: bump to use node20 runtime
Signed-off-by: Rui Chen <rui@chenrui.dev>
2023-09-04 14:19:48 -04:00
Marko Zivic
883490dfd0
Merge pull request #417 from artemgavrilov/main
Improve documentation regarding dependencies caching
2023-08-30 09:35:35 +02:00
Artem Gavrilov
d45ebba0ce
Rephrase sentence
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2023-08-29 15:43:02 +02:00
Artem Gavrilov
317c6617fa
Replace wildcards term with globs. 2023-08-28 12:47:43 +02:00
Artem Gavrilov
f90673ad64
Merge pull request #1 from artemgavrilov/caching-docs-improvement
Improve documentation regarding dependencies caching
2023-08-25 12:37:15 +02:00
Artem Gavrilov
8018234347
Improve documentation regarding dependencies cachin 2023-08-25 12:31:19 +02:00
Marko Zivic
d085b4fe57
Merge pull request #411 from galargh/fix/windows-hostedtoolcache
Fix hosted tool cache usage on windows
2023-08-24 10:20:54 +02:00
galargh
48ac8fd236 chore: format 2023-08-12 23:57:09 +02:00
Piotr Galar
89a192af9d fix: sync .complete marker when caching tools on windows 2023-08-12 23:52:21 +02:00
Piotr Galar
aabcd82874
ci: add hostedtoolcache validation on windows 2023-08-12 21:56:36 +02:00
Sergey Dolin
93397bea11
Fix Install on Windows is very slow (#393)
* Fix Install on Windows is very slow

* Add unit test

* Improve readability

* Add e2e test

* fix lint

* Fix unit tests

* Fix unit tests

* limit to github hosted runners

* test hosted version of go

* AzDev environment

* rename lnkSrc

* refactor conditions

* improve tests

* refactoring

* Fix e2e test

* improve isHosted readability
2023-08-03 14:33:56 +02:00
Sergey Dolin
27eec5b982
Merge pull request #396 from actions/dependabot/npm_and_yarn/semver-6.3.1
Bump semver from 6.3.0 to 6.3.1
2023-08-02 23:29:18 +02:00
Sergey Dolin
ecfc77a56f
Merge pull request #397 from actions/dependabot/npm_and_yarn/word-wrap-1.2.4
Bump word-wrap from 1.2.3 to 1.2.4
2023-08-02 23:29:08 +02:00
dependabot[bot]
1b80a11e05
Bump word-wrap from 1.2.3 to 1.2.4
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-18 21:26:12 +00:00
Dusan Trickovic
b1c343484c Fix licensing for Semver 6.3.1 2023-07-18 16:46:59 +02:00
Dusan Trickovic
0bb97b1c5c Rebuild after updating Semver 2023-07-18 16:39:08 +02:00
dependabot[bot]
4220624b80
Bump semver from 6.3.0 to 6.3.1
Bumps [semver](https://github.com/npm/node-semver) from 6.3.0 to 6.3.1.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v6.3.1/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v6.3.0...v6.3.1)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-17 09:42:07 +00:00
dependabot[bot]
db8764c1e2
Bump tough-cookie and @azure/ms-rest-js (#392) 2023-07-17 11:40:59 +02:00
Sergey Dolin
08b314a573
Merge pull request #383 from akv-platform/issue-368
Add imageOS to primaryKey
2023-07-11 09:44:30 +02:00
Sergey Dolin
4e0b6c77c6 Limit to Linux only 2023-07-10 10:39:55 +02:00
Sergey Dolin
a4d10f0ea4 Add imageOS to primaryKey
https://github.com/actions/setup-go/issues/368
2023-07-10 10:17:28 +02:00
Dmitry Shibanov
992f068900
Add note about YAML parsing versions (#382) 2023-06-08 15:37:31 +02:00
yukyan
0e6baa5a93
Added a description that go-version should be specified as a string type (#367) 2023-06-05 13:06:05 +02:00
Michael Kelly
a6259e5d50
Update action.yml (#379)
Typo in the description.
2023-06-05 13:01:40 +02:00
Marko Zivic
49bc3307c5
Merge pull request #378 from akv-platform/remove-implicit-dependencies
Remove implicit dependencies
2023-05-24 08:36:50 +02:00
Nikolai Laevskii
f350b3e5db Move eslint-plugin-node to dev dependencies 2023-05-23 11:58:05 +02:00
Nikolai Laevskii
06a11aedec Install eslint-plugin-node 2023-05-23 11:42:25 +02:00
github-actions[bot]
56b159bb76 Update configuration files 2023-05-23 08:32:03 +00:00
Nikolai Laevskii
fac708d667
Bump @actions/cache dependency to v3.2.1 (#374) 2023-05-08 11:42:39 +02:00
Dmitry Shibanov
dd84a9531a
Update xml2js (#370) 2023-04-20 14:28:58 +02:00
Ivan
41c2024c46
Fix glob bug in package.json scripts section (#359) 2023-04-03 12:46:31 +02:00
Sergey Dolin
8dbf352f06
update README fo v4 (#354) 2023-03-15 15:27:29 +01:00
github-actions[bot]
4d34df0c23
Update configuration files (#348)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-03-15 00:26:55 +01:00
Dmitry Shibanov
fdc0d672a1
Add Go bin if go-version input is empty (#351) 2023-03-14 16:29:10 +01:00
Dmitry Shibanov
ebfdf6ac95
add warning if go-version is empty (#350) 2023-03-14 16:07:41 +01:00
Dmitry Shibanov
b27d76912e
fix lockfileVersion (#349) 2023-03-14 10:15:26 +01:00
Sergey Dolin
c51a720768
Enable caching by default with default input (#332) 2023-03-10 16:25:35 +01:00
Marko Zivic
6b848af622
Merge pull request #343 from akv-platform/reusable-workflow
Turn on automatic update of ESLint and Prettier configuration files
2023-03-10 10:54:57 +01:00
IvanZosimov
12741cc209 Format update-config-files.yml 2023-03-08 10:27:16 +01:00
IvanZosimov
7a77a6aab6 Merge branch 'main' into reusable-workflow 2023-03-08 10:17:58 +01:00
IvanZosimov
42a0cc8e14 Add update-config-files.yml 2023-03-08 10:16:51 +01:00
Ivan
7406d654ad
Add and configure ESLint and update configuration for Prettier (#341)
* Turn on ESLint and update Prettier

* Update eslint config

* Update eslint config

* Update dependencies

* Update ESLint and Prettier configurations

* update package.json

* Update prettier command

* Update prettier config file

* Change CRLF to LF

* Update docs

* Update docs
2023-03-08 10:45:16 +02:00
Marko Zivic
a3d889c34c
Merge pull request #323 from e-korolevskii/use-actual-version-in-cache
Use actual version in cache
2023-01-31 13:55:36 +01:00
Evgenii Korolevskii
b8eec33327 Merge branch 'main' into use-actual-version-in-cache 2023-01-31 13:39:54 +01:00
Serghei Iakovlev
807559307d
Use const declarations for variables that are never reassigned (#322) 2023-01-31 11:46:49 +01:00
Evgenii Korolevskii
b27afcd9c2 format 2023-01-20 10:28:57 +01:00
Evgenii Korolevskii
65f50caf42 use actual version in key 2023-01-20 01:30:38 +01:00
Evgenii Korolevskii
89d7939d38 use real version instead of spec 2023-01-20 01:28:58 +01:00
Evgenii Korolevskii
2e7414f276 try get path 2023-01-20 01:27:11 +01:00
Evgenii Korolevskii
de201a09c0 log version-spec 2023-01-20 01:21:36 +01:00
MaksimZhukov
21459d0b7b
Update release-new-action-version.yml (#317) 2023-01-12 13:50:40 +01:00
dependabot[bot]
4347c698e3
Bump json5 from 2.2.1 to 2.2.3 (#315) 2023-01-09 09:56:20 +01:00
Evgenii Korolevskii
fa319ab135
Merge pull request #312 from sh-cho/patch-1
Update basic validation badge
2022-12-27 12:20:27 +01:00
Marko Zivic
32705aee25
Merge pull request #313 from actions/setup-actions-team-codeowners
Update CODEOWNERS
2022-12-27 09:29:07 +01:00
Evgenii Korolevskii
49b445323b
Update CODEOWNERS 2022-12-26 09:42:22 +01:00
Marko Zivic
991a6a2c3e
Merge pull request #311 from actions/update-codeowners
Update CODEOWNERS
2022-12-23 08:22:39 +01:00
Seonghyeon Cho
9c64203f1d
Update basic validation badge 2022-12-23 12:03:14 +09:00
Evgenii Korolevskii
8ecad12159
Update CODEOWNERS 2022-12-23 00:03:10 +01:00
Ivan
1661eebbbd
Merge pull request #308 from akv-platform/apply-reusable-workflows
Update action to use reusable workflows
2022-12-22 10:48:05 +02:00
IvanZosimov
9acc3d3da9 Fix review points 2022-12-20 16:34:43 +01:00
IvanZosimov
5b3907ef5c Merge branch 'main' of https://github.com/akv-platform/setup-go into apply-reusable-workflows 2022-12-19 13:31:24 +01:00
Ivan
c0e82e3ff3
Merge branch 'actions:main' into main 2022-12-19 14:24:39 +02:00
IvanZosimov
e01c74b690 Update action to use reusabl-workflows repo 2022-12-19 13:22:55 +01:00
Evgenii Korolevskii
17106403fa
Allow to use only GOCACHE for cache (#305) 2022-12-19 11:22:17 +01:00
Jongwoo Han
bb5ff97ab9
refactor: Use early return pattern to avoid nested conditions (#302) 2022-12-16 15:05:54 +01:00
IvanZosimov
e417811a6d Add links to reusable workflows 2022-12-15 16:31:23 +01:00
IvanZosimov
59e7baba60 Update workflows 2022-12-15 16:12:57 +01:00
IvanZosimov
1370292ad9 Update workflows to use reusable-workflows 2022-12-14 15:11:36 +01:00
Ivan
339692abda
Merge branch 'actions:main' into main 2022-12-14 16:05:16 +02:00
Evgenii Korolevskii
de99728cc5
Merge branch 'actions:main' into main 2022-07-29 01:47:21 +02:00
Evgenii Korolevskii
5d1561a0b7
Merge pull request #5 from e-korolevskii/Update-contributors-guide
docs(contributors guide): Updated contributors guide
2022-07-26 12:49:59 +02:00
74 changed files with 71701 additions and 25380 deletions

6
.eslintignore Normal file
View File

@ -0,0 +1,6 @@
# Ignore list
/*
# Do not ignore these folders:
!__tests__/
!src/

51
.eslintrc.js Normal file
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
}
};

2
.gitattributes vendored
View File

@ -1,2 +1,2 @@
* text=auto * text=auto eol=lf
.licenses/** -diff linguist-generated=true .licenses/** -diff linguist-generated=true

18
.github/workflows/basic-validation.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Basic validation
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
call-basic-validation:
name: Basic validation
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
with:
node-version: '20'

View File

@ -1,8 +1,3 @@
# `dist/index.js` is a special file in Actions.
# When you reference an action with `uses:` in a workflow,
# `index.js` is the code that will run.
# For our project, we generate this file through a build process from other source files.
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
name: Check dist/ name: Check dist/
on: on:
@ -17,36 +12,8 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
check-dist: call-check-dist:
runs-on: ubuntu-latest name: Check dist/
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
steps:
- uses: actions/checkout@v3
- name: Set Node.js 16.x
uses: actions/setup-node@v3
with: with:
node-version: 16.x node-version: '20'
cache: npm
- name: Install dependencies
run: npm ci
- name: Rebuild the dist/ directory
run: npm run build
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/

14
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,14 @@
name: CodeQL analysis
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 3 * * 0'
jobs:
call-codeQL-analysis:
name: CodeQL analysis
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main

View File

@ -9,20 +9,6 @@ on:
- main - main
jobs: jobs:
test: call-licensed:
runs-on: ubuntu-latest name: Licensed
name: Check licenses uses: actions/reusable-workflows/.github/workflows/licensed.yml@main
steps:
- uses: actions/checkout@v3
- name: Set Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- run: npm ci
- name: Install licensed
run: |
cd $RUNNER_TEMP
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.4.4/licensed-3.4.4-linux-x64.tar.gz
sudo tar -xzf licensed.tar.gz
sudo mv licensed /usr/local/bin/licensed
- run: licensed status

View File

@ -1,4 +1,5 @@
name: Release new action version name: Release new action version
on: on:
release: release:
types: [released] types: [released]
@ -21,7 +22,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Update the ${{ env.TAG_NAME }} tag - name: Update the ${{ env.TAG_NAME }} tag
uses: actions/publish-action@v0.2.1 uses: actions/publish-action@v0.2.2
with: with:
source-tag: ${{ env.TAG_NAME }} source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }} slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

View File

@ -0,0 +1,11 @@
name: Update configuration files
on:
schedule:
- cron: '0 3 * * 0'
workflow_dispatch:
jobs:
call-update-configuration-files:
name: Update configuration files
uses: actions/reusable-workflows/.github/workflows/update-config-files.yml@main

View File

@ -1,4 +1,5 @@
name: Validate 'setup-go' name: Validate 'setup-go'
on: on:
push: push:
branches: branches:
@ -19,7 +20,7 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Go Stable - name: Setup Go Stable
uses: ./ uses: ./
with: with:
@ -34,7 +35,7 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Go oldStable - name: Setup Go oldStable
uses: ./ uses: ./
with: with:
@ -54,7 +55,7 @@ jobs:
- os: macos-latest - os: macos-latest
architecture: x32 architecture: x32
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Go ${{ matrix.version }} ${{ matrix.architecture }} - name: Setup Go ${{ matrix.version }} ${{ matrix.architecture }}
uses: ./ uses: ./
with: with:
@ -70,10 +71,10 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
go: [1.17, 1.18, 1.19] go: [1.20.14, 1.21.10, 1.22.3]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: setup-go ${{ matrix.go }} - name: setup-go ${{ matrix.go }}
uses: ./ uses: ./
@ -90,9 +91,9 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
go-version: [1.16, 1.17] go-version: [1.20.14, 1.21]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Go and check latest - name: Setup Go and check latest
uses: ./ uses: ./
with: with:
@ -108,13 +109,13 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Go and check latest - name: Setup Go and check latest
uses: ./ uses: ./
with: with:
go-version-file: __tests__/data/go.mod go-version-file: __tests__/data/go.mod
- name: verify go - name: verify go
run: __tests__/verify-go.sh 1.14 run: __tests__/verify-go.sh 1.20.14
shell: bash shell: bash
go-version-file-with-gowork: go-version-file-with-gowork:
@ -124,13 +125,13 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Go and check latest - name: Setup Go and check latest
uses: ./ uses: ./
with: with:
go-version-file: __tests__/data/go.work go-version-file: __tests__/data/go.work
- name: verify go - name: verify go
run: __tests__/verify-go.sh 1.19 run: __tests__/verify-go.sh 1.21
shell: bash shell: bash
setup-versions-from-manifest: setup-versions-from-manifest:
@ -140,10 +141,10 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
go: [1.12.16, 1.13.11, 1.14.3] go: [1.20.14, 1.21.10, 1.22.3]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: setup-go ${{ matrix.go }} - name: setup-go ${{ matrix.go }}
uses: ./ uses: ./
@ -161,10 +162,10 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
go: [1.9, 1.8.6] go: [1.20.14, 1.21]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: setup-go ${{ matrix.go }} - name: setup-go ${{ matrix.go }}
uses: ./ uses: ./
@ -181,9 +182,9 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
go-version: [1.16, 1.17] go-version: [1.20.14, 1.21]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Go and check latest - name: Setup Go and check latest
uses: ./ uses: ./
with: with:

136
.github/workflows/windows-validation.yml vendored Normal file
View File

@ -0,0 +1,136 @@
name: Validate Windows installation
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
create-link-if-not-default:
runs-on: windows-latest
name: 'Validate if symlink is created'
strategy:
matrix:
cache: [false, true]
go: [1.20.1]
steps:
- uses: actions/checkout@v4
- name: 'Setup ${{ matrix.cache }}, cache: ${{ matrix.go }}'
uses: ./
with:
go-version: ${{ matrix.go }}
cache: ${{ matrix.cache }}
- name: 'Drive C: should have zero size link'
run: |
du -m -s 'C:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'
# make sure drive c: contains only a link
size=$(du -m -s 'C:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'|cut -f1 -d$'\t')
if [ $size -ne 0 ];then
echo 'Size of the link created on drive c: must be 0'
exit 1
fi
shell: bash
# Drive D: is small, take care the action does not eat up the space
- name: 'Drive D: space usage should be below 1G'
run: |
du -m -s 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'
size=$(du -m -s 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'|cut -f1 -d$'\t')
# make sure archive does not take lot of space
if [ $size -gt 999 ];then
echo 'Size of installed on drive d: go is too big';
exit 1
fi
shell: bash
# make sure the Go installation has not been changed to the end user
- name: Test paths and environments
run: |
echo $PATH
which go
go version
go env
if [ $(which go) != '/c/hostedtoolcache/windows/go/${{ matrix.go }}/x64/bin/go' ];then
echo 'which go should return "/c/hostedtoolcache/windows/go/${{ matrix.go }}/x64/bin/go"'
exit 1
fi
if [ $(go env GOROOT) != 'C:\hostedtoolcache\windows\go\${{ matrix.go }}\x64' ];then
echo 'go env GOROOT should return "C:\hostedtoolcache\windows\go\${{ matrix.go }}\x64"'
exit 1
fi
shell: bash
find-default-go:
name: 'Find default go version'
runs-on: windows-latest
outputs:
version: ${{ steps.goversion.outputs.version }}
steps:
- run: |
version=`go env GOVERSION|sed s/^go//`
echo "default go version: $version"
echo "version=$version" >> "$GITHUB_OUTPUT"
id: goversion
shell: bash
dont-create-link-if-default:
name: 'Validate if symlink is not created for default go'
runs-on: windows-latest
needs: find-default-go
strategy:
matrix:
cache: [false, true]
steps:
- uses: actions/checkout@v4
- name: 'Setup default go, cache: ${{ matrix.cache }}'
uses: ./
with:
go-version: ${{ needs.find-default-go.outputs.version }}
cache: ${{ matrix.cache }}
- name: 'Drive C: should have Go installation, cache: ${{ matrix.cache}}'
run: |
size=$(du -m -s 'C:\hostedtoolcache\windows\go\${{ needs.find-default-go.outputs.version }}\x64'|cut -f1 -d$'\t')
if [ $size -eq 0 ];then
echo 'Size of the hosted go installed on drive c: must be above zero'
exit 1
fi
shell: bash
- name: 'Drive D: should not have Go installation, cache: ${{ matrix.cache }}'
run: |
if [ -e 'D:\hostedtoolcache\windows\go\${{ needs.find-default-go.outputs.version }}\x64' ];then
echo 'D:\hostedtoolcache\windows\go\${{ needs.find-default-go.outputs.version }}\x64 should not exist for hosted version of go';
exit 1
fi
shell: bash
hostedtoolcache:
name: 'Validate if hostedtoolcache works as expected'
runs-on: windows-latest
strategy:
matrix:
cache: [false]
go: [1.20.1]
steps:
- uses: actions/checkout@v4
- name: 'Setup ${{ matrix.go }}, cache: ${{ matrix.cache }}'
uses: ./
with:
go-version: ${{ matrix.go }}
cache: ${{ matrix.cache }}
- name: 'Setup ${{ matrix.go }}, cache: ${{ matrix.cache }} (from hostedtoolcache)'
uses: ./
with:
go-version: ${{ matrix.go }}
cache: ${{ matrix.cache }}

View File

@ -1,39 +0,0 @@
name: build-test
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
run:
name: Run
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node 16
uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- name: npm ci
run: npm ci
- name: Lint
run: npm run format-check
- name: npm test
run: npm test
- name: audit packages
run: npm audit --audit-level=high
if: matrix.operating-system == 'ubuntu-latest'

View File

@ -1,6 +1,6 @@
--- ---
name: "@actions/cache" name: "@actions/cache"
version: 3.0.0 version: 3.2.4
type: npm type: npm
summary: Actions cache lib summary: Actions cache lib
homepage: https://github.com/actions/toolkit/tree/main/packages/cache homepage: https://github.com/actions/toolkit/tree/main/packages/cache

View File

@ -1,6 +1,6 @@
--- ---
name: "@actions/core" name: "@actions/core"
version: 1.10.0 version: 1.10.1
type: npm type: npm
summary: Actions core lib summary: Actions core lib
homepage: https://github.com/actions/toolkit/tree/main/packages/core homepage: https://github.com/actions/toolkit/tree/main/packages/core

View File

@ -1,6 +1,6 @@
--- ---
name: "@actions/glob" name: "@actions/glob"
version: 0.2.1 version: 0.4.0
type: npm type: npm
summary: Actions glob lib summary: Actions glob lib
homepage: https://github.com/actions/toolkit/tree/main/packages/glob homepage: https://github.com/actions/toolkit/tree/main/packages/glob

View File

@ -1,32 +0,0 @@
---
name: "@actions/http-client"
version: 1.0.11
type: npm
summary: Actions Http Client
homepage: https://github.com/actions/http-client#readme
license: mit
licenses:
- sources: LICENSE
text: |
Actions Http Client for Node.js
Copyright (c) GitHub, Inc.
All rights reserved.
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.
notices: []

View File

@ -1,6 +1,6 @@
--- ---
name: "@actions/http-client" name: "@actions/http-client"
version: 2.0.1 version: 2.2.1
type: npm type: npm
summary: Actions Http Client summary: Actions Http Client
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client homepage: https://github.com/actions/toolkit/tree/main/packages/http-client

View File

@ -1,6 +1,6 @@
--- ---
name: "@actions/io" name: "@actions/io"
version: 1.1.2 version: 1.1.3
type: npm type: npm
summary: Actions io lib summary: Actions io lib
homepage: https://github.com/actions/toolkit/tree/main/packages/io homepage: https://github.com/actions/toolkit/tree/main/packages/io

View File

@ -1,6 +1,6 @@
--- ---
name: "@actions/tool-cache" name: "@actions/tool-cache"
version: 1.7.2 version: 2.0.1
type: npm type: npm
summary: Actions tool-cache lib summary: Actions tool-cache lib
homepage: https://github.com/actions/toolkit/tree/main/packages/tool-cache homepage: https://github.com/actions/toolkit/tree/main/packages/tool-cache

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/abort-controller" name: "@azure/abort-controller"
version: 1.0.4 version: 1.1.0
type: npm type: npm
summary: Microsoft Azure SDK for JavaScript - Aborter summary: Microsoft Azure SDK for JavaScript - Aborter
homepage: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/core/abort-controller/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/core/abort-controller/README.md

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/core-auth" name: "@azure/core-auth"
version: 1.3.2 version: 1.5.0
type: npm type: npm
summary: Provides low-level interfaces and helper methods for authentication in Azure summary: Provides low-level interfaces and helper methods for authentication in Azure
SDK SDK

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/core-http" name: "@azure/core-http"
version: 2.2.4 version: 3.0.4
type: npm type: npm
summary: Isomorphic client Runtime for Typescript/node.js/browser javascript client summary: Isomorphic client Runtime for Typescript/node.js/browser javascript client
libraries generated using AutoRest libraries generated using AutoRest

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/core-lro" name: "@azure/core-lro"
version: 2.2.4 version: 2.5.4
type: npm type: npm
summary: Isomorphic client library for supporting long-running operations in node.js summary: Isomorphic client library for supporting long-running operations in node.js
and browser. and browser.

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/core-paging" name: "@azure/core-paging"
version: 1.2.1 version: 1.5.0
type: npm type: npm
summary: Core types for paging async iterable iterators summary: Core types for paging async iterable iterators
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-paging/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-paging/README.md

View File

@ -1,9 +1,9 @@
--- ---
name: "@azure/core-asynciterator-polyfill" name: "@azure/core-util"
version: 1.0.2 version: 1.6.1
type: npm type: npm
summary: Polyfill for IE/Node 8 for Symbol.asyncIterator summary: Core library for shared utility methods
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-asynciterator-polyfill/README.md homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-util/
license: mit license: mit
licenses: licenses:
- sources: LICENSE - sources: LICENSE

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/logger" name: "@azure/logger"
version: 1.0.3 version: 1.0.4
type: npm type: npm
summary: Microsoft Azure SDK for JavaScript - Logger summary: Microsoft Azure SDK for JavaScript - Logger
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger/README.md

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/ms-rest-js" name: "@azure/ms-rest-js"
version: 2.6.1 version: 2.7.0
type: npm type: npm
summary: Isomorphic client Runtime for Typescript/node.js/browser javascript client summary: Isomorphic client Runtime for Typescript/node.js/browser javascript client
libraries generated using AutoRest libraries generated using AutoRest

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/storage-blob" name: "@azure/storage-blob"
version: 12.9.0 version: 12.17.0
type: npm type: npm
summary: Microsoft Azure Storage SDK for JavaScript - Blob summary: Microsoft Azure Storage SDK for JavaScript - Blob
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/ homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/

30
.licenses/npm/@fastify/busboy.dep.yml generated Normal file
View File

@ -0,0 +1,30 @@
---
name: "@fastify/busboy"
version: 2.1.0
type: npm
summary: A streaming parser for HTML form data for node.js
homepage:
license: mit
licenses:
- sources: LICENSE
text: |-
Copyright Brian White. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
notices: []

View File

@ -1,9 +1,9 @@
--- ---
name: "@opentelemetry/api" name: "@opentelemetry/api"
version: 1.0.4 version: 1.7.0
type: npm type: npm
summary: Public API for OpenTelemetry summary: Public API for OpenTelemetry
homepage: https://github.com/open-telemetry/opentelemetry-js-api#readme homepage: https://github.com/open-telemetry/opentelemetry-js/tree/main/api
license: apache-2.0 license: apache-2.0
licenses: licenses:
- sources: LICENSE - sources: LICENSE
@ -216,10 +216,8 @@ licenses:
[opentelemetry-js]: https://github.com/open-telemetry/opentelemetry-js [opentelemetry-js]: https://github.com/open-telemetry/opentelemetry-js
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions [discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js-api/blob/main/LICENSE [license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/api/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat [license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/api [docs-tracing]: https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/tracing.md
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fapi.svg [docs-sdk-registration]: https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/sdk-registration.md
[docs-tracing]: https://github.com/open-telemetry/opentelemetry-js-api/blob/main/docs/tracing.md
[docs-sdk-registration]: https://github.com/open-telemetry/opentelemetry-js-api/blob/main/docs/sdk-registration.md
notices: [] notices: []

View File

@ -1,6 +1,6 @@
--- ---
name: "@types/node-fetch" name: "@types/node-fetch"
version: 2.6.1 version: 2.6.9
type: npm type: npm
summary: TypeScript definitions for node-fetch summary: TypeScript definitions for node-fetch
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch

View File

@ -1,8 +1,8 @@
--- ---
name: "@types/node" name: "@types/node"
version: 16.11.26 version: 20.11.28
type: npm type: npm
summary: TypeScript definitions for Node.js summary: TypeScript definitions for node
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
license: mit license: mit
licenses: licenses:

View File

@ -1,33 +0,0 @@
---
name: form-data
version: 3.0.1
type: npm
summary: A library to create readable "multipart/form-data" streams. Can be used to
submit forms and file uploads to other web applications.
homepage: https://github.com/form-data/form-data#readme
license: mit
licenses:
- sources: License
text: |
Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors
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: Form-Data is released under the [MIT](License) license.
notices: []

26
.licenses/npm/lru-cache.dep.yml generated Normal file
View File

@ -0,0 +1,26 @@
---
name: lru-cache
version: 6.0.0
type: npm
summary: A cache object that deletes the least-recently-used items.
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: []

View File

@ -1,6 +1,6 @@
--- ---
name: node-fetch name: node-fetch
version: 2.6.7 version: 2.7.0
type: npm type: npm
summary: A light-weight module that brings window.fetch to node.js summary: A light-weight module that brings window.fetch to node.js
homepage: https://github.com/bitinn/node-fetch homepage: https://github.com/bitinn/node-fetch

View File

@ -1,43 +0,0 @@
---
name: psl
version: 1.8.0
type: npm
summary: Domain name parser based on the Public Suffix List
homepage: https://github.com/lupomontero/psl#readme
license: mit
licenses:
- sources: LICENSE
text: |
The MIT License (MIT)
Copyright (c) 2017 Lupo Montero lupomontero@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- sources: README.md
text: |-
The MIT License (MIT)
Copyright (c) 2017 Lupo Montero <lupomontero@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
notices: []

View File

@ -1,34 +0,0 @@
---
name: punycode
version: 2.1.1
type: npm
summary: A robust Punycode converter that fully complies to RFC 3492 and RFC 5891,
and works on nearly all JavaScript platforms.
homepage: https://mths.be/punycode
license: mit
licenses:
- sources: LICENSE-MIT.txt
text: |
Copyright Mathias Bynens <https://mathiasbynens.be/>
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: Punycode.js is available under the [MIT](https://mths.be/mit) license.
notices: []

View File

@ -1,16 +1,16 @@
--- ---
name: sax name: sax
version: 1.2.4 version: 1.3.0
type: npm type: npm
summary: An evented streaming XML parser in JavaScript summary: An evented streaming XML parser in JavaScript
homepage: https://github.com/isaacs/sax-js#readme homepage:
license: isc license: isc
licenses: licenses:
- sources: LICENSE - sources: LICENSE
text: | text: |
The ISC License The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above purpose with or without fee is hereby granted, provided that the above
@ -29,7 +29,7 @@ licenses:
`String.fromCodePoint` by Mathias Bynens used according to terms of MIT `String.fromCodePoint` by Mathias Bynens used according to terms of MIT
License, as follows: License, as follows:
Copyright Mathias Bynens <https://mathiasbynens.be/> Copyright (c) 2010-2022 Mathias Bynens <https://mathiasbynens.be/>
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the

View File

@ -1,9 +1,9 @@
--- ---
name: semver name: semver
version: 6.3.0 version: 6.3.1
type: npm type: npm
summary: The semantic version parser used by npm. summary: The semantic version parser used by npm.
homepage: https://github.com/npm/node-semver#readme homepage:
license: isc license: isc
licenses: licenses:
- sources: LICENSE - sources: LICENSE

26
.licenses/npm/semver-7.6.0.dep.yml generated Normal file
View File

@ -0,0 +1,26 @@
---
name: semver
version: 7.6.0
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: []

View File

@ -1,23 +0,0 @@
---
name: tough-cookie
version: 3.0.1
type: npm
summary: RFC6265 Cookies and Cookie Jar for node.js
homepage: https://github.com/salesforce/tough-cookie
license: bsd-3-clause
licenses:
- sources: LICENSE
text: |
Copyright (c) 2015, Salesforce.com, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
notices: []

View File

@ -1,23 +0,0 @@
---
name: tough-cookie
version: 4.0.0
type: npm
summary: RFC6265 Cookies and Cookie Jar for node.js
homepage: https://github.com/salesforce/tough-cookie
license: bsd-3-clause
licenses:
- sources: LICENSE
text: |
Copyright (c) 2015, Salesforce.com, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
notices: []

View File

@ -1,6 +1,6 @@
--- ---
name: tslib name: tslib
version: 2.3.1 version: 2.6.2
type: npm type: npm
summary: Runtime library for TypeScript helper functions summary: Runtime library for TypeScript helper functions
homepage: https://www.typescriptlang.org/ homepage: https://www.typescriptlang.org/
@ -22,7 +22,7 @@ licenses:
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
notices: notices:
- sources: CopyrightNotice.txt - sources: CopyrightNotice.txt
text: "/*! *****************************************************************************\r\nCopyright text: "/******************************************************************************\r\nCopyright
(c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute
this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE
SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD

30
.licenses/npm/undici-types.dep.yml generated Normal file
View File

@ -0,0 +1,30 @@
---
name: undici-types
version: 5.26.5
type: npm
summary: A stand-alone types package for Undici
homepage: https://undici.nodejs.org
license: mit
licenses:
- sources: Auto-generated MIT license text
text: |
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.
notices: []

View File

@ -1,16 +1,16 @@
--- ---
name: ip-regex name: undici
version: 2.1.0 version: 5.28.3
type: npm type: npm
summary: Regular expression for matching IP addresses (IPv4 & IPv6) summary: An HTTP/1.1 client, written from scratch for Node.js
homepage: https://github.com/sindresorhus/ip-regex#readme homepage: https://undici.nodejs.org
license: mit license: mit
licenses: licenses:
- sources: license - sources: LICENSE
text: | text: |
The MIT License (MIT) MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) Copyright (c) Matteo Collina and Undici contributors
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -19,16 +19,16 @@ licenses:
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in all
all copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 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 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
THE SOFTWARE. SOFTWARE.
- sources: readme.md - sources: README.md
text: MIT © [Sindre Sorhus](https://sindresorhus.com) text: MIT
notices: [] notices: []

View File

@ -1,33 +0,0 @@
---
name: universalify
version: 0.1.2
type: npm
summary: Make a callback- or promise-based function support both promises and callbacks.
homepage: https://github.com/RyanZim/universalify#readme
license: mit
licenses:
- sources: LICENSE
text: |
(The MIT License)
Copyright (c) 2017, Ryan Zimmerman <opensrc@ryanzim.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the 'Software'), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- sources: README.md
text: MIT
notices: []

View File

@ -1,6 +1,6 @@
--- ---
name: xml2js name: xml2js
version: 0.4.23 version: 0.5.0
type: npm type: npm
summary: Simple XML to JavaScript object converter. summary: Simple XML to JavaScript object converter.
homepage: https://github.com/Leonidas-from-XIV/node-xml2js homepage: https://github.com/Leonidas-from-XIV/node-xml2js

26
.licenses/npm/yallist.dep.yml generated Normal file
View File

@ -0,0 +1,26 @@
---
name: yallist
version: 4.0.0
type: npm
summary: Yet Another Linked List
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: []

7
.prettierignore Normal file
View File

@ -0,0 +1,7 @@
# Ignore list
/*
# Do not ignore these folders:
!__tests__/
!.github/
!src/

11
.prettierrc.js Normal file
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'
};

View File

@ -1,11 +0,0 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
}

View File

@ -1 +1 @@
* @actions/actions-service * @actions/setup-actions-team

163
README.md
View File

@ -1,6 +1,6 @@
# setup-go # setup-go
[![build-test](https://github.com/actions/setup-go/actions/workflows/workflow.yml/badge.svg)](https://github.com/actions/setup-go/actions/workflows/workflow.yml) [![Basic validation](https://github.com/actions/setup-go/actions/workflows/basic-validation.yml/badge.svg)](https://github.com/actions/setup-go/actions/workflows/basic-validation.yml)
[![Validate 'setup-go'](https://github.com/actions/setup-go/actions/workflows/versions.yml/badge.svg)](https://github.com/actions/setup-go/actions/workflows/versions.yml) [![Validate 'setup-go'](https://github.com/actions/setup-go/actions/workflows/versions.yml/badge.svg)](https://github.com/actions/setup-go/actions/workflows/versions.yml)
This action sets up a go environment for use in actions by: This action sets up a go environment for use in actions by:
@ -8,6 +8,24 @@ This action sets up a go environment for use in actions by:
- Optionally downloading and caching a version of Go by version and adding to `PATH`. - Optionally downloading and caching a version of Go by version and adding to `PATH`.
- Registering problem matchers for error output. - Registering problem matchers for error output.
# V5
The V5 edition of the action offers:
- Upgraded Node.js runtime from node16 to node20
See full release notes on the [releases page](https://github.com/actions/setup-go/releases).
# V4
The V4 edition of the action offers:
- Enabled caching by default
The action will try to enable caching unless the `cache` input is explicitly set to false.
Please see "[Caching dependency files and build outputs](https://github.com/actions/setup-go#caching-dependency-files-and-build-outputs)" for more information.
# V3 # V3
The V3 edition of the action offers: The V3 edition of the action offers:
@ -19,16 +37,21 @@ The V3 edition of the action offers:
- stable and oldstable aliases - stable and oldstable aliases
- Bug Fixes (including issues around version matching and semver) - Bug Fixes (including issues around version matching and semver)
The action will first check the local cache for a version match. If a version is not found locally, it will pull it from the `main` branch of the [go-versions](https://github.com/actions/go-versions/blob/main/versions-manifest.json) repository. On miss or failure, it will fall back to downloading directly from [go dist](https://storage.googleapis.com/golang). To change the default behavior, please use the [check-latest input](#check-latest-version). The action will first check the local cache for a version match. If a version is not found locally, it will pull it from
the `main` branch of the [go-versions](https://github.com/actions/go-versions/blob/main/versions-manifest.json)
repository. On miss or failure, it will fall back to downloading directly
from [go dist](https://storage.googleapis.com/golang). To change the default behavior, please use
the [check-latest input](#check-latest-version).
**Note:** The `setup-go` action uses executable binaries which are built by Golang side. The action does not build golang from source code. **Note:** The `setup-go` action uses executable binaries which are built by Golang side. The action does not build
golang from source code.
Matching by [semver spec](https://github.com/npm/node-semver): Matching by [semver spec](https://github.com/npm/node-semver):
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-go@v3 - uses: actions/setup-go@v5
with: with:
go-version: '^1.13.1' # The Go version to download (if necessary) and use. go-version: '^1.13.1' # The Go version to download (if necessary) and use.
- run: go version - run: go version
@ -36,19 +59,27 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-go@v3 - uses: actions/setup-go@v5
with: with:
go-version: '>=1.17.0' go-version: '>=1.17.0'
- run: go version - run: go version
``` ```
> **Note**: Due to the peculiarities of YAML parsing, it is recommended to wrap the version in single quotation marks:
>
> ```yaml
> go-version: '1.20'
> ```
>
> The recommendation is based on the YAML parser's behavior, which interprets non-wrapped values as numbers and, in the case of version 1.20, trims it down to 1.2, which may not be very obvious.
Matching an unstable pre-release: Matching an unstable pre-release:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-go@v3 - uses: actions/setup-go@v5
with: with:
go-version: '1.18.0-rc.1' # The Go version to download (if necessary) and use. go-version: '1.18.0-rc.1' # The Go version to download (if necessary) and use.
- run: go version - run: go version
@ -56,8 +87,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-go@v3 - uses: actions/setup-go@v5
with: with:
go-version: '1.16.0-beta.1' # The Go version to download (if necessary) and use. go-version: '1.16.0-beta.1' # The Go version to download (if necessary) and use.
- run: go version - run: go version
@ -71,26 +102,29 @@ See [action.yml](action.yml)
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-go@v3 - uses: actions/setup-go@v5
with: with:
go-version: '1.16.1' # The Go version to download (if necessary) and use. go-version: '1.16.1' # The Go version to download (if necessary) and use.
- run: go run hello.go - run: go run hello.go
``` ```
## Check latest version ## Check latest version
The `check-latest` flag defaults to `false`. Use the default or set `check-latest` to `false` if you prefer stability and if you want to ensure a specific Go version is always used. The `check-latest` flag defaults to `false`. Use the default or set `check-latest` to `false` if you prefer stability
and if you want to ensure a specific Go version is always used.
If `check-latest` is set to `true`, the action first checks if the cached version is the latest one. If the locally cached version is not the most up-to-date, a Go version will then be downloaded. Set `check-latest` to `true` if you want the most up-to-date Go version to always be used. If `check-latest` is set to `true`, the action first checks if the cached version is the latest one. If the locally
cached version is not the most up-to-date, a Go version will then be downloaded. Set `check-latest` to `true` if you
want the most up-to-date Go version to always be used.
> Setting `check-latest` to `true` has performance implications as downloading Go versions is slower than using cached versions. > Setting `check-latest` to `true` has performance implications as downloading Go versions is slower than using cached
> versions.
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-go@v3 - uses: actions/setup-go@v5
with: with:
go-version: '1.14' go-version: '1.14'
check-latest: true check-latest: true
@ -99,16 +133,19 @@ steps:
## Using stable/oldstable aliases ## Using stable/oldstable aliases
If `stable` is provided, action will get the latest stable version from the [`go-versions`](https://github.com/actions/go-versions/blob/main/versions-manifest.json) repository manifest. If `stable` is provided, action will get the latest stable version from
the [`go-versions`](https://github.com/actions/go-versions/blob/main/versions-manifest.json) repository manifest.
If `oldstable` is provided, when current release is 1.19.x, action will resolve version as 1.18.x, where x is the latest patch release. If `oldstable` is provided, when current release is 1.19.x, action will resolve version as 1.18.x, where x is the latest
patch release.
**Note:** using these aliases will result in same version as using corresponding minor release with `check-latest` input set to `true` **Note:** using these aliases will result in same version as using corresponding minor release with `check-latest` input
set to `true`
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-go@v3 - uses: actions/setup-go@v5
with: with:
go-version: 'stable' go-version: 'stable'
- run: go run hello.go - run: go run hello.go
@ -116,8 +153,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-go@v3 - uses: actions/setup-go@v5
with: with:
go-version: 'oldstable' go-version: 'oldstable'
- run: go run hello.go - run: go run hello.go
@ -125,45 +162,50 @@ steps:
## Caching dependency files and build outputs: ## Caching dependency files and build outputs:
The action has a built-in functionality for caching and restoring go modules and build outputs. It uses [actions/cache](https://github.com/actions/cache) under the hood but requires less configuration settings. The `cache` input is optional, and caching is turned off by default. The action has a built-in functionality for caching and restoring go modules and build outputs. It
uses [toolkit/cache](https://github.com/actions/toolkit/tree/main/packages/cache) under the hood but requires less configuration settings.
The `cache` input is optional, and caching is turned on by default.
The action defaults to search for the dependency file - go.sum in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` input for cases when multiple dependency files are used, or they are located in different subdirectories. The action defaults to search for the dependency file - go.sum in the repository root, and uses its hash as a part of
the cache key. Use `cache-dependency-path` input for cases when multiple dependency files are used, or they are located
in different subdirectories. The input supports glob patterns.
**Caching without specifying dependency file path** If some problem that prevents success caching happens then the action issues the warning in the log and continues the execution of the pipeline.
```yaml
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.17'
check-latest: true
cache: true
- run: go run hello.go
```
**Caching in monorepos** **Caching in monorepos**
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-go@v3 - uses: actions/setup-go@v5
with: with:
go-version: '1.17' go-version: '1.17'
check-latest: true check-latest: true
cache: true cache-dependency-path: |
cache-dependency-path: subdir/go.sum subdir/go.sum
tools/go.sum
# cache-dependency-path: "**/*.sum"
- run: go run hello.go - run: go run hello.go
``` ```
## Getting go version from the go.mod file ## Getting go version from the go.mod file
The `go-version-file` input accepts a path to a `go.mod` file or a `go.work` file that contains the version of Go to be used by a project. As the `go.mod` file contains only major and minor (e.g. 1.18) tags, the action will search for the latest available patch version sequentially in the runner's directory with the cached tools, in the [version-manifest.json](https://github.com/actions/go-versions/blob/main/versions-manifest.json) file or at the go servers. The `go-version-file` input accepts a path to a `go.mod` file or a `go.work` file that contains the version of Go to be used by a project.
The `go` directive in `go.mod` can specify a patch version or omit it altogether (e.g., `go 1.22.0` or `go 1.22`).
If a patch version is specified, that specific patch version will be used.
If no patch version is specified, it will search for the latest available patch version in the cache,
[versions-manifest.json](https://github.com/actions/go-versions/blob/main/versions-manifest.json), and the
[official Go language website](https://golang.org/dl/?mode=json&include=all), in that order.
If both the `go-version` and the `go-version-file` inputs are provided then the `go-version` input is used. If both the `go-version` and the `go-version-file` inputs are provided then the `go-version` input is used.
> The action will search for the `go.mod` file relative to the repository root > The action will search for the `go.mod` file relative to the repository root
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-go@v3 - uses: actions/setup-go@v5
with: with:
go-version-file: 'path/to/go.mod' go-version-file: 'path/to/go.mod'
- run: go version - run: go version
@ -180,9 +222,9 @@ jobs:
go: [ '1.14', '1.13' ] go: [ '1.14', '1.13' ]
name: Go ${{ matrix.go }} sample name: Go ${{ matrix.go }} sample
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup go - name: Setup go
uses: actions/setup-go@v3 uses: actions/setup-go@v5
with: with:
go-version: ${{ matrix.go }} go-version: ${{ matrix.go }}
- run: go run hello.go - run: go run hello.go
@ -195,22 +237,35 @@ The `go-version` input supports the following syntax:
- Specific versions: `1.15`, `1.16.1`, `1.17.0-rc.2`, `1.16.0-beta.1` - Specific versions: `1.15`, `1.16.1`, `1.17.0-rc.2`, `1.16.0-beta.1`
- SemVer's version range syntax: `^1.13.1`, `>=1.18.0-rc.1` - SemVer's version range syntax: `^1.13.1`, `>=1.18.0-rc.1`
For more information about semantic versioning, please refer to [semver](https://github.com/npm/node-semver) documentation. For more information about semantic versioning, please refer to [semver](https://github.com/npm/node-semver)
documentation.
## Using `setup-go` on GHES ## Using `setup-go` on GHES
`setup-go` comes pre-installed on the appliance with GHES if Actions is enabled. When dynamically downloading Go distributions, `setup-go` downloads distributions from [`actions/go-versions`](https://github.com/actions/go-versions) on github.com (outside of the appliance). These calls to `actions/go-versions` are made via unauthenticated requests, which are limited to [60 requests per hour per IP](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting). If more requests are made within the time frame, then you will start to see rate-limit errors during downloading that looks like: `##[error]API rate limit exceeded for...`. After that error the action will try to download versions directly from https://storage.googleapis.com/golang, but it also can have rate limit so it's better to put token. `setup-go` comes pre-installed on the appliance with GHES if Actions is enabled. When dynamically downloading Go
distributions, `setup-go` downloads distributions from [`actions/go-versions`](https://github.com/actions/go-versions)
on github.com (outside of the appliance). These calls to `actions/go-versions` are made via unauthenticated requests,
which are limited
to [60 requests per hour per IP](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting). If
more requests are made within the time frame, then you will start to see rate-limit errors during downloading that looks
like: `##[error]API rate limit exceeded for...`. After that error the action will try to download versions directly
from https://storage.googleapis.com/golang, but it also can have rate limit so it's better to put token.
To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action: To get a higher rate limit, you
can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token`
input for the action:
```yaml ```yaml
uses: actions/setup-go@v3 uses: actions/setup-go@v5
with: with:
token: ${{ secrets.GH_DOTCOM_TOKEN }} token: ${{ secrets.GH_DOTCOM_TOKEN }}
go-version: 1.18 go-version: '1.18'
``` ```
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. 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.
# License # License

View File

@ -8,14 +8,14 @@ import {PackageManagerInfo} from '../src/package-managers';
describe('restoreCache', () => { describe('restoreCache', () => {
//Arrange //Arrange
let hashFilesSpy = jest.spyOn(glob, 'hashFiles'); const hashFilesSpy = jest.spyOn(glob, 'hashFiles');
let getCacheDirectoryPathSpy = jest.spyOn( const getCacheDirectoryPathSpy = jest.spyOn(
cacheUtils, cacheUtils,
'getCacheDirectoryPath' 'getCacheDirectoryPath'
); );
let restoreCacheSpy = jest.spyOn(cache, 'restoreCache'); const restoreCacheSpy = jest.spyOn(cache, 'restoreCache');
let infoSpy = jest.spyOn(core, 'info'); const infoSpy = jest.spyOn(core, 'info');
let setOutputSpy = jest.spyOn(core, 'setOutput'); const setOutputSpy = jest.spyOn(core, 'setOutput');
const versionSpec = '1.13.1'; const versionSpec = '1.13.1';
const packageManager = 'default'; const packageManager = 'default';
@ -40,13 +40,13 @@ describe('restoreCache', () => {
}); });
//Act + Assert //Act + Assert
expect(async () => { await expect(async () => {
await cacheRestore.restoreCache( await cacheRestore.restoreCache(
versionSpec, versionSpec,
packageManager, packageManager,
cacheDependencyPath cacheDependencyPath
); );
}).rejects.toThrowError( }).rejects.toThrow(
'Some specified paths were not resolved, unable to cache dependencies.' 'Some specified paths were not resolved, unable to cache dependencies.'
); );
}); });
@ -71,7 +71,7 @@ describe('restoreCache', () => {
packageManager, packageManager,
cacheDependencyPath cacheDependencyPath
); );
expect(infoSpy).toBeCalledWith(`Cache is not found`); expect(infoSpy).toHaveBeenCalledWith(`Cache is not found`);
}); });
it('should set output if cache hit is occured', async () => { it('should set output if cache hit is occured', async () => {
@ -94,6 +94,6 @@ describe('restoreCache', () => {
packageManager, packageManager,
cacheDependencyPath cacheDependencyPath
); );
expect(setOutputSpy).toBeCalledWith('cache-hit', true); expect(setOutputSpy).toHaveBeenCalledWith('cache-hit', true);
}); });
}); });

View File

@ -6,7 +6,7 @@ import {PackageManagerInfo} from '../src/package-managers';
describe('getCommandOutput', () => { describe('getCommandOutput', () => {
//Arrange //Arrange
let getExecOutputSpy = jest.spyOn(exec, 'getExecOutput'); const getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
it('should return trimmed stdout in case of successful exit code', async () => { it('should return trimmed stdout in case of successful exit code', async () => {
//Arrange //Arrange
@ -36,7 +36,7 @@ describe('getCommandOutput', () => {
}); });
//Act + Assert //Act + Assert
expect(async () => { await expect(async () => {
await cacheUtils.getCommandOutput('command'); await cacheUtils.getCommandOutput('command');
}).rejects.toThrow(); }).rejects.toThrow();
}); });
@ -62,7 +62,7 @@ describe('getPackageManagerInfo', () => {
const packageManagerName = 'invalidName'; const packageManagerName = 'invalidName';
//Act + Assert //Act + Assert
expect(async () => { await expect(async () => {
await cacheUtils.getPackageManagerInfo(packageManagerName); await cacheUtils.getPackageManagerInfo(packageManagerName);
}).rejects.toThrow(); }).rejects.toThrow();
}); });
@ -70,7 +70,7 @@ describe('getPackageManagerInfo', () => {
describe('getCacheDirectoryPath', () => { describe('getCacheDirectoryPath', () => {
//Arrange //Arrange
let getExecOutputSpy = jest.spyOn(exec, 'getExecOutput'); const getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
const validPackageManager: PackageManagerInfo = { const validPackageManager: PackageManagerInfo = {
dependencyFilePattern: 'go.sum', dependencyFilePattern: 'go.sum',
@ -93,6 +93,41 @@ describe('getCacheDirectoryPath', () => {
.then(data => expect(data).toEqual(expectedResult)); .then(data => expect(data).toEqual(expectedResult));
}); });
it('should return path to the cache folder if one command return empty str', async () => {
//Arrange
getExecOutputSpy.mockImplementationOnce((commandLine: string) => {
return new Promise<exec.ExecOutput>(resolve => {
resolve({exitCode: 0, stdout: 'path/to/cache/folder', stderr: ''});
});
});
getExecOutputSpy.mockImplementationOnce((commandLine: string) => {
return new Promise<exec.ExecOutput>(resolve => {
resolve({exitCode: 0, stdout: '', stderr: ''});
});
});
const expectedResult = ['path/to/cache/folder'];
//Act + Assert
return cacheUtils
.getCacheDirectoryPath(validPackageManager)
.then(data => expect(data).toEqual(expectedResult));
});
it('should throw if the both commands return empty str', async () => {
getExecOutputSpy.mockImplementation((commandLine: string) => {
return new Promise<exec.ExecOutput>(resolve => {
resolve({exitCode: 10, stdout: '', stderr: ''});
});
});
//Act + Assert
await expect(async () => {
await cacheUtils.getCacheDirectoryPath(validPackageManager);
}).rejects.toThrow();
});
it('should throw if the specified package name is invalid', async () => { it('should throw if the specified package name is invalid', async () => {
getExecOutputSpy.mockImplementation((commandLine: string) => { getExecOutputSpy.mockImplementation((commandLine: string) => {
return new Promise<exec.ExecOutput>(resolve => { return new Promise<exec.ExecOutput>(resolve => {
@ -101,7 +136,7 @@ describe('getCacheDirectoryPath', () => {
}); });
//Act + Assert //Act + Assert
expect(async () => { await expect(async () => {
await cacheUtils.getCacheDirectoryPath(validPackageManager); await cacheUtils.getCacheDirectoryPath(validPackageManager);
}).rejects.toThrow(); }).rejects.toThrow();
}); });
@ -109,8 +144,8 @@ describe('getCacheDirectoryPath', () => {
describe('isCacheFeatureAvailable', () => { describe('isCacheFeatureAvailable', () => {
//Arrange //Arrange
let isFeatureAvailableSpy = jest.spyOn(cache, 'isFeatureAvailable'); const isFeatureAvailableSpy = jest.spyOn(cache, 'isFeatureAvailable');
let warningSpy = jest.spyOn(core, 'warning'); const warningSpy = jest.spyOn(core, 'warning');
it('should return true when cache feature is available', () => { it('should return true when cache feature is available', () => {
//Arrange //Arrange
@ -118,10 +153,8 @@ describe('isCacheFeatureAvailable', () => {
return true; return true;
}); });
let functionResult;
//Act //Act
functionResult = cacheUtils.isCacheFeatureAvailable(); const functionResult = cacheUtils.isCacheFeatureAvailable();
//Assert //Assert
expect(functionResult).toBeTruthy(); expect(functionResult).toBeTruthy();
@ -135,7 +168,7 @@ describe('isCacheFeatureAvailable', () => {
process.env['GITHUB_SERVER_URL'] = 'https://github.com'; process.env['GITHUB_SERVER_URL'] = 'https://github.com';
let warningMessage = const warningMessage =
'The runner was not able to contact the cache service. Caching will be skipped'; 'The runner was not able to contact the cache service. Caching will be skipped';
//Act //Act
@ -153,16 +186,14 @@ describe('isCacheFeatureAvailable', () => {
process.env['GITHUB_SERVER_URL'] = 'https://github.com'; process.env['GITHUB_SERVER_URL'] = 'https://github.com';
let functionResult;
//Act //Act
functionResult = cacheUtils.isCacheFeatureAvailable(); const functionResult = cacheUtils.isCacheFeatureAvailable();
//Assert //Assert
expect(functionResult).toBeFalsy(); expect(functionResult).toBeFalsy();
}); });
it('should throw when cache feature is unavailable and GHES is used', () => { it('should warn when cache feature is unavailable and GHES is used', () => {
//Arrange //Arrange
isFeatureAvailableSpy.mockImplementation(() => { isFeatureAvailableSpy.mockImplementation(() => {
return false; return false;
@ -170,10 +201,11 @@ describe('isCacheFeatureAvailable', () => {
process.env['GITHUB_SERVER_URL'] = 'https://nongithub.com'; process.env['GITHUB_SERVER_URL'] = 'https://nongithub.com';
let errorMessage = const warningMessage =
'Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'; 'Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.';
//Act + Assert //Act + Assert
expect(() => cacheUtils.isCacheFeatureAvailable()).toThrow(errorMessage); expect(cacheUtils.isCacheFeatureAvailable()).toBeFalsy();
expect(warningSpy).toHaveBeenCalledWith(warningMessage);
}); });
}); });

View File

@ -1,6 +1,6 @@
module example.com/mymodule module example.com/mymodule
go 1.14 go 1.20
require ( require (
example.com/othermodule v1.2.3 example.com/othermodule v1.2.3

View File

@ -1,3 +1,3 @@
go 1.19 go 1.21
use . use .

View File

@ -3,18 +3,20 @@ import * as io from '@actions/io';
import * as tc from '@actions/tool-cache'; import * as tc from '@actions/tool-cache';
import fs from 'fs'; import fs from 'fs';
import cp from 'child_process'; import cp from 'child_process';
import osm from 'os'; import osm, {type} from 'os';
import path from 'path'; import path from 'path';
import * as main from '../src/main'; import * as main from '../src/main';
import * as im from '../src/installer'; import * as im from '../src/installer';
let goJsonData = require('./data/golang-dl.json'); import goJsonData from './data/golang-dl.json';
let matchers = require('../matchers.json'); import matchers from '../matchers.json';
let goTestManifest = require('./data/versions-manifest.json'); import goTestManifest from './data/versions-manifest.json';
let matcherPattern = matchers.problemMatcher[0].pattern[0]; const matcherPattern = matchers.problemMatcher[0].pattern[0];
let matcherRegExp = new RegExp(matcherPattern.regexp); const matcherRegExp = new RegExp(matcherPattern.regexp);
let win32Join = path.win32.join; const win32Join = path.win32.join;
let posixJoin = path.posix.join; const posixJoin = path.posix.join;
jest.setTimeout(10000);
describe('setup-go', () => { describe('setup-go', () => {
let inputs = {} as any; let inputs = {} as any;
@ -39,6 +41,8 @@ describe('setup-go', () => {
let existsSpy: jest.SpyInstance; let existsSpy: jest.SpyInstance;
let readFileSpy: jest.SpyInstance; let readFileSpy: jest.SpyInstance;
let mkdirpSpy: jest.SpyInstance; let mkdirpSpy: jest.SpyInstance;
let mkdirSpy: jest.SpyInstance;
let symlinkSpy: jest.SpyInstance;
let execSpy: jest.SpyInstance; let execSpy: jest.SpyInstance;
let getManifestSpy: jest.SpyInstance; let getManifestSpy: jest.SpyInstance;
let getAllVersionsSpy: jest.SpyInstance; let getAllVersionsSpy: jest.SpyInstance;
@ -92,6 +96,11 @@ describe('setup-go', () => {
readFileSpy = jest.spyOn(fs, 'readFileSync'); readFileSpy = jest.spyOn(fs, 'readFileSync');
mkdirpSpy = jest.spyOn(io, 'mkdirP'); mkdirpSpy = jest.spyOn(io, 'mkdirP');
// fs
mkdirSpy = jest.spyOn(fs, 'mkdir');
symlinkSpy = jest.spyOn(fs, 'symlinkSync');
symlinkSpy.mockImplementation(() => {});
// gets // gets
getManifestSpy.mockImplementation(() => <tc.IToolRelease[]>goTestManifest); getManifestSpy.mockImplementation(() => <tc.IToolRelease[]>goTestManifest);
@ -133,7 +142,7 @@ describe('setup-go', () => {
os.platform = 'darwin'; os.platform = 'darwin';
os.arch = 'x64'; os.arch = 'x64';
let match = await im.getInfoFromManifest('1.9.7', true, 'mocktoken'); const match = await im.getInfoFromManifest('1.9.7', true, 'mocktoken');
expect(match).toBeDefined(); expect(match).toBeDefined();
expect(match!.resolvedVersion).toBe('1.9.7'); expect(match!.resolvedVersion).toBe('1.9.7');
expect(match!.type).toBe('manifest'); expect(match!.type).toBe('manifest');
@ -146,7 +155,7 @@ describe('setup-go', () => {
os.platform = 'linux'; os.platform = 'linux';
os.arch = 'x64'; os.arch = 'x64';
let match = await im.getInfoFromManifest('1.9.7', true, 'mocktoken'); const match = await im.getInfoFromManifest('1.9.7', true, 'mocktoken');
expect(match).toBeDefined(); expect(match).toBeDefined();
expect(match!.resolvedVersion).toBe('1.9.7'); expect(match!.resolvedVersion).toBe('1.9.7');
expect(match!.type).toBe('manifest'); expect(match!.type).toBe('manifest');
@ -159,7 +168,7 @@ describe('setup-go', () => {
os.platform = 'win32'; os.platform = 'win32';
os.arch = 'x64'; os.arch = 'x64';
let match = await im.getInfoFromManifest('1.9.7', true, 'mocktoken'); const match = await im.getInfoFromManifest('1.9.7', true, 'mocktoken');
expect(match).toBeDefined(); expect(match).toBeDefined();
expect(match!.resolvedVersion).toBe('1.9.7'); expect(match!.resolvedVersion).toBe('1.9.7');
expect(match!.type).toBe('manifest'); expect(match!.type).toBe('manifest');
@ -173,11 +182,11 @@ describe('setup-go', () => {
os.arch = 'x64'; os.arch = 'x64';
// spec: 1.13.0 => 1.13 // spec: 1.13.0 => 1.13
let match: im.IGoVersion | undefined = await im.findMatch('1.13.0'); const match: im.IGoVersion | undefined = await im.findMatch('1.13.0');
expect(match).toBeDefined(); expect(match).toBeDefined();
let version: string = match ? match.version : ''; const version: string = match ? match.version : '';
expect(version).toBe('go1.13'); expect(version).toBe('go1.13');
let fileName = match ? match.files[0].filename : ''; const fileName = match ? match.files[0].filename : '';
expect(fileName).toBe('go1.13.darwin-amd64.tar.gz'); expect(fileName).toBe('go1.13.darwin-amd64.tar.gz');
}); });
@ -186,11 +195,11 @@ describe('setup-go', () => {
os.arch = 'x64'; os.arch = 'x64';
// spec: 1.13 => 1.13.7 (latest) // spec: 1.13 => 1.13.7 (latest)
let match: im.IGoVersion | undefined = await im.findMatch('1.13'); const match: im.IGoVersion | undefined = await im.findMatch('1.13');
expect(match).toBeDefined(); expect(match).toBeDefined();
let version: string = match ? match.version : ''; const version: string = match ? match.version : '';
expect(version).toBe('go1.13.7'); expect(version).toBe('go1.13.7');
let fileName = match ? match.files[0].filename : ''; const fileName = match ? match.files[0].filename : '';
expect(fileName).toBe('go1.13.7.linux-amd64.tar.gz'); expect(fileName).toBe('go1.13.7.linux-amd64.tar.gz');
}); });
@ -199,11 +208,11 @@ describe('setup-go', () => {
os.arch = 'x64'; os.arch = 'x64';
// spec: ^1.13.6 => 1.13.7 // spec: ^1.13.6 => 1.13.7
let match: im.IGoVersion | undefined = await im.findMatch('^1.13.6'); const match: im.IGoVersion | undefined = await im.findMatch('^1.13.6');
expect(match).toBeDefined(); expect(match).toBeDefined();
let version: string = match ? match.version : ''; const version: string = match ? match.version : '';
expect(version).toBe('go1.13.7'); expect(version).toBe('go1.13.7');
let fileName = match ? match.files[0].filename : ''; const fileName = match ? match.files[0].filename : '';
expect(fileName).toBe('go1.13.7.linux-amd64.tar.gz'); expect(fileName).toBe('go1.13.7.linux-amd64.tar.gz');
}); });
@ -212,11 +221,11 @@ describe('setup-go', () => {
os.arch = 'x32'; os.arch = 'x32';
// spec: 1 => 1.13.7 (latest) // spec: 1 => 1.13.7 (latest)
let match: im.IGoVersion | undefined = await im.findMatch('1'); const match: im.IGoVersion | undefined = await im.findMatch('1');
expect(match).toBeDefined(); expect(match).toBeDefined();
let version: string = match ? match.version : ''; const version: string = match ? match.version : '';
expect(version).toBe('go1.13.7'); expect(version).toBe('go1.13.7');
let fileName = match ? match.files[0].filename : ''; const fileName = match ? match.files[0].filename : '';
expect(fileName).toBe('go1.13.7.windows-386.zip'); expect(fileName).toBe('go1.13.7.windows-386.zip');
}); });
@ -225,11 +234,11 @@ describe('setup-go', () => {
os.arch = 'x64'; os.arch = 'x64';
// spec: 1.14, stable=false => go1.14rc1 // spec: 1.14, stable=false => go1.14rc1
let match: im.IGoVersion | undefined = await im.findMatch('1.14.0-rc.1'); const match: im.IGoVersion | undefined = await im.findMatch('1.14.0-rc.1');
expect(match).toBeDefined(); expect(match).toBeDefined();
let version: string = match ? match.version : ''; const version: string = match ? match.version : '';
expect(version).toBe('go1.14rc1'); expect(version).toBe('go1.14rc1');
let fileName = match ? match.files[0].filename : ''; const fileName = match ? match.files[0].filename : '';
expect(fileName).toBe('go1.14rc1.linux-amd64.tar.gz'); expect(fileName).toBe('go1.14rc1.linux-amd64.tar.gz');
}); });
@ -237,7 +246,7 @@ describe('setup-go', () => {
inputs['go-version'] = '1.13.0'; inputs['go-version'] = '1.13.0';
inputs.stable = 'true'; inputs.stable = 'true';
let toolPath = path.normalize('/cache/go/1.13.0/x64'); const toolPath = path.normalize('/cache/go/1.13.0/x64');
findSpy.mockImplementation(() => toolPath); findSpy.mockImplementation(() => toolPath);
await main.run(); await main.run();
@ -249,7 +258,7 @@ describe('setup-go', () => {
inSpy.mockImplementation(name => inputs[name]); inSpy.mockImplementation(name => inputs[name]);
let toolPath = path.normalize('/cache/go/1.13.0/x64'); const toolPath = path.normalize('/cache/go/1.13.0/x64');
findSpy.mockImplementation(() => toolPath); findSpy.mockImplementation(() => toolPath);
await main.run(); await main.run();
@ -260,10 +269,10 @@ describe('setup-go', () => {
inputs['go-version'] = '1.13.0'; inputs['go-version'] = '1.13.0';
inSpy.mockImplementation(name => inputs[name]); inSpy.mockImplementation(name => inputs[name]);
let toolPath = path.normalize('/cache/go/1.13.0/x64'); const toolPath = path.normalize('/cache/go/1.13.0/x64');
findSpy.mockImplementation(() => toolPath); findSpy.mockImplementation(() => toolPath);
let vars: {[key: string]: string} = {}; const vars: {[key: string]: string} = {};
exportVarSpy.mockImplementation((name: string, val: string) => { exportVarSpy.mockImplementation((name: string, val: string) => {
vars[name] = val; vars[name] = val;
}); });
@ -276,10 +285,10 @@ describe('setup-go', () => {
inputs['go-version'] = '1.8'; inputs['go-version'] = '1.8';
inSpy.mockImplementation(name => inputs[name]); inSpy.mockImplementation(name => inputs[name]);
let toolPath = path.normalize('/cache/go/1.8.0/x64'); const toolPath = path.normalize('/cache/go/1.8.0/x64');
findSpy.mockImplementation(() => toolPath); findSpy.mockImplementation(() => toolPath);
let vars: {[key: string]: string} = {}; const vars: {[key: string]: string} = {};
exportVarSpy.mockImplementation((name: string, val: string) => { exportVarSpy.mockImplementation((name: string, val: string) => {
vars[name] = val; vars[name] = val;
}); });
@ -293,7 +302,7 @@ describe('setup-go', () => {
it('finds a version of go already in the cache', async () => { it('finds a version of go already in the cache', async () => {
inputs['go-version'] = '1.13.0'; inputs['go-version'] = '1.13.0';
let toolPath = path.normalize('/cache/go/1.13.0/x64'); const toolPath = path.normalize('/cache/go/1.13.0/x64');
findSpy.mockImplementation(() => toolPath); findSpy.mockImplementation(() => toolPath);
await main.run(); await main.run();
@ -302,16 +311,16 @@ describe('setup-go', () => {
it('finds a version in the cache and adds it to the path', async () => { it('finds a version in the cache and adds it to the path', async () => {
inputs['go-version'] = '1.13.0'; inputs['go-version'] = '1.13.0';
let toolPath = path.normalize('/cache/go/1.13.0/x64'); const toolPath = path.normalize('/cache/go/1.13.0/x64');
findSpy.mockImplementation(() => toolPath); findSpy.mockImplementation(() => toolPath);
await main.run(); await main.run();
let expPath = path.join(toolPath, 'bin'); const expPath = path.join(toolPath, 'bin');
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
}); });
it('handles unhandled error and reports error', async () => { it('handles unhandled error and reports error', async () => {
let errMsg = 'unhandled error message'; const errMsg = 'unhandled error message';
inputs['go-version'] = '1.13.0'; inputs['go-version'] = '1.13.0';
findSpy.mockImplementation(() => { findSpy.mockImplementation(() => {
@ -329,12 +338,12 @@ describe('setup-go', () => {
findSpy.mockImplementation(() => ''); findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(() => '/some/temp/path'); dlSpy.mockImplementation(() => '/some/temp/path');
let toolPath = path.normalize('/cache/go/1.13.0/x64'); const toolPath = path.normalize('/cache/go/1.13.0/x64');
extractTarSpy.mockImplementation(() => '/some/other/temp/path'); extractTarSpy.mockImplementation(() => '/some/other/temp/path');
cacheSpy.mockImplementation(() => toolPath); cacheSpy.mockImplementation(() => toolPath);
await main.run(); await main.run();
let expPath = path.join(toolPath, 'bin'); const expPath = path.join(toolPath, 'bin');
expect(dlSpy).toHaveBeenCalled(); expect(dlSpy).toHaveBeenCalled();
expect(extractTarSpy).toHaveBeenCalled(); expect(extractTarSpy).toHaveBeenCalled();
@ -352,12 +361,12 @@ describe('setup-go', () => {
dlSpy.mockImplementation(() => 'C:\\temp\\some\\path'); dlSpy.mockImplementation(() => 'C:\\temp\\some\\path');
extractZipSpy.mockImplementation(() => 'C:\\temp\\some\\other\\path'); extractZipSpy.mockImplementation(() => 'C:\\temp\\some\\other\\path');
let toolPath = path.normalize('C:\\cache\\go\\1.13.0\\x64'); const toolPath = path.normalize('C:\\cache\\go\\1.13.0\\x64');
cacheSpy.mockImplementation(() => toolPath); cacheSpy.mockImplementation(() => toolPath);
await main.run(); await main.run();
let expPath = path.win32.join(toolPath, 'bin'); const expPath = path.win32.join(toolPath, 'bin');
expect(dlSpy).toHaveBeenCalledWith( expect(dlSpy).toHaveBeenCalledWith(
'https://storage.googleapis.com/golang/go1.13.1.windows-amd64.zip', 'https://storage.googleapis.com/golang/go1.13.1.windows-amd64.zip',
'C:\\temp\\go1.13.1.windows-amd64.zip', 'C:\\temp\\go1.13.1.windows-amd64.zip',
@ -384,25 +393,25 @@ describe('setup-go', () => {
os.platform = 'linux'; os.platform = 'linux';
os.arch = 'x64'; os.arch = 'x64';
let versionSpec = '1.12.16'; const versionSpec = '1.12.16';
inputs['go-version'] = versionSpec; inputs['go-version'] = versionSpec;
inputs['token'] = 'faketoken'; inputs['token'] = 'faketoken';
let expectedUrl = const expectedUrl =
'https://github.com/actions/go-versions/releases/download/1.12.16-20200616.20/go-1.12.16-linux-x64.tar.gz'; 'https://github.com/actions/go-versions/releases/download/1.12.16-20200616.20/go-1.12.16-linux-x64.tar.gz';
// ... but not in the local cache // ... but not in the local cache
findSpy.mockImplementation(() => ''); findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path'); dlSpy.mockImplementation(async () => '/some/temp/path');
let toolPath = path.normalize('/cache/go/1.12.16/x64'); const toolPath = path.normalize('/cache/go/1.12.16/x64');
extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); extractTarSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () => toolPath); cacheSpy.mockImplementation(async () => toolPath);
await main.run(); await main.run();
let expPath = path.join(toolPath, 'bin'); const expPath = path.join(toolPath, 'bin');
expect(dlSpy).toHaveBeenCalled(); expect(dlSpy).toHaveBeenCalled();
expect(extractTarSpy).toHaveBeenCalled(); expect(extractTarSpy).toHaveBeenCalled();
@ -421,25 +430,25 @@ describe('setup-go', () => {
os.platform = 'linux'; os.platform = 'linux';
os.arch = 'x64'; os.arch = 'x64';
let versionSpec = '1.12'; const versionSpec = '1.12';
inputs['go-version'] = versionSpec; inputs['go-version'] = versionSpec;
inputs['token'] = 'faketoken'; inputs['token'] = 'faketoken';
let expectedUrl = const expectedUrl =
'https://github.com/actions/go-versions/releases/download/1.12.17-20200616.21/go-1.12.17-linux-x64.tar.gz'; 'https://github.com/actions/go-versions/releases/download/1.12.17-20200616.21/go-1.12.17-linux-x64.tar.gz';
// ... but not in the local cache // ... but not in the local cache
findSpy.mockImplementation(() => ''); findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path'); dlSpy.mockImplementation(async () => '/some/temp/path');
let toolPath = path.normalize('/cache/go/1.12.17/x64'); const toolPath = path.normalize('/cache/go/1.12.17/x64');
extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); extractTarSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () => toolPath); cacheSpy.mockImplementation(async () => toolPath);
await main.run(); await main.run();
let expPath = path.join(toolPath, 'bin'); const expPath = path.join(toolPath, 'bin');
expect(dlSpy).toHaveBeenCalled(); expect(dlSpy).toHaveBeenCalled();
expect(extractTarSpy).toHaveBeenCalled(); expect(extractTarSpy).toHaveBeenCalled();
@ -458,7 +467,7 @@ describe('setup-go', () => {
os.platform = 'linux'; os.platform = 'linux';
os.arch = 'x64'; os.arch = 'x64';
let versionSpec = '1.12.14'; const versionSpec = '1.12.14';
inputs['go-version'] = versionSpec; inputs['go-version'] = versionSpec;
inputs['token'] = 'faketoken'; inputs['token'] = 'faketoken';
@ -467,13 +476,13 @@ describe('setup-go', () => {
findSpy.mockImplementation(() => ''); findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path'); dlSpy.mockImplementation(async () => '/some/temp/path');
let toolPath = path.normalize('/cache/go/1.12.14/x64'); const toolPath = path.normalize('/cache/go/1.12.14/x64');
extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); extractTarSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () => toolPath); cacheSpy.mockImplementation(async () => toolPath);
await main.run(); await main.run();
let expPath = path.join(toolPath, 'bin'); const expPath = path.join(toolPath, 'bin');
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.12.14'); expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.12.14');
expect(findSpy).toHaveBeenCalled(); expect(findSpy).toHaveBeenCalled();
expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.12.14...'); expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.12.14...');
@ -489,7 +498,7 @@ describe('setup-go', () => {
}); });
it('reports a failed download', async () => { it('reports a failed download', async () => {
let errMsg = 'unhandled download message'; const errMsg = 'unhandled download message';
os.platform = 'linux'; os.platform = 'linux';
os.arch = 'x64'; os.arch = 'x64';
@ -510,7 +519,7 @@ describe('setup-go', () => {
whichSpy.mockImplementation(async () => { whichSpy.mockImplementation(async () => {
return ''; return '';
}); });
let added = await main.addBinToPath(); const added = await main.addBinToPath();
expect(added).toBeFalsy(); expect(added).toBeFalsy();
}); });
@ -528,8 +537,8 @@ describe('setup-go', () => {
return false; return false;
}); });
let added = await main.addBinToPath(); const added = await main.addBinToPath();
expect(added).toBeTruthy; expect(added).toBeTruthy();
}); });
interface Annotation { interface Annotation {
@ -543,9 +552,9 @@ describe('setup-go', () => {
// problem matcher regex pattern tests // problem matcher regex pattern tests
function testMatch(line: string): Annotation { function testMatch(line: string): Annotation {
let annotation = <Annotation>{}; const annotation = <Annotation>{};
let match = matcherRegExp.exec(line); const match = matcherRegExp.exec(line);
if (match) { if (match) {
annotation.line = parseInt(match[matcherPattern.line], 10); annotation.line = parseInt(match[matcherPattern.line], 10);
annotation.column = parseInt(match[matcherPattern.column], 10); annotation.column = parseInt(match[matcherPattern.column], 10);
@ -557,8 +566,8 @@ describe('setup-go', () => {
} }
it('matches on relative unix path', async () => { it('matches on relative unix path', async () => {
let line = './main.go:13:2: undefined: fmt.Printl'; const line = './main.go:13:2: undefined: fmt.Printl';
let annotation = testMatch(line); const annotation = testMatch(line);
expect(annotation).toBeDefined(); expect(annotation).toBeDefined();
expect(annotation.line).toBe(13); expect(annotation.line).toBe(13);
expect(annotation.column).toBe(2); expect(annotation.column).toBe(2);
@ -567,8 +576,8 @@ describe('setup-go', () => {
}); });
it('matches on unix path up the tree', async () => { it('matches on unix path up the tree', async () => {
let line = '../main.go:13:2: undefined: fmt.Printl'; const line = '../main.go:13:2: undefined: fmt.Printl';
let annotation = testMatch(line); const annotation = testMatch(line);
expect(annotation).toBeDefined(); expect(annotation).toBeDefined();
expect(annotation.line).toBe(13); expect(annotation.line).toBe(13);
expect(annotation.column).toBe(2); expect(annotation.column).toBe(2);
@ -577,8 +586,8 @@ describe('setup-go', () => {
}); });
it('matches on unix path down the tree', async () => { it('matches on unix path down the tree', async () => {
let line = 'foo/main.go:13:2: undefined: fmt.Printl'; const line = 'foo/main.go:13:2: undefined: fmt.Printl';
let annotation = testMatch(line); const annotation = testMatch(line);
expect(annotation).toBeDefined(); expect(annotation).toBeDefined();
expect(annotation.line).toBe(13); expect(annotation.line).toBe(13);
expect(annotation.column).toBe(2); expect(annotation.column).toBe(2);
@ -587,8 +596,8 @@ describe('setup-go', () => {
}); });
it('matches on rooted unix path', async () => { it('matches on rooted unix path', async () => {
let line = '/assert.go:4:1: missing return at end of function'; const line = '/assert.go:4:1: missing return at end of function';
let annotation = testMatch(line); const annotation = testMatch(line);
expect(annotation).toBeDefined(); expect(annotation).toBeDefined();
expect(annotation.line).toBe(4); expect(annotation.line).toBe(4);
expect(annotation.column).toBe(1); expect(annotation.column).toBe(1);
@ -597,8 +606,8 @@ describe('setup-go', () => {
}); });
it('matches on unix path with spaces', async () => { it('matches on unix path with spaces', async () => {
let line = ' ./assert.go:5:2: missing return at end of function '; const line = ' ./assert.go:5:2: missing return at end of function ';
let annotation = testMatch(line); const annotation = testMatch(line);
expect(annotation).toBeDefined(); expect(annotation).toBeDefined();
expect(annotation.line).toBe(5); expect(annotation.line).toBe(5);
expect(annotation.column).toBe(2); expect(annotation.column).toBe(2);
@ -607,8 +616,8 @@ describe('setup-go', () => {
}); });
it('matches on unix path with tabs', async () => { it('matches on unix path with tabs', async () => {
let line = '\t./assert.go:5:2: missing return at end of function '; const line = '\t./assert.go:5:2: missing return at end of function ';
let annotation = testMatch(line); const annotation = testMatch(line);
expect(annotation).toBeDefined(); expect(annotation).toBeDefined();
expect(annotation.line).toBe(5); expect(annotation.line).toBe(5);
expect(annotation.column).toBe(2); expect(annotation.column).toBe(2);
@ -617,8 +626,8 @@ describe('setup-go', () => {
}); });
it('matches on relative windows path', async () => { it('matches on relative windows path', async () => {
let line = '.\\main.go:13:2: undefined: fmt.Printl'; const line = '.\\main.go:13:2: undefined: fmt.Printl';
let annotation = testMatch(line); const annotation = testMatch(line);
expect(annotation).toBeDefined(); expect(annotation).toBeDefined();
expect(annotation.line).toBe(13); expect(annotation.line).toBe(13);
expect(annotation.column).toBe(2); expect(annotation.column).toBe(2);
@ -627,8 +636,8 @@ describe('setup-go', () => {
}); });
it('matches on windows path up the tree', async () => { it('matches on windows path up the tree', async () => {
let line = '..\\main.go:13:2: undefined: fmt.Printl'; const line = '..\\main.go:13:2: undefined: fmt.Printl';
let annotation = testMatch(line); const annotation = testMatch(line);
expect(annotation).toBeDefined(); expect(annotation).toBeDefined();
expect(annotation.line).toBe(13); expect(annotation.line).toBe(13);
expect(annotation.column).toBe(2); expect(annotation.column).toBe(2);
@ -730,7 +739,7 @@ describe('setup-go', () => {
os.platform = 'linux'; os.platform = 'linux';
os.arch = 'x64'; os.arch = 'x64';
let versionSpec = '1.13'; const versionSpec = '1.13';
inputs['go-version'] = versionSpec; inputs['go-version'] = versionSpec;
inputs['check-latest'] = true; inputs['check-latest'] = true;
@ -741,13 +750,13 @@ describe('setup-go', () => {
findSpy.mockImplementation(() => ''); findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path'); dlSpy.mockImplementation(async () => '/some/temp/path');
let toolPath = path.normalize('/cache/go/1.13.7/x64'); const toolPath = path.normalize('/cache/go/1.13.7/x64');
extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); extractTarSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () => toolPath); cacheSpy.mockImplementation(async () => toolPath);
await main.run(); await main.run();
let expPath = path.join(toolPath, 'bin'); const expPath = path.join(toolPath, 'bin');
expect(dlSpy).toHaveBeenCalled(); expect(dlSpy).toHaveBeenCalled();
expect(extractTarSpy).toHaveBeenCalled(); expect(extractTarSpy).toHaveBeenCalled();
@ -767,7 +776,7 @@ describe('setup-go', () => {
os.platform = 'linux'; os.platform = 'linux';
os.arch = 'x64'; os.arch = 'x64';
let versionSpec = '1.13'; const versionSpec = '1.13';
process.env['GITHUB_PATH'] = ''; process.env['GITHUB_PATH'] = '';
@ -784,13 +793,13 @@ describe('setup-go', () => {
getAllVersionsSpy.mockImplementationOnce(() => undefined); getAllVersionsSpy.mockImplementationOnce(() => undefined);
dlSpy.mockImplementation(async () => '/some/temp/path'); dlSpy.mockImplementation(async () => '/some/temp/path');
let toolPath = path.normalize('/cache/go/1.13.7/x64'); const toolPath = path.normalize('/cache/go/1.13.7/x64');
extractTarSpy.mockImplementation(async () => '/some/other/temp/path'); extractTarSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () => toolPath); cacheSpy.mockImplementation(async () => toolPath);
await main.run(); await main.run();
let expPath = path.join(toolPath, 'bin'); const expPath = path.join(toolPath, 'bin');
expect(logSpy).toHaveBeenCalledWith( expect(logSpy).toHaveBeenCalledWith(
`Failed to resolve version ${versionSpec} from manifest` `Failed to resolve version ${versionSpec} from manifest`
@ -910,7 +919,7 @@ use .
inputs['go-version'] = version; inputs['go-version'] = version;
inputs['architecture'] = arch; inputs['architecture'] = arch;
let expectedUrl = const expectedUrl =
platform === 'win32' platform === 'win32'
? `https://github.com/actions/go-versions/releases/download/${version}/go-${version}-${platform}-${arch}.${fileExtension}` ? `https://github.com/actions/go-versions/releases/download/${version}/go-${version}-${platform}-${arch}.${fileExtension}`
: `https://storage.googleapis.com/golang/go${version}.${osSpec}-${arch}.${fileExtension}`; : `https://storage.googleapis.com/golang/go${version}.${osSpec}-${arch}.${fileExtension}`;
@ -919,7 +928,7 @@ use .
findSpy.mockImplementation(() => ''); findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path'); dlSpy.mockImplementation(async () => '/some/temp/path');
let toolPath = path.normalize(`/cache/go/${version}/${arch}`); const toolPath = path.normalize(`/cache/go/${version}/${arch}`);
cacheSpy.mockImplementation(async () => toolPath); cacheSpy.mockImplementation(async () => toolPath);
await main.run(); await main.run();
@ -944,7 +953,7 @@ use .
findSpy.mockImplementation(() => ''); findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path'); dlSpy.mockImplementation(async () => '/some/temp/path');
let toolPath = path.normalize(`/cache/go/${alias}/${arch}`); const toolPath = path.normalize(`/cache/go/${alias}/${arch}`);
cacheSpy.mockImplementation(async () => toolPath); cacheSpy.mockImplementation(async () => toolPath);
await main.run(); await main.run();

View File

@ -0,0 +1,62 @@
import fs from 'fs';
import * as io from '@actions/io';
import * as tc from '@actions/tool-cache';
import path from 'path';
describe('Windows performance workaround', () => {
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(() => {
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
// @ts-ignore - not implement unused methods
statSpy.mockImplementation(() => ({
isDirectory: () => true
}));
readdirSpy.mockImplementation(() => []);
writeFileSpy.mockImplementation(() => {});
mkdirSpy.mockImplementation(() => {});
symlinkSpy.mockImplementation(() => {});
rmRFSpy.mockImplementation(() => Promise.resolve());
mkdirPSpy.mockImplementation(() => Promise.resolve());
cpSpy.mockImplementation(() => Promise.resolve());
runnerToolCache = process.env['RUNNER_TOOL_CACHE'];
});
afterEach(() => {
jest.clearAllMocks();
process.env['RUNNER_TOOL_CACHE'] = runnerToolCache;
});
// cacheWindowsToolkitDir depends on implementation of tc.cacheDir
// with the assumption that target dir is passed by RUNNER_TOOL_CACHE environment variable
// Make sure the implementation has not been changed
it('addExecutablesToCache should depend on env[RUNNER_TOOL_CACHE]', async () => {
process.env['RUNNER_TOOL_CACHE'] = '/faked-hostedtoolcache1';
const cacheDir1 = await tc.cacheDir('/qzx', 'go', '1.2.3', 'arch');
expect(cacheDir1).toBe(
path.join('/', 'faked-hostedtoolcache1', 'go', '1.2.3', 'arch')
);
process.env['RUNNER_TOOL_CACHE'] = '/faked-hostedtoolcache2';
const cacheDir2 = await tc.cacheDir('/qzx', 'go', '1.2.3', 'arch');
expect(cacheDir2).toBe(
path.join('/', 'faked-hostedtoolcache2', 'go', '1.2.3', 'arch')
);
});
});

View File

@ -3,18 +3,18 @@ description: 'Setup a Go environment and add it to the PATH'
author: 'GitHub' author: 'GitHub'
inputs: inputs:
go-version: go-version:
description: 'The Go version to download (if necessary) and use. Supports semver spec and ranges.' 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: go-version-file:
description: 'Path to the go.mod or go.work file.' description: 'Path to the go.mod or go.work file.'
check-latest: check-latest:
description: 'Set this option to true if you want the action to always check for the latest available version that satisfies the version spec' description: 'Set this option to true if you want the action to always check for the latest available version that satisfies the version spec'
default: false default: false
token: token:
description: Used to pull node distributions from go-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. description: Used to pull Go distributions from go-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
default: ${{ github.server_url == 'https://github.com' && github.token || '' }} default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
cache: cache:
description: Used to specify whether caching is needed. Set to true, if you'd like to enable caching. description: Used to specify whether caching is needed. Set to true, if you'd like to enable caching.
default: false default: true
cache-dependency-path: cache-dependency-path:
description: 'Used to specify the path to a dependency file - go.sum' description: 'Used to specify the path to a dependency file - go.sum'
architecture: architecture:
@ -25,7 +25,7 @@ outputs:
cache-hit: cache-hit:
description: 'A boolean value to indicate if a cache was hit' description: 'A boolean value to indicate if a cache was hit'
runs: runs:
using: 'node16' using: 'node20'
main: 'dist/setup/index.js' main: 'dist/setup/index.js'
post: 'dist/cache-save/index.js' post: 'dist/cache-save/index.js'
post-if: success() post-if: success()

40981
dist/cache-save/index.js vendored

File diff suppressed because one or more lines are too long

45785
dist/setup/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -32,7 +32,7 @@ We don't pursue the goal to provide wide customization of caching in scope of `a
```yml ```yml
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
go-version: '18' go-version: '18'
@ -43,7 +43,7 @@ steps:
```yml ```yml
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
go-version: '18' go-version: '18'
@ -53,7 +53,7 @@ steps:
```yml ```yml
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
go-version: '18' go-version: '18'

View File

@ -52,7 +52,7 @@ Pull requests are the easiest way to contribute changes to git repos at GitHub.
- Please check that no one else has already created a pull request with these changes - Please check that no one else has already created a pull request with these changes
- Use a "feature branch" for your changes. That separates the changes in the pull request from your other changes and makes it easy to edit/amend commits in the pull request - Use a "feature branch" for your changes. That separates the changes in the pull request from your other changes and makes it easy to edit/amend commits in the pull request
- **Run `pre-checkin` script to format, build and test changes** - **Run `pre-checkin` script to format, lint, build and test changes**
- Make sure your changes are well formatted and that all tests are passing - Make sure your changes are well formatted and that all tests are passing
- If your pull request is connected to an open issue, please, leave a link to this issue in the `Related issue:` section - If your pull request is connected to an open issue, please, leave a link to this issue in the `Related issue:` section
- If you later need to add new commits to the pull request, you can simply commit the changes to the local branch and then push them. The pull request gets automatically updated - If you later need to add new commits to the pull request, you can simply commit the changes to the local branch and then push them. The pull request gets automatically updated
@ -61,6 +61,7 @@ Pull requests are the easiest way to contribute changes to git repos at GitHub.
- To implement new features or fix bugs, you need to make changes to the `.ts` files, which are located in the `src` folder - To implement new features or fix bugs, you need to make changes to the `.ts` files, which are located in the `src` folder
- To comply with the code style, **you need to run the `format` script** - To comply with the code style, **you need to run the `format` script**
- To lint the code, **you need to run the `lint:fix` script**
- To transpile source code to `javascript` we use [NCC](https://github.com/vercel/ncc). **It is very important to run the `build` script after making changes**, otherwise your changes will not get into the final `javascript` build - To transpile source code to `javascript` we use [NCC](https://github.com/vercel/ncc). **It is very important to run the `build` script after making changes**, otherwise your changes will not get into the final `javascript` build
- You can also start formatting, building code, and testing with a single `pre-checkin` command - You can also start formatting, building code, and testing with a single `pre-checkin` command

8226
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,17 @@
{ {
"name": "setup-go", "name": "setup-go",
"version": "3.3.0", "version": "5.0.0",
"private": true, "private": true,
"description": "setup go action", "description": "setup go action",
"main": "lib/setup-go.js", "main": "lib/setup-go.js",
"scripts": { "scripts": {
"build": "tsc && ncc build -o dist/setup src/setup-go.ts && ncc build -o dist/cache-save src/cache-save.ts", "build": "tsc && ncc build -o dist/setup src/setup-go.ts && ncc build -o dist/cache-save src/cache-save.ts",
"format": "prettier --write **/*.ts", "format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"",
"format-check": "prettier --check **/*.ts", "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", "test": "jest --coverage",
"pre-checkin": "npm run format && npm run build && npm test" "pre-checkin": "npm run format && npm run lint:fix && npm run build && npm test"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -23,25 +25,31 @@
"author": "GitHub", "author": "GitHub",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/cache": "^3.0.0", "@actions/cache": "^3.2.4",
"@actions/core": "^1.10.0", "@actions/core": "^1.10.0",
"@actions/exec": "^1.1.0", "@actions/exec": "^1.1.0",
"@actions/glob": "^0.2.0", "@actions/glob": "^0.4.0",
"@actions/http-client": "^2.0.1", "@actions/http-client": "^2.2.1",
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"@actions/tool-cache": "^1.5.5", "@actions/tool-cache": "^2.0.1",
"semver": "^6.1.1" "semver": "^7.6.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^27.0.2", "@types/jest": "^29.5.12",
"@types/node": "^16.11.25", "@types/node": "^20.11.28",
"@types/semver": "^6.0.0", "@types/semver": "^7.5.8",
"@vercel/ncc": "^0.33.4", "@typescript-eslint/eslint-plugin": "^5.54.0",
"jest": "^27.2.5", "@typescript-eslint/parser": "^5.54.0",
"jest-circus": "^27.2.5", "@vercel/ncc": "^0.38.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-node": "^11.1.0",
"jest": "^29.7.0",
"jest-circus": "^29.7.0",
"nock": "^10.0.6", "nock": "^10.0.6",
"prettier": "^1.17.1", "prettier": "^2.8.4",
"ts-jest": "^27.0.5", "ts-jest": "^29.1.2",
"typescript": "^4.3.3" "typescript": "^5.4.2"
} }
} }

View File

@ -29,7 +29,9 @@ export const restoreCache = async (
); );
} }
const primaryKey = `setup-go-${platform}-go-${versionSpec}-${fileHash}`; const linuxVersion =
process.env.RUNNER_OS === 'Linux' ? `${process.env.ImageOS}-` : '';
const primaryKey = `setup-go-${platform}-${linuxVersion}go-${versionSpec}-${fileHash}`;
core.debug(`primary key is ${primaryKey}`); core.debug(`primary key is ${primaryKey}`);
core.saveState(State.CachePrimaryKey, primaryKey); core.saveState(State.CachePrimaryKey, primaryKey);
@ -48,7 +50,7 @@ export const restoreCache = async (
}; };
const findDependencyFile = (packageManager: PackageManagerInfo) => { const findDependencyFile = (packageManager: PackageManagerInfo) => {
let dependencyFile = packageManager.dependencyFilePattern; const dependencyFile = packageManager.dependencyFilePattern;
const workspace = process.env.GITHUB_WORKSPACE!; const workspace = process.env.GITHUB_WORKSPACE!;
const rootContent = fs.readdirSync(workspace); const rootContent = fs.readdirSync(workspace);

View File

@ -12,9 +12,19 @@ process.on('uncaughtException', e => {
core.info(`${warningPrefix}${e.message}`); core.info(`${warningPrefix}${e.message}`);
}); });
export async function run() { // Added early exit to resolve issue with slow post action step:
// - https://github.com/actions/setup-node/issues/878
// https://github.com/actions/cache/pull/1217
export async function run(earlyExit?: boolean) {
try { try {
const cacheInput = core.getBooleanInput('cache');
if (cacheInput) {
await cachePackages(); await cachePackages();
if (earlyExit) {
process.exit(0);
}
}
} catch (error) { } catch (error) {
let message = 'Unknown error!'; let message = 'Unknown error!';
if (error instanceof Error) { if (error instanceof Error) {
@ -23,16 +33,11 @@ export async function run() {
if (typeof error === 'string') { if (typeof error === 'string') {
message = error; message = error;
} }
core.setFailed(message); core.warning(message);
} }
} }
const cachePackages = async () => { const cachePackages = async () => {
const cacheInput = core.getBooleanInput('cache');
if (!cacheInput) {
return;
}
const packageManager = 'default'; const packageManager = 'default';
const state = core.getState(State.CacheMatchedKey); const state = core.getState(State.CacheMatchedKey);
@ -59,6 +64,13 @@ const cachePackages = async () => {
); );
} }
if (!primaryKey) {
core.info(
'Primary key was not generated. Please check the log messages above for more errors or information'
);
return;
}
if (primaryKey === state) { if (primaryKey === state) {
core.info( core.info(
`Cache hit occurred on the primary key ${primaryKey}, not saving cache.` `Cache hit occurred on the primary key ${primaryKey}, not saving cache.`
@ -78,4 +90,4 @@ function logWarning(message: string): void {
core.info(`${warningPrefix}${message}`); core.info(`${warningPrefix}${message}`);
} }
run(); run(true);

View File

@ -34,19 +34,29 @@ export const getPackageManagerInfo = async (packageManager: string) => {
export const getCacheDirectoryPath = async ( export const getCacheDirectoryPath = async (
packageManagerInfo: PackageManagerInfo packageManagerInfo: PackageManagerInfo
) => { ) => {
let pathList = await Promise.all( const pathOutputs = await Promise.allSettled(
packageManagerInfo.cacheFolderCommandList.map(command => packageManagerInfo.cacheFolderCommandList.map(async command =>
getCommandOutput(command) getCommandOutput(command)
) )
); );
const emptyPaths = pathList.filter(item => !item); const results = pathOutputs.map(item => {
if (item.status === 'fulfilled') {
return item.value;
} else {
core.info(`[warning]getting cache directory path failed: ${item.reason}`);
}
if (emptyPaths.length) { return '';
});
const cachePaths = results.filter(item => item);
if (!cachePaths.length) {
throw new Error(`Could not get cache folder paths.`); throw new Error(`Could not get cache folder paths.`);
} }
return pathList; return cachePaths;
}; };
export function isGhes(): boolean { export function isGhes(): boolean {
@ -57,19 +67,19 @@ export function isGhes(): boolean {
} }
export function isCacheFeatureAvailable(): boolean { export function isCacheFeatureAvailable(): boolean {
if (!cache.isFeatureAvailable()) { if (cache.isFeatureAvailable()) {
if (isGhes()) { return true;
throw new Error(
'Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'
);
} else {
core.warning(
'The runner was not able to contact the cache service. Caching will be skipped'
);
} }
if (isGhes()) {
core.warning(
'Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'
);
return false; return false;
} }
return true; core.warning(
'The runner was not able to contact the cache service. Caching will be skipped'
);
return false;
} }

View File

@ -37,7 +37,7 @@ export async function getGo(
arch = os.arch() arch = os.arch()
) { ) {
let manifest: tc.IToolRelease[] | undefined; let manifest: tc.IToolRelease[] | undefined;
let osPlat: string = os.platform(); const osPlat: string = os.platform();
if ( if (
versionSpec === StableReleaseAlias.Stable || versionSpec === StableReleaseAlias.Stable ||
@ -83,8 +83,7 @@ export async function getGo(
} }
// check cache // check cache
let toolPath: string; const toolPath = tc.find('go', versionSpec, arch);
toolPath = tc.find('go', versionSpec, arch);
// If not found in cache, download // If not found in cache, download
if (toolPath) { if (toolPath) {
core.info(`Found in cache @ ${toolPath}`); core.info(`Found in cache @ ${toolPath}`);
@ -115,9 +114,9 @@ export async function getGo(
`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded` `Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`
); );
} else { } else {
core.info(err.message); core.info((err as Error).message);
} }
core.debug(err.stack); core.debug((err as Error).stack ?? '');
core.info('Falling back to download directly from Go'); core.info('Falling back to download directly from Go');
} }
@ -161,10 +160,79 @@ async function resolveVersionFromManifest(
return info?.resolvedVersion; return info?.resolvedVersion;
} catch (err) { } catch (err) {
core.info('Unable to resolve a version from the manifest...'); core.info('Unable to resolve a version from the manifest...');
core.debug(err.message); core.debug((err as Error).message);
} }
} }
// for github hosted windows runner handle latency of OS drive
// by avoiding write operations to C:
async function cacheWindowsDir(
extPath: string,
tool: string,
version: string,
arch: string
): Promise<string | false> {
if (os.platform() !== 'win32') return false;
// make sure the action runs in the hosted environment
if (
process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted' &&
process.env['AGENT_ISSELFHOSTED'] === '1'
)
return false;
const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE'];
if (!defaultToolCacheRoot) return false;
if (!fs.existsSync('d:\\') || !fs.existsSync('c:\\')) return false;
const actualToolCacheRoot = defaultToolCacheRoot
.replace('C:', 'D:')
.replace('c:', 'd:');
// make toolcache root to be on drive d:
process.env['RUNNER_TOOL_CACHE'] = actualToolCacheRoot;
const actualToolCacheDir = await tc.cacheDir(extPath, tool, version, arch);
// create a link from c: to d:
const defaultToolCacheDir = actualToolCacheDir.replace(
actualToolCacheRoot,
defaultToolCacheRoot
);
fs.mkdirSync(path.dirname(defaultToolCacheDir), {recursive: true});
fs.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction');
core.info(`Created link ${defaultToolCacheDir} => ${actualToolCacheDir}`);
const actualToolCacheCompleteFile = `${actualToolCacheDir}.complete`;
const defaultToolCacheCompleteFile = `${defaultToolCacheDir}.complete`;
fs.symlinkSync(
actualToolCacheCompleteFile,
defaultToolCacheCompleteFile,
'file'
);
core.info(
`Created link ${defaultToolCacheCompleteFile} => ${actualToolCacheCompleteFile}`
);
// make outer code to continue using toolcache as if it were installed on c:
// restore toolcache root to default drive c:
process.env['RUNNER_TOOL_CACHE'] = defaultToolCacheRoot;
return defaultToolCacheDir;
}
async function addExecutablesToToolCache(
extPath: string,
info: IGoVersionInfo,
arch: string
): Promise<string> {
const tool = 'go';
const version = makeSemver(info.resolvedVersion);
return (
(await cacheWindowsDir(extPath, tool, version, arch)) ||
(await tc.cacheDir(extPath, tool, version, arch))
);
}
async function installGoVersion( async function installGoVersion(
info: IGoVersionInfo, info: IGoVersionInfo,
auth: string | undefined, auth: string | undefined,
@ -187,14 +255,10 @@ async function installGoVersion(
} }
core.info('Adding to the cache ...'); core.info('Adding to the cache ...');
const cachedDir = await tc.cacheDir( const toolCacheDir = await addExecutablesToToolCache(extPath, info, arch);
extPath, core.info(`Successfully cached go to ${toolCacheDir}`);
'go',
makeSemver(info.resolvedVersion), return toolCacheDir;
arch
);
core.info(`Successfully cached go to ${cachedDir}`);
return cachedDir;
} }
export async function extractGoArchive(archivePath: string): Promise<string> { export async function extractGoArchive(archivePath: string): Promise<string> {
@ -246,13 +310,12 @@ async function getInfoFromDist(
versionSpec: string, versionSpec: string,
arch: string arch: string
): Promise<IGoVersionInfo | null> { ): Promise<IGoVersionInfo | null> {
let version: IGoVersion | undefined; const version: IGoVersion | undefined = await findMatch(versionSpec, arch);
version = await findMatch(versionSpec, arch);
if (!version) { if (!version) {
return null; return null;
} }
let downloadUrl: string = `https://storage.googleapis.com/golang/${version.files[0].filename}`; const downloadUrl = `https://storage.googleapis.com/golang/${version.files[0].filename}`;
return <IGoVersionInfo>{ return <IGoVersionInfo>{
type: 'dist', type: 'dist',
@ -266,14 +329,14 @@ export async function findMatch(
versionSpec: string, versionSpec: string,
arch = os.arch() arch = os.arch()
): Promise<IGoVersion | undefined> { ): Promise<IGoVersion | undefined> {
let archFilter = sys.getArch(arch); const archFilter = sys.getArch(arch);
let platFilter = sys.getPlatform(); const platFilter = sys.getPlatform();
let result: IGoVersion | undefined; let result: IGoVersion | undefined;
let match: IGoVersion | undefined; let match: IGoVersion | undefined;
const dlUrl: string = 'https://golang.org/dl/?mode=json&include=all'; const dlUrl = 'https://golang.org/dl/?mode=json&include=all';
let candidates: IGoVersion[] | null = await module.exports.getVersionsDist( const candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
dlUrl dlUrl
); );
if (!candidates) { if (!candidates) {
@ -282,8 +345,8 @@ export async function findMatch(
let goFile: IGoVersionFile | undefined; let goFile: IGoVersionFile | undefined;
for (let i = 0; i < candidates.length; i++) { for (let i = 0; i < candidates.length; i++) {
let candidate: IGoVersion = candidates[i]; const candidate: IGoVersion = candidates[i];
let version = makeSemver(candidate.version); const version = makeSemver(candidate.version);
core.debug(`check ${version} satisfies ${versionSpec}`); core.debug(`check ${version} satisfies ${versionSpec}`);
if (semver.satisfies(version, versionSpec)) { if (semver.satisfies(version, versionSpec)) {
@ -315,7 +378,7 @@ export async function getVersionsDist(
dlUrl: string dlUrl: string
): Promise<IGoVersion[] | null> { ): Promise<IGoVersion[] | null> {
// this returns versions descending so latest is first // this returns versions descending so latest is first
let http: httpm.HttpClient = new httpm.HttpClient('setup-go', [], { const http: httpm.HttpClient = new httpm.HttpClient('setup-go', [], {
allowRedirects: true, allowRedirects: true,
maxRedirects: 3 maxRedirects: 3
}); });
@ -331,9 +394,9 @@ export async function getVersionsDist(
export function makeSemver(version: string): string { export function makeSemver(version: string): string {
version = version.replace('go', ''); version = version.replace('go', '');
version = version.replace('beta', '-beta.').replace('rc', '-rc.'); version = version.replace('beta', '-beta.').replace('rc', '-rc.');
let parts = version.split('-'); const parts = version.split('-');
let semVersion = semver.coerce(parts[0])?.version; const semVersion = semver.coerce(parts[0])?.version;
if (!semVersion) { if (!semVersion) {
throw new Error( throw new Error(
`The version: ${version} can't be changed to SemVer notation` `The version: ${version} can't be changed to SemVer notation`
@ -369,10 +432,10 @@ export function parseGoVersionFile(versionFilePath: string): string {
} }
async function resolveStableVersionDist(versionSpec: string, arch: string) { async function resolveStableVersionDist(versionSpec: string, arch: string) {
let archFilter = sys.getArch(arch); const archFilter = sys.getArch(arch);
let platFilter = sys.getPlatform(); const platFilter = sys.getPlatform();
const dlUrl: string = 'https://golang.org/dl/?mode=json&include=all'; const dlUrl = 'https://golang.org/dl/?mode=json&include=all';
let candidates: IGoVersion[] | null = await module.exports.getVersionsDist( const candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
dlUrl dlUrl
); );
if (!candidates) { if (!candidates) {

View File

@ -27,8 +27,8 @@ export async function run() {
} }
if (versionSpec) { if (versionSpec) {
let token = core.getInput('token'); const token = core.getInput('token');
let auth = !token ? undefined : `token ${token}`; const auth = !token ? undefined : `token ${token}`;
const checkLatest = core.getBooleanInput('check-latest'); const checkLatest = core.getBooleanInput('check-latest');
@ -51,15 +51,31 @@ export async function run() {
core.exportVariable('GOROOT', installDir); core.exportVariable('GOROOT', installDir);
} }
let added = await addBinToPath();
core.debug(`add bin ${added}`);
core.info(`Successfully set up Go version ${versionSpec}`); 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.'
);
} }
const added = await addBinToPath();
core.debug(`add bin ${added}`);
const goPath = await io.which('go');
const goVersion = (cp.execSync(`${goPath} version`) || '').toString();
if (cache && isCacheFeatureAvailable()) { if (cache && isCacheFeatureAvailable()) {
const packageManager = 'default'; const packageManager = 'default';
const cacheDependencyPath = core.getInput('cache-dependency-path'); const cacheDependencyPath = core.getInput('cache-dependency-path');
await restoreCache(versionSpec, packageManager, cacheDependencyPath); try {
await restoreCache(
parseGoVersion(goVersion),
packageManager,
cacheDependencyPath
);
} catch (error) {
core.warning(`Restore cache failed: ${(error as Error).message}`);
}
} }
// add problem matchers // add problem matchers
@ -67,33 +83,31 @@ export async function run() {
core.info(`##[add-matcher]${matchersPath}`); core.info(`##[add-matcher]${matchersPath}`);
// output the version actually being used // output the version actually being used
let goPath = await io.which('go');
let goVersion = (cp.execSync(`${goPath} version`) || '').toString();
core.info(goVersion); core.info(goVersion);
core.setOutput('go-version', parseGoVersion(goVersion)); core.setOutput('go-version', parseGoVersion(goVersion));
core.startGroup('go env'); core.startGroup('go env');
let goEnv = (cp.execSync(`${goPath} env`) || '').toString(); const goEnv = (cp.execSync(`${goPath} env`) || '').toString();
core.info(goEnv); core.info(goEnv);
core.endGroup(); core.endGroup();
} catch (error) { } catch (error) {
core.setFailed(error.message); core.setFailed((error as Error).message);
} }
} }
export async function addBinToPath(): Promise<boolean> { export async function addBinToPath(): Promise<boolean> {
let added = false; let added = false;
let g = await io.which('go'); const g = await io.which('go');
core.debug(`which go :${g}:`); core.debug(`which go :${g}:`);
if (!g) { if (!g) {
core.debug('go not in the path'); core.debug('go not in the path');
return added; return added;
} }
let buf = cp.execSync('go env GOPATH'); const buf = cp.execSync('go env GOPATH');
if (buf.length > 1) { if (buf.length > 1) {
let gp = buf.toString().trim(); const gp = buf.toString().trim();
core.debug(`go env GOPATH :${gp}:`); core.debug(`go env GOPATH :${gp}:`);
if (!fs.existsSync(gp)) { if (!fs.existsSync(gp)) {
// some of the hosted images have go install but not profile dir // some of the hosted images have go install but not profile dir
@ -101,7 +115,7 @@ export async function addBinToPath(): Promise<boolean> {
await io.mkdirP(gp); await io.mkdirP(gp);
} }
let bp = path.join(gp, 'bin'); const bp = path.join(gp, 'bin');
if (!fs.existsSync(bp)) { if (!fs.existsSync(bp)) {
core.debug(`creating ${bp}`); core.debug(`creating ${bp}`);
await io.mkdirP(bp); await io.mkdirP(bp);

View File

@ -1,4 +1,4 @@
const os = require('os'); import os from 'os';
export function getPlatform(): string { export function getPlatform(): string {
// darwin and linux match already // darwin and linux match already

View File

@ -46,6 +46,7 @@
// "types": [], /* Type declaration files to be included in compilation. */ // "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"resolveJsonModule": true, /* Allows importing modules with a '.json' extension, which is a common practice in node projects. */
"sourceMap": true, "sourceMap": true,
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */