Compare commits

..

267 Commits

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 ca4321abee.
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
Dmitry Shibanov
6edd4406fa
fix log for stable aliases (#303) 2022-12-12 15:45:36 +01:00
Milos Pantic
38dbe75f81
Add stable and oldstable aliases (#300) 2022-12-12 10:58:49 +01:00
Marko Zivic
30c39bfe0c
Merge pull request #301 from jongwooo/chore/use-cache-in-check-dist
Use cache in check-dist.yml
2022-12-07 10:16:09 +01:00
Jongwoo Han
8377b69a56
Use cache in check-dist.yml
Signed-off-by: jongwooo <jongwooo.han@gmail.com>
2022-12-07 00:59:49 +09:00
Marko Zivic
d0a58c1c4d
Merge pull request #294 from JamesMGreene/patch-1
Update to latest `actions/publish-action`
2022-11-24 08:26:51 +01:00
James M. Greene
3dcd9d6eb3
Update to latest actions/publish-action
To avoid Actions core deprecation messages.

https://github.com/actions/publish-action/releases/tag/v0.2.1
2022-11-22 10:26:58 -06:00
Marko Zivic
e983b65a44
Merge pull request #283 from koba1t/add_support_gowork_for_go-version-file
add support go.work file for go-version-file
2022-11-08 11:45:09 +01:00
Dmitry Shibanov
27b43e1b0d
Pass the token input through on GHES (#277) 2022-11-02 12:21:18 +01:00
koba1t
7678c83214
add support gowork for go-version-file 2022-11-01 21:25:30 +09:00
n33pm
c4a742cab1
fix(): cache resolve version input (#267) 2022-10-17 18:33:22 +02:00
Marko Zivic
f556e5b7e0
Merge pull request #273 from rentziass/rentziass/update-actions-core
Update @actions/core to 1.10.0
2022-10-07 13:50:39 +02:00
Francesco Renzi
514ae57904 Update @actions/core to 1.10.0 2022-10-06 12:08:35 +01:00
Marko Zivic
30b9ddff11
Merge pull request #264 from e-korolevskii/258-not-throw-err-no-cache-folders
Not throw err no cache folder
2022-09-09 14:32:33 +02:00
Evgenii Korolevskii
c4e169859f prettier format 2022-09-08 15:11:06 +02:00
Evgenii Korolevskii
db58e98a43 format 2022-09-08 14:53:17 +02:00
Evgenii Korolevskii
2905db4069 update build 2022-09-08 13:26:20 +02:00
Evgenii Korolevskii
57452eb902 fix debug lines in test 2022-09-08 13:24:00 +02:00
Evgenii Korolevskii
5547b9ed8d fix(cache): Not throw err if no cache folders 2022-09-08 13:18:41 +02:00
Evgenii Korolevskii
be45b2722d build 2022-09-08 12:29:13 +02:00
Milos Pantic
4c32251b06
Update package lock version (#261) 2022-09-05 13:22:20 +02:00
Aleksey Zhukov
e68a999c97
Fix broken code of conduct link (#260) 2022-09-05 12:39:44 +02:00
Marko Zivic
b855b20887
Merge pull request #257 from panticmilos/vmpantic/update-package-version
Update version in package json
2022-09-01 09:50:51 +02:00
Milos Pantic
bf059911e8
Fix package json action version 2022-08-31 17:34:04 +02:00
panticmilos
884d2909a6 Update version in package json 2022-08-31 16:12:17 +02:00
Milos Pantic
268d8c0ca0
Add support for arm32 go arch (#253) 2022-08-12 12:29:48 +02:00
Marko Zivic
f279813975
Merge pull request #250 from jromero/feature/windows-download-filename
Use explicit filename when downloading Windows go package
2022-08-04 07:22:48 +02:00
Marko Zivic
1022489cb7
Merge pull request #249 from e-korolevskii/main
update docs
2022-07-29 08:52:29 +02:00
Javier Romero
e0dce94eb0 Use explicit filename when downloading Windows go package
Using the explicit filename for Windows is necessary to
satisfy `Expand-Archive`'s requirement on '.zip' extension.

Signed-off-by: Javier Romero <root@jromero.codes>
2022-07-28 19:01:53 -05:00
Evgenii Korolevskii
de99728cc5
Merge branch 'actions:main' into main 2022-07-29 01:47:21 +02:00
Evgenii Korolevskii
dab57c7c68 update docs 2022-07-29 01:46:45 +02:00
Marko Zivic
f2e56d8191
Merge pull request #246 from e-korolevskii/Update-contributors-guide
Update contributors guide
2022-07-26 12:56:08 +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
Evgenii Korolevskii
edd0aca6b1 update tests path 2022-07-26 09:21:29 +02:00
Evgenii Korolevskii
f3e3b7c2f2
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:29:26 +02:00
Evgenii Korolevskii
4a0c081511
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:29:14 +02:00
Evgenii Korolevskii
185e7f2f01
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:28:50 +02:00
Evgenii Korolevskii
44a19cee0e
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:28:21 +02:00
Evgenii Korolevskii
bf3c3cc849
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:27:41 +02:00
Evgenii Korolevskii
f9b96e0433
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:27:29 +02:00
Evgenii Korolevskii
ff877a8139
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:26:15 +02:00
Evgenii Korolevskii
978085939e
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:23:52 +02:00
Evgenii Korolevskii
481b13a4cc
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:23:31 +02:00
Evgenii Korolevskii
76faaf8531
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:23:14 +02:00
Evgenii Korolevskii
14274b54cb
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:22:15 +02:00
Evgenii Korolevskii
95fd3774de
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:21:27 +02:00
Evgenii Korolevskii
985d5990dd
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:20:22 +02:00
Evgenii Korolevskii
0b05709db8
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:20:09 +02:00
Evgenii Korolevskii
a7338d1fc9
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:19:16 +02:00
Evgenii Korolevskii
c35e03b512
Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-07-25 12:18:48 +02:00
Evgenii Korolevskii
864dd77064 fix gramma 2022-07-25 10:11:43 +02:00
Evgenii Korolevskii
233e44dd5f update docs 2022-07-22 09:10:19 +02:00
Evgenii Korolevskii
afb42575fb rephrased doc 2022-07-18 09:14:48 +02:00
Evgenii Korolevskii
049de84649 docs(contributors guide): Updated contributors guide 2022-07-14 14:33:15 +02:00
Marko Zivic
84cbf80943
Merge pull request #238 from vsafonkin/v-vsafonkin/cache-error-handling
Error handling for cache
2022-07-01 09:45:03 +02:00
Vladimir Safonkin
dd64cc9b01 Build dist 2022-07-01 09:28:20 +02:00
Vladimir Safonkin
9eecd2d0d7 Minor fix 2022-07-01 09:25:30 +02:00
Vladimir Safonkin
75be648571 Fix license 2022-06-28 14:58:31 +02:00
Vladimir Safonkin
bb9cf42688 Fix license 2022-06-28 14:46:16 +02:00
Vladimir Safonkin
97919d33f5 Fix license 2022-06-28 14:41:15 +02:00
Vladimir Safonkin
df0583a96c Fix license 2022-06-28 14:38:18 +02:00
Vladimir Safonkin
5ea2b37572 Fix license 2022-06-28 14:33:43 +02:00
Vladimir Safonkin
e52a7c55ca Update license 2022-06-28 14:26:59 +02:00
Vladimir Safonkin
ed8da5df39 Build js 2022-06-28 14:18:12 +02:00
Vladimir Safonkin
0fd92001e9 Rework cache handling 2022-06-28 14:17:12 +02:00
Vladimir Safonkin
6036aa2424 Add cache error handling 2022-06-14 10:57:37 +02:00
IvanZosimov
b22fbbc292
Implementation of caching functionality for setup-go action (#228) 2022-05-25 12:07:29 +02:00
Dmitry Shibanov
fcdc43634a
Update @zeit/ncc to @vercel/ncc (#229) 2022-05-12 12:04:41 +02:00
So Jomura
265edc1beb
Add go-version-file option (#62) 2022-05-12 10:04:39 +02:00
Brian Cristante
193b404f8a
Successfully set up (#231) 2022-05-03 08:43:40 -04:00
Dmitry Shibanov
56a61c9834
Create ADR for integrating cache functionality to setup-go action (#217) 2022-04-26 11:38:01 +02:00
Vladimir Safonkin
b46db954a1
Merge pull request #222 from vsafonkin/v-vsafonkin/add-readme-note
Add note about golang building process
2022-04-20 18:09:14 +03:00
Vladimir Safonkin
3332358454 Add note about go building 2022-04-20 16:11:14 +02:00
Vladimir Safonkin
46eabca1ab
Merge pull request #221 from vsafonkin/v-vsafonkin/fix-gopath-condition
Fix condition for GOPATH output
2022-04-19 09:58:46 +03:00
IvanZosimov
07948221be
Rename CONDUCT.md and change email inside (#218) 2022-04-18 10:45:36 +02:00
Vladimir Safonkin
ad70bef2ef Fix condition for old go versions 2022-04-17 17:36:51 +02:00
Nick
4a4352b330
Add 'go-version' Output (#85)
* Add go-version to action outputs

This provides the semver version of Go that has been installed. This is useful
if only a major or minor version has been provided as the input go-version
value.

* Convert version extraction to a function

Simplify how the version is extracted and add a simple test at the same
time.

Co-authored-by: Peter Mescalchin <peter@magnetikonline.com>
Co-authored-by: Brian Cristante <33549821+brcrista@users.noreply.github.com>

Co-authored-by: Peter Mescalchin <peter@magnetikonline.com>
Co-authored-by: Brian Cristante <33549821+brcrista@users.noreply.github.com>
2022-04-08 12:23:10 -04:00
Vladimir Safonkin
115d6e6004
Set LF for all files (#214)
* Set LF for all files

* Set gitattr text=auto
2022-04-07 11:31:36 -04:00
Peter Mescalchin
bf7ccf173e
Correct some small README.md formatting typos (#213) 2022-04-01 09:27:16 -04:00
Peter Mescalchin
dcb4ec94ce
Bump GitHub actions, README.md cleanups (#202)
* Bump `actions/checkout@v3`

* Bump `actions/setup-node@v3`

* Bump `actions/upload-artifact@v3`

* Bump `actions/setup-go@v3` in `README.md` examples

* Removed mention of `stable` action argument from `README.md`

* Add "new style" workflow build buttons to `README.md`
2022-03-31 15:29:52 -04:00
Vladimir Safonkin
341b20ac36
Update usage examples on readme (#212)
* Fix action usage examples on readme

* Revert changes on package-lock

* Fix some checkout action version
2022-03-29 15:16:03 -04:00
Brian Cristante
a5865a93f2
Merge pull request #211 from Frassle/awaitmkdirp
await io.mkdirP
2022-03-28 09:47:39 -04:00
Fraser Waters
13df686579 Update dist 2022-03-28 14:23:54 +01:00
Brian Cristante
8e9a229830
Merge pull request #210 from vsafonkin/v-vsafonkin/update-readme-v3
Update README to v3
2022-03-28 09:19:11 -04:00
Fraser Waters
0b4fbc55f6 await io.mkdirP 2022-03-28 10:54:44 +01:00
Vladimir Safonkin
acdbc5377c Remove stable input description from README 2022-03-28 10:24:34 +02:00
Vladimir Safonkin
3e6475c089 Update README to v3 2022-03-25 09:53:28 +01:00
Brian Cristante
65771601ff
Merge pull request #208 from actions/dependabot/npm_and_yarn/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6
2022-03-24 09:32:50 -04:00
dependabot[bot]
fcc0174ef2
Bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-24 11:54:47 +00:00
Brian Cristante
75726802f3
Merge pull request #175 from mmlb/do-not-export-GOROOT
Do not export GOROOT for Go versions >= 1.9
2022-03-17 16:02:21 -04:00
Josh Gross
0c03929337
Remove duplicated spyOn 2022-03-14 12:32:36 -04:00
Josh Gross
229eefa42b
Update dist 2022-03-14 12:24:32 -04:00
Josh Gross
802876f7c7
Fix formatting 2022-03-14 12:23:03 -04:00
Josh Gross
2a34c33bd7
Export GOROOT for versions < 1.9 2022-03-14 12:21:30 -04:00
Manuel Mendez
83124a14b6 Do not export GOROOT
This has not been necessary since [Go 1.9](https://go.dev/doc/go1.9#goroot) at
least (although clunky to do so then) but definitely not since
[Go 1.10](https://go.dev/doc/go1.10#goroot).

This is cargo culting code that is more than 2 years out of date and runs into
issues when multiple go versions are used in an action run.

Signed-off-by: Manuel Mendez <mmendez534@gmail.com>
2022-03-11 08:26:16 -05:00
Brian Cristante
9a1626044c
Merge pull request #204 from actions/joshmgross/service-codeowners
Update CODEOWNERS to actions-service
2022-03-10 13:33:03 -05:00
Josh Gross
24c791c06c
Update CODEOWNERS to actions-service 2022-03-10 13:29:40 -05:00
Manuel Mendez
ec07be593a Add test for export of GOROOT to env var
Signed-off-by: Manuel Mendez <mmendez534@gmail.com>
2022-03-09 08:56:55 -05:00
Dmitry Shibanov
f6164bd8c8
Remove stable input and fix SemVer notation (#195) 2022-02-28 10:16:32 +03:00
Dmitry Shibanov
2bb2aab2fd
update types node (#194) 2022-02-24 15:07:22 +03:00
Dmitry Shibanov
edcbc0c2cd
update lockfileVersion (#193) 2022-02-24 14:47:08 +03:00
Dmitry Shibanov
fb9a043dd8
Update default runtime to node16 (#192) 2022-02-22 18:25:23 +03:00
dependabot[bot]
5b0ae0e97d
Bump pathval from 1.1.0 to 1.1.1 (#188) 2022-02-16 16:47:18 +03:00
Dmitry Shibanov
bfdd3570ce
Implement "check-latest" flag to check if pre-cached version is latest one (#186) 2022-02-09 14:59:04 +03:00
Sergey Gaynetdinov
44e221478f
Replace 'ubuntu-16.04' -> 'ubuntu-latest' (#180) 2022-01-12 09:40:09 +03:00
Brian Cristante
424fc82d43
Merge pull request #179 from oscard0m/add-cache-to-node-workflows
ci(workflow): add 'npm' cache for actions/setup-node in .github/workflows
2021-12-20 15:07:26 -05:00
Oscar Dominguez
82388ea9d4 ci(workflow): add 'npm' cache for actions/setup-node in .github/workflows 2021-12-20 17:24:01 +01:00
Dominik Honnef
fdeec47002
Don't require relative paths to start with ./ or ../ (#98) 2021-12-17 18:47:05 +03:00
Sergey-Murtazin
3e9d5483e6
Add semver note to documentation (#164) 2021-12-01 14:10:32 +03:00
Masahiro Furudate
02f7ea9f09
Fix yaml indent (#59) 2021-11-08 13:28:08 +03:00
Sergey-Murtazin
5805cf725b
Add issue and pull request templates (#163) 2021-10-20 12:15:51 +03:00
MaksimZhukov
35030c1fd2
Merge pull request #162 from dmitry-shibanov/v-dmshib/update-dependencies
Update dependencies
2021-10-14 13:06:56 +03:00
Dmitry Shibanov
59d644db2a update dependencies 2021-10-13 18:48:38 +03:00
Josh Gross
76929df236
Merge pull request #147 from brcrista/brcrista/check-dist
Create check-dist.yml
2021-08-31 12:05:50 -04:00
Josh Gross
b06835a88c
Merge pull request #155 from brcrista/brcrista/npm-audit-fix
Fix `npm audit` issues
2021-08-31 12:05:05 -04:00
Brian Cristante
b8a24202e2 Update Jest 2021-08-31 10:44:51 -04:00
Brian Cristante
e234d99c78 Run npm audit fix 2021-08-31 09:35:58 -04:00
Josh Gross
0ea1f64ec9
Merge pull request #87 from ineiti/patch-1
Reference latest setup-go
2021-08-30 17:57:13 -04:00
Josh Gross
331ce1d993
Merge pull request #141 from paulcacheux/fix-windows-extractor-selection
Fix extractor selection on windows
2021-08-25 11:43:04 -04:00
Josh Gross
1087a81afd
Merge pull request #146 from actions/joshmgross/add-release-workflow
Add release action version workflow
2021-08-25 11:41:46 -04:00
Josh Gross
ecd878f81d
Add release action version workflow 2021-08-25 11:38:05 -04:00
Brian Cristante
eca066937b Fix triggers in licensed.yml 2021-08-25 11:29:44 -04:00
Brian Cristante
e816064dae Add check-dist.yml 2021-08-25 11:29:44 -04:00
Paul Cacheux
bba6fe1d58 Fix extractor selection on windows 2021-08-19 21:32:02 +02:00
Josh Gross
3b4dc6cbed
Merge pull request #90 from actions/joshmgross/add-codeowners
Add CODEOWNERS
2020-12-09 11:22:47 -05:00
Josh Gross
afe68ffd57
Add CODEOWNERS 2020-12-07 15:56:41 -05:00
Linus Gasser
6eb700292f
Reference latest setup-go 2020-11-27 08:11:50 +01:00
Thomas Boop
37335c7bb2
Swap to Environment Files (#76)
* Swap to env files
2020-10-01 10:45:00 -04:00
Thomas Boop
7ff6287c80
Merge pull request #70 from thboop/main
Add `Licensed` To Help Verify Prod Licenses
2020-09-10 09:23:38 -04:00
Thomas Boop
084110f6ed Ignore Generated Files in Git PR's 2020-08-26 11:22:18 -04:00
Thomas Boop
4047b11da0 Manually review dependencies 2020-08-11 20:55:26 -04:00
Thomas Boop
23a9878ae4 Add Licensed workflow and configuration files 2020-08-11 20:55:11 -04:00
Thomas Boop
8a3a76c217
Merge pull request #69 from actions/thboop/AddThirdPartyLicenses
Add Third Party License Information to Dist Files
2020-08-11 14:26:32 -04:00
Thomas Boop
a01ab08f9a Add Third Party License Information 2020-08-06 19:13:07 -04:00
Bryan MacFarlane
33cbf07c96 workflow main references 2020-07-22 08:04:56 -04:00
Bryan MacFarlane
8e98458ff1 updating matrix in readme 2020-07-22 07:52:29 -04:00
Maxim Lobanov
d0c5defdf3
Switch manifest installation from "master" to "main" branch (#65)
* switch from master to main branch

* Update README.md
2020-07-20 12:50:40 -04:00
Dmitry Shibanov
1616116e1b
Use GitHub releases to download Go versions. (#58) 2020-06-29 11:41:13 -04:00
Bryan MacFarlane
0f551ac199
Update v2 tags in readme 2020-04-16 18:52:49 -04:00
Bryan MacFarlane
e1c0a1665b
Update readme with v2 release 2020-04-16 18:52:17 -04:00
Bryan MacFarlane
78bd24e01a
Merge pull request #50 from actions/goenv
go env block
2020-04-06 09:29:27 -04:00
Bryan MacFarlane
6613fc89fc go env block 2020-04-06 08:42:55 -04:00
Bryan MacFarlane
202a594963
Merge pull request #48 from actions/matcher
More focused problem matcher regex
2020-04-03 11:51:07 -04:00
Bryan MacFarlane
0dbc7e4965 toString 2020-03-31 10:40:32 -04:00
Bryan MacFarlane
2091469f9f lint 2020-03-31 10:38:13 -04:00
Bryan MacFarlane
f32657ccaf output version of go it resolved to 2020-03-31 10:37:33 -04:00
Bryan MacFarlane
cec6ecefb4 output version of go it resolved to 2020-03-31 10:32:03 -04:00
Bryan MacFarlane
e36ce1d6cf tabs or spaces 2020-03-30 10:46:01 -04:00
Bryan MacFarlane
89c89c5036 cleaner regex 2020-03-30 10:39:29 -04:00
Bryan MacFarlane
0a62a734da another test case 2020-03-30 09:12:21 -04:00
Bryan MacFarlane
5156bc5dd3 lint 2020-03-27 20:21:13 -04:00
Bryan MacFarlane
7837b03976 more tests 2020-03-27 20:14:29 -04:00
Bryan MacFarlane
74c8095946 lint 2020-03-27 19:58:10 -04:00
Bryan MacFarlane
34223181a5 starting 2020-03-27 19:56:10 -04:00
Bryan MacFarlane
1c06f0e82e couple tests 2020-03-27 00:55:12 -04:00
Bryan MacFarlane
a030287975
Merge pull request #47 from actions/binpath
add bin to path
2020-03-26 14:08:44 -04:00
Bryan MacFarlane
3349559e91 fail on high severity 2020-03-26 14:00:03 -04:00
Bryan MacFarlane
dec4fc5647 update tool-cache version 2020-03-26 13:52:36 -04:00
Bryan MacFarlane
262468e92f only needed to do once 2020-03-26 13:46:15 -04:00
Bryan MacFarlane
4e8106ca18 create profiles go dir if go installed but not exists 2020-03-26 13:00:45 -04:00
Bryan MacFarlane
93ddff5bef lint 2020-03-26 12:55:08 -04:00
Bryan MacFarlane
3d89e603f2 more debug 2020-03-26 12:54:21 -04:00
Bryan MacFarlane
1fea44b3f0 create bin if not under go env GOPATH 2020-03-26 12:40:41 -04:00
Bryan MacFarlane
3e014ec8a4 lint 2020-03-26 12:23:38 -04:00
Bryan MacFarlane
75899f8cdf add debug 2020-03-26 12:17:32 -04:00
Bryan MacFarlane
1fdcb9b160 oops 2020-03-26 12:06:36 -04:00
Bryan MacFarlane
3d0e3826ed prefer globally installed bin 2020-03-26 12:02:52 -04:00
Bryan MacFarlane
9c31f591e9 add bin to path 2020-03-26 11:53:35 -04:00
Bryan MacFarlane
e0b6a4d694 audit fixes 2020-03-26 11:13:11 -04:00
Bryan MacFarlane
1295b8c552 fix version dir 2020-03-26 10:55:21 -04:00
Bryan MacFarlane
9b1c41166a fix version dir 2020-03-26 10:44:11 -04:00
Bryan MacFarlane
655555d319 fix cache dir issue 2020-03-26 10:38:51 -04:00
Bryan MacFarlane
2096a2c66a
Merge pull request #40 from actions/v2-proxy
v2 with proxy support
2020-02-10 19:28:14 -05:00
Bryan MacFarlane
768458bd0b pre-release version and test 2020-02-10 19:18:01 -05:00
Bryan MacFarlane
43880314e9 CR feedback 2020-02-10 15:21:04 -05:00
Bryan MacFarlane
7ea80d8e5f casing 2020-02-09 22:42:10 -05:00
Bryan MacFarlane
a6a701e18e better user output 2020-02-09 22:39:44 -05:00
Bryan MacFarlane
6b10398c43 removed unneeded console.log 2020-02-09 19:30:05 -05:00
Bryan MacFarlane
87e783e981 wf update 2020-02-09 19:25:28 -05:00
Bryan MacFarlane
a037787d02 wf update 2020-02-09 19:20:43 -05:00
Bryan MacFarlane
7d57e56d4d update tests 2020-02-09 19:05:20 -05:00
Bryan MacFarlane
6cb99a33d7 another test 2020-02-09 18:48:40 -05:00
Bryan MacFarlane
241a335117 mock os instead of system 2020-02-09 18:22:24 -05:00
Bryan MacFarlane
79b62adb05 another test and bugs 2020-02-09 18:09:15 -05:00
Bryan MacFarlane
106977639b audit workflow 2020-02-09 14:41:37 -05:00
Bryan MacFarlane
7af81a4a65 bit of cleanup 2020-02-09 14:39:34 -05:00
Bryan MacFarlane
f4b0281c15 mocked tests work with no internet 2020-02-09 09:25:20 -05:00
Bryan MacFarlane
cfc658b90a format 2020-02-09 08:47:38 -05:00
Bryan MacFarlane
3c844703e7 bugs 2020-02-09 08:44:32 -05:00
Bryan MacFarlane
dc575ee3b3 format 2020-02-09 00:29:21 -05:00
Bryan MacFarlane
4282769cc0 starting v2 and proxy support 2020-02-09 00:21:39 -05:00
303 changed files with 195382 additions and 31259 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 Normal file
View File

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

38
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,38 @@
---
name: Bug report
about: Create a bug report
title: ''
labels: bug, needs triage
assignees: ''
---
<!--- Please direct any generic questions related to actions to our support community forum at https://github.community/c/code-to-cloud/github-actions/41 --->
<!--- Before opening up a new bug report, please make sure to check for similar existing issues -->
**Description:**
A clear and concise description of what the bug is.
**Action version:**
Specify the action version
**Platform:**
- [ ] Ubuntu
- [ ] macOS
- [ ] Windows
**Runner type:**
- [ ] Hosted
- [ ] Self-hosted
**Tools version:**
<!--- Please specify go version -->
**Repro steps:**
A description with steps to reproduce the issue. If your have a public example or repo to share, please provide the link.
**Expected behavior:**
A description of what you expected to happen.
**Actual behavior:**
A description of what is actually happening.

1
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1 @@
blank_issues_enabled: false

View File

@ -0,0 +1,18 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: feature request, needs triage
assignees: ''
---
<!--- Please direct any generic questions related to actions to our support community forum at https://github.community/c/code-to-cloud/github-actions/41 --->
<!--- Before opening up a new feature request, please make sure to check for similar existing issues and pull requests -->
**Description:**
Describe your proposal.
**Justification:**
Justification or a use case for your proposal.
**Are you willing to submit a PR?**
<!--- We accept contributions! -->

16
.github/go.json vendored
View File

@ -1,16 +0,0 @@
{
"problemMatcher": [
{
"owner": "go",
"pattern": [
{
"regexp": "^([^:]*: )?((.:)?[^:]*):(\\d+)(:(\\d+))?: (.*)$",
"file": 2,
"line": 4,
"column": 6,
"message": 7
}
]
}
]
}

9
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,9 @@
**Description:**
Describe your changes.
**Related issue:**
Add link to the related issue.
**Check list:**
- [ ] Mark if documentation changes are required.
- [ ] Mark if tests were added or updated to cover the changes.

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'

19
.github/workflows/check-dist.yml vendored Normal file
View File

@ -0,0 +1,19 @@
name: Check dist/
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
call-check-dist:
name: Check dist/
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
with:
node-version: '20'

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

14
.github/workflows/licensed.yml vendored Normal file
View File

@ -0,0 +1,14 @@
name: Licensed
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
call-licensed:
name: Licensed
uses: actions/reusable-workflows/.github/workflows/licensed.yml@main

View File

@ -0,0 +1,28 @@
name: Release new action version
on:
release:
types: [released]
workflow_dispatch:
inputs:
TAG_NAME:
description: 'Tag name that the major tag will point to'
required: true
env:
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
permissions:
contents: write
jobs:
update_tag:
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes
environment:
name: releaseNewActionVersion
runs-on: ubuntu-latest
steps:
- name: Update the ${{ env.TAG_NAME }} tag
uses: actions/publish-action@v0.2.2
with:
source-tag: ${{ env.TAG_NAME }}
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

194
.github/workflows/versions.yml vendored Normal file
View File

@ -0,0 +1,194 @@
name: Validate 'setup-go'
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
schedule:
- cron: 0 0 * * *
jobs:
stable:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Setup Go Stable
uses: ./
with:
go-version: stable
- name: Verify Go
run: go version
oldstable:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Setup Go oldStable
uses: ./
with:
go-version: oldstable
- name: Verify Go
run: go version
aliases-arch:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
version: [stable, oldstable]
architecture: [x64, x32]
exclude:
- os: macos-latest
architecture: x32
steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.version }} ${{ matrix.architecture }}
uses: ./
with:
go-version: ${{ matrix.version }}
architecture: ${{ matrix.architecture }}
- name: Verify Go
run: go version
local-cache:
name: Setup local-cache version
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
go: [1.20.14, 1.21.10, 1.22.3]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: setup-go ${{ matrix.go }}
uses: ./
with:
go-version: ${{ matrix.go }}
- name: verify go
run: __tests__/verify-go.sh ${{ matrix.go }}
shell: bash
check-latest:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
go-version: [1.20.14, 1.21]
steps:
- uses: actions/checkout@v4
- name: Setup Go and check latest
uses: ./
with:
go-version: ${{ matrix.go-version }}
check-latest: true
- name: Verify Go
run: go version
go-version-file:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Setup Go and check latest
uses: ./
with:
go-version-file: __tests__/data/go.mod
- name: verify go
run: __tests__/verify-go.sh 1.20.14
shell: bash
go-version-file-with-gowork:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Setup Go and check latest
uses: ./
with:
go-version-file: __tests__/data/go.work
- name: verify go
run: __tests__/verify-go.sh 1.21
shell: bash
setup-versions-from-manifest:
name: Setup ${{ matrix.go }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
go: [1.20.14, 1.21.10, 1.22.3]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: setup-go ${{ matrix.go }}
uses: ./
with:
go-version: ${{ matrix.go }}
- name: verify go
run: __tests__/verify-go.sh ${{ matrix.go }}
shell: bash
setup-versions-from-dist:
name: Setup ${{ matrix.go }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
go: [1.20.14, 1.21]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: setup-go ${{ matrix.go }}
uses: ./
with:
go-version: ${{ matrix.go }}
- name: verify go
run: __tests__/verify-go.sh ${{ matrix.go }}
shell: bash
architecture:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
go-version: [1.20.14, 1.21]
steps:
- uses: actions/checkout@v4
- name: Setup Go and check latest
uses: ./
with:
go-version: ${{ matrix.go-version }}
architecture: x64
- name: Verify Go
run: go version

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,26 +0,0 @@
name: Main workflow
on: [push]
jobs:
run:
name: Run
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@master
- name: Set Node.js 10.x
uses: actions/setup-node@master
with:
version: 10.x
- name: npm install
run: npm install
- name: Lint
run: npm run format-check
- name: npm test
run: npm test

5
.gitignore vendored
View File

@ -1,6 +1,5 @@
# Explicitly not ignoring node_modules so that they are included in package downloaded by runner
!node_modules/
__tests__/runner/*
node_modules/
lib
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs

15
.licensed.yml Normal file
View File

@ -0,0 +1,15 @@
sources:
npm: true
allowed:
- apache-2.0
- bsd-2-clause
- bsd-3-clause
- isc
- mit
- cc0-1.0
- unlicense
- 0bsd
reviewed:
npm:

BIN
.licenses/npm/@actions/cache.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@actions/core.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@actions/exec.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@actions/glob-0.1.2.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@actions/glob-0.4.0.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@actions/http-client.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@actions/io.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@actions/tool-cache.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/@azure/core-auth.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@azure/core-http.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@azure/core-lro.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@azure/core-paging.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@azure/core-tracing.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@azure/core-util.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@azure/logger.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@azure/ms-rest-js.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@azure/storage-blob.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@fastify/busboy.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@opentelemetry/api.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@types/node-fetch.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@types/node.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@types/tunnel.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/abort-controller.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/asynckit.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/balanced-match.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/brace-expansion.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/combined-stream.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/concat-map.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/delayed-stream.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/event-target-shim.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/events.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/form-data-2.5.1.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/form-data-4.0.0.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/lru-cache.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/mime-db.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/mime-types.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/minimatch.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/node-fetch.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/process.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/sax.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/semver-6.3.1.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/semver-7.6.0.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/tr46.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/tslib-1.14.1.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/tslib-2.6.2.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/tunnel.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/undici-types.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/undici.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/uuid-3.4.0.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/uuid-8.3.2.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/webidl-conversions.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/whatwg-url.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/xml2js.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/xmlbuilder.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/yallist.dep.yml generated Normal file

Binary file not shown.

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"
}

1
CODEOWNERS Normal file
View File

@ -0,0 +1 @@
* @actions/setup-actions-team

76
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at opensource+actions/setup-go@github.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

258
README.md
View File

@ -1,46 +1,272 @@
# setup-go
<p align="left">
<a href="https://github.com/actions/setup-go"><img alt="GitHub Actions status" src="https://github.com/actions/setup-go/workflows/Main%20workflow/badge.svg"></a>
</p>
[![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)
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
- registering problem matchers for error output
- Optionally downloading and caching a version of Go by version and adding to `PATH`.
- 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
The V3 edition of the action offers:
- Adds `GOBIN` to the `PATH`
- Proxy support
- Check latest version
- Caching packages dependencies
- stable and oldstable aliases
- 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).
**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):
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.13.1' # The Go version to download (if necessary) and use.
- run: go version
```
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '>=1.17.0'
- 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:
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.18.0-rc.1' # The Go version to download (if necessary) and use.
- run: go version
```
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.16.0-beta.1' # The Go version to download (if necessary) and use.
- run: go version
```
# Usage
See [action.yml](action.yml)
Basic:
## Basic
```yaml
steps:
- uses: actions/checkout@master
- uses: actions/setup-go@v1
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.9.3' # 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
```
Matrix Testing:
## 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.
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.
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.14'
check-latest: true
- run: go run hello.go
```
## 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 `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`
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 'stable'
- run: go run hello.go
```
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 'oldstable'
- run: go run hello.go
```
## Caching dependency files and build outputs:
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 input supports glob patterns.
If some problem that prevents success caching happens then the action issues the warning in the log and continues the execution of the pipeline.
**Caching in monorepos**
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.17'
check-latest: true
cache-dependency-path: |
subdir/go.sum
tools/go.sum
# cache-dependency-path: "**/*.sum"
- run: go run hello.go
```
## 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.
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.
> The action will search for the `go.mod` file relative to the repository root
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'path/to/go.mod'
- run: go version
```
## Matrix testing
```yaml
jobs:
build:
runs-on: ubuntu-16.04
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.8', '1.9.3', '1.10.x' ]
go: [ '1.14', '1.13' ]
name: Go ${{ matrix.go }} sample
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- run: go run hello.go
```
### Supported version syntax
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`
- 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.
## 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.
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
uses: actions/setup-go@v5
with:
token: ${{ secrets.GH_DOTCOM_TOKEN }}
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.
# License
The scripts and documentation in this project are released under the [MIT License](LICENSE)
@ -48,3 +274,7 @@ The scripts and documentation in this project are released under the [MIT Licens
# Contributions
Contributions are welcome! See [Contributor's Guide](docs/contributors.md)
## Code of Conduct
:wave: Be nice. See [our code of conduct](CODE_OF_CONDUCT.md)

View File

@ -0,0 +1,99 @@
import * as cache from '@actions/cache';
import * as core from '@actions/core';
import * as glob from '@actions/glob';
import * as cacheRestore from '../src/cache-restore';
import * as cacheUtils from '../src/cache-utils';
import {PackageManagerInfo} from '../src/package-managers';
describe('restoreCache', () => {
//Arrange
const hashFilesSpy = jest.spyOn(glob, 'hashFiles');
const getCacheDirectoryPathSpy = jest.spyOn(
cacheUtils,
'getCacheDirectoryPath'
);
const restoreCacheSpy = jest.spyOn(cache, 'restoreCache');
const infoSpy = jest.spyOn(core, 'info');
const setOutputSpy = jest.spyOn(core, 'setOutput');
const versionSpec = '1.13.1';
const packageManager = 'default';
const cacheDependencyPath = 'path';
beforeEach(() => {
getCacheDirectoryPathSpy.mockImplementation(
(PackageManager: PackageManagerInfo) => {
return new Promise<string[]>(resolve => {
resolve(['cache_directory_path', 'cache_directory_path']);
});
}
);
});
it('should throw if dependency file path is not valid', async () => {
//Arrange
hashFilesSpy.mockImplementation((somePath: string) => {
return new Promise<string>(resolve => {
resolve('');
});
});
//Act + Assert
await expect(async () => {
await cacheRestore.restoreCache(
versionSpec,
packageManager,
cacheDependencyPath
);
}).rejects.toThrow(
'Some specified paths were not resolved, unable to cache dependencies.'
);
});
it('should inform if cache hit is not occured', async () => {
//Arrange
hashFilesSpy.mockImplementation((somePath: string) => {
return new Promise<string>(resolve => {
resolve('file_hash');
});
});
restoreCacheSpy.mockImplementation(() => {
return new Promise<string>(resolve => {
resolve('');
});
});
//Act + Assert
await cacheRestore.restoreCache(
versionSpec,
packageManager,
cacheDependencyPath
);
expect(infoSpy).toHaveBeenCalledWith(`Cache is not found`);
});
it('should set output if cache hit is occured', async () => {
//Arrange
hashFilesSpy.mockImplementation((somePath: string) => {
return new Promise<string>(resolve => {
resolve('file_hash');
});
});
restoreCacheSpy.mockImplementation(() => {
return new Promise<string>(resolve => {
resolve('cache_key');
});
});
//Act + Assert
await cacheRestore.restoreCache(
versionSpec,
packageManager,
cacheDependencyPath
);
expect(setOutputSpy).toHaveBeenCalledWith('cache-hit', true);
});
});

View File

@ -0,0 +1,211 @@
import * as exec from '@actions/exec';
import * as cache from '@actions/cache';
import * as core from '@actions/core';
import * as cacheUtils from '../src/cache-utils';
import {PackageManagerInfo} from '../src/package-managers';
describe('getCommandOutput', () => {
//Arrange
const getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
it('should return trimmed stdout in case of successful exit code', async () => {
//Arrange
const stdoutResult = ' stdout ';
const trimmedStdout = stdoutResult.trim();
getExecOutputSpy.mockImplementation((commandLine: string) => {
return new Promise<exec.ExecOutput>(resolve => {
resolve({exitCode: 0, stdout: stdoutResult, stderr: ''});
});
});
//Act + Assert
return cacheUtils
.getCommandOutput('command')
.then(data => expect(data).toBe(trimmedStdout));
});
it('should return error in case of unsuccessful exit code', async () => {
//Arrange
const stderrResult = 'error message';
getExecOutputSpy.mockImplementation((commandLine: string) => {
return new Promise<exec.ExecOutput>(resolve => {
resolve({exitCode: 10, stdout: '', stderr: stderrResult});
});
});
//Act + Assert
await expect(async () => {
await cacheUtils.getCommandOutput('command');
}).rejects.toThrow();
});
});
describe('getPackageManagerInfo', () => {
it('should return package manager info in case of valid package manager name', async () => {
//Arrange
const packageManagerName = 'default';
const expectedResult = {
dependencyFilePattern: 'go.sum',
cacheFolderCommandList: ['go env GOMODCACHE', 'go env GOCACHE']
};
//Act + Assert
return cacheUtils
.getPackageManagerInfo(packageManagerName)
.then(data => expect(data).toEqual(expectedResult));
});
it('should throw the error in case of invalid package manager name', async () => {
//Arrange
const packageManagerName = 'invalidName';
//Act + Assert
await expect(async () => {
await cacheUtils.getPackageManagerInfo(packageManagerName);
}).rejects.toThrow();
});
});
describe('getCacheDirectoryPath', () => {
//Arrange
const getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
const validPackageManager: PackageManagerInfo = {
dependencyFilePattern: 'go.sum',
cacheFolderCommandList: ['go env GOMODCACHE', 'go env GOCACHE']
};
it('should return path to the cache folders which specified package manager uses', async () => {
//Arrange
getExecOutputSpy.mockImplementation((commandLine: string) => {
return new Promise<exec.ExecOutput>(resolve => {
resolve({exitCode: 0, stdout: 'path/to/cache/folder', stderr: ''});
});
});
const expectedResult = ['path/to/cache/folder', 'path/to/cache/folder'];
//Act + Assert
return cacheUtils
.getCacheDirectoryPath(validPackageManager)
.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 () => {
getExecOutputSpy.mockImplementation((commandLine: string) => {
return new Promise<exec.ExecOutput>(resolve => {
resolve({exitCode: 10, stdout: '', stderr: 'Error message'});
});
});
//Act + Assert
await expect(async () => {
await cacheUtils.getCacheDirectoryPath(validPackageManager);
}).rejects.toThrow();
});
});
describe('isCacheFeatureAvailable', () => {
//Arrange
const isFeatureAvailableSpy = jest.spyOn(cache, 'isFeatureAvailable');
const warningSpy = jest.spyOn(core, 'warning');
it('should return true when cache feature is available', () => {
//Arrange
isFeatureAvailableSpy.mockImplementation(() => {
return true;
});
//Act
const functionResult = cacheUtils.isCacheFeatureAvailable();
//Assert
expect(functionResult).toBeTruthy();
});
it('should warn when cache feature is unavailable and GHES is not used', () => {
//Arrange
isFeatureAvailableSpy.mockImplementation(() => {
return false;
});
process.env['GITHUB_SERVER_URL'] = 'https://github.com';
const warningMessage =
'The runner was not able to contact the cache service. Caching will be skipped';
//Act
cacheUtils.isCacheFeatureAvailable();
//Assert
expect(warningSpy).toHaveBeenCalledWith(warningMessage);
});
it('should return false when cache feature is unavailable', () => {
//Arrange
isFeatureAvailableSpy.mockImplementation(() => {
return false;
});
process.env['GITHUB_SERVER_URL'] = 'https://github.com';
//Act
const functionResult = cacheUtils.isCacheFeatureAvailable();
//Assert
expect(functionResult).toBeFalsy();
});
it('should warn when cache feature is unavailable and GHES is used', () => {
//Arrange
isFeatureAvailableSpy.mockImplementation(() => {
return false;
});
process.env['GITHUB_SERVER_URL'] = 'https://nongithub.com';
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.';
//Act + Assert
expect(cacheUtils.isCacheFeatureAvailable()).toBeFalsy();
expect(warningSpy).toHaveBeenCalledWith(warningMessage);
});
});

12
__tests__/data/go.mod Normal file
View File

@ -0,0 +1,12 @@
module example.com/mymodule
go 1.20
require (
example.com/othermodule v1.2.3
example.com/thismodule v1.2.3
example.com/thatmodule v1.2.3
)
replace example.com/thatmodule => ../thatmodule
exclude example.com/thismodule v1.3.0

3
__tests__/data/go.work Normal file
View File

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,102 @@
[
{
"version": "1.17.6",
"stable": true,
"release_url": "https://github.com/actions/go-versions/releases/tag/1.17.6-1668090892",
"files": [
{
"filename": "go-1.17.6-darwin-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://github.com/actions/go-versions/releases/download/1.17.6-1668090892/go-1.17.6-darwin-x64.tar.gz"
},
{
"filename": "go-1.17.6-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://github.com/actions/go-versions/releases/download/1.17.6-1668090892/go-1.17.6-linux-x64.tar.gz"
},
{
"filename": "go-1.17.6-win32-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://github.com/actions/go-versions/releases/download/1.17.6-1668090892/go-1.17.6-win32-x64.zip"
}
]
},
{
"version": "1.12.17",
"stable": true,
"release_url": "https://github.com/actions/go-versions/releases/tag/1.12.17-20200616.21",
"files": [
{
"filename": "go-1.12.17-darwin-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://github.com/actions/go-versions/releases/download/1.12.17-20200616.21/go-1.12.17-darwin-x64.tar.gz"
},
{
"filename": "go-1.12.17-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://github.com/actions/go-versions/releases/download/1.12.17-20200616.21/go-1.12.17-linux-x64.tar.gz"
},
{
"filename": "go-1.12.17-win32-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://github.com/actions/go-versions/releases/download/1.12.17-20200616.21/go-1.12.17-win32-x64.zip"
}
]
},
{
"version": "1.12.16",
"stable": true,
"release_url": "https://github.com/actions/go-versions/releases/tag/1.12.16-20200616.20",
"files": [
{
"filename": "go-1.12.16-darwin-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://github.com/actions/go-versions/releases/download/1.12.16-20200616.20/go-1.12.16-darwin-x64.tar.gz"
},
{
"filename": "go-1.12.16-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://github.com/actions/go-versions/releases/download/1.12.16-20200616.20/go-1.12.16-linux-x64.tar.gz"
},
{
"filename": "go-1.12.16-win32-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://github.com/actions/go-versions/releases/download/1.12.16-20200616.20/go-1.12.16-win32-x64.zip"
}
]
},
{
"version": "1.9.7",
"stable": true,
"release_url": "https://github.com/actions/go-versions/releases/tag/1.9.7-20200616.1",
"files": [
{
"filename": "go-1.9.7-darwin-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://github.com/actions/go-versions/releases/download/1.9.7/go-1.9.7-darwin-x64.tar.gz"
},
{
"filename": "go-1.9.7-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://github.com/actions/go-versions/releases/download/1.9.7/go-1.9.7-linux-x64.tar.gz"
},
{
"filename": "go-1.9.7-win32-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://github.com/actions/go-versions/releases/download/1.9.7/go-1.9.7-win32-x64.zip"
}
]
}
]

View File

@ -1,126 +0,0 @@
import io = require('@actions/io');
import fs = require('fs');
import os = require('os');
import path = require('path');
import nock = require('nock');
const toolDir = path.join(__dirname, 'runner', 'tools');
const tempDir = path.join(__dirname, 'runner', 'temp');
const dataDir = path.join(__dirname, 'data');
process.env['RUNNER_TOOL_CACHE'] = toolDir;
process.env['RUNNER_TEMP'] = tempDir;
import * as installer from '../src/installer';
const IS_WINDOWS = process.platform === 'win32';
describe('installer tests', () => {
beforeAll(async () => {
await io.rmRF(toolDir);
await io.rmRF(tempDir);
}, 100000);
afterAll(async () => {
try {
await io.rmRF(toolDir);
await io.rmRF(tempDir);
} catch {
console.log('Failed to remove test directories');
}
}, 100000);
it('Acquires version of go if no matching version is installed', async () => {
await installer.getGo('1.10.8');
const goDir = path.join(toolDir, 'go', '1.10.8', os.arch());
expect(fs.existsSync(`${goDir}.complete`)).toBe(true);
if (IS_WINDOWS) {
expect(fs.existsSync(path.join(goDir, 'bin', 'go.exe'))).toBe(true);
} else {
expect(fs.existsSync(path.join(goDir, 'bin', 'go'))).toBe(true);
}
}, 100000);
describe('the latest release of a go version', () => {
beforeEach(() => {
nock('https://golang.org')
.get('/dl/')
.query({mode: 'json', include: 'all'})
.replyWithFile(200, path.join(dataDir, 'golang-dl.json'));
});
afterEach(() => {
nock.cleanAll();
nock.enableNetConnect();
});
it('Acquires latest release version of go 1.10 if using 1.10 and no matching version is installed', async () => {
await installer.getGo('1.10');
const goDir = path.join(toolDir, 'go', '1.10.8', os.arch());
expect(fs.existsSync(`${goDir}.complete`)).toBe(true);
if (IS_WINDOWS) {
expect(fs.existsSync(path.join(goDir, 'bin', 'go.exe'))).toBe(true);
} else {
expect(fs.existsSync(path.join(goDir, 'bin', 'go'))).toBe(true);
}
}, 100000);
it('Acquires latest release version of go 1.10 if using 1.10.x and no matching version is installed', async () => {
await installer.getGo('1.10.x');
const goDir = path.join(toolDir, 'go', '1.10.8', os.arch());
expect(fs.existsSync(`${goDir}.complete`)).toBe(true);
if (IS_WINDOWS) {
expect(fs.existsSync(path.join(goDir, 'bin', 'go.exe'))).toBe(true);
} else {
expect(fs.existsSync(path.join(goDir, 'bin', 'go'))).toBe(true);
}
}, 100000);
it('Acquires latest release version of go if using 1.x and no matching version is installed', async () => {
await installer.getGo('1.x');
const goDir = path.join(toolDir, 'go', '1.13.0', os.arch());
expect(fs.existsSync(`${goDir}.complete`)).toBe(true);
if (IS_WINDOWS) {
expect(fs.existsSync(path.join(goDir, 'bin', 'go.exe'))).toBe(true);
} else {
expect(fs.existsSync(path.join(goDir, 'bin', 'go'))).toBe(true);
}
}, 100000);
});
it('Throws if no location contains correct go version', async () => {
let thrown = false;
try {
await installer.getGo('1000.0');
} catch {
thrown = true;
}
expect(thrown).toBe(true);
});
it('Uses version of go installed in cache', async () => {
const goDir: string = path.join(toolDir, 'go', '250.0.0', os.arch());
await io.mkdirP(goDir);
fs.writeFileSync(`${goDir}.complete`, 'hello');
// This will throw if it doesn't find it in the cache (because no such version exists)
await installer.getGo('250.0');
return;
});
it('Doesnt use version of go that was only partially installed in cache', async () => {
const goDir: string = path.join(toolDir, 'go', '251.0.0', os.arch());
await io.mkdirP(goDir);
let thrown = false;
try {
// This will throw if it doesn't find it in the cache (because no such version exists)
await installer.getGo('251.0');
} catch {
thrown = true;
}
expect(thrown).toBe(true);
return;
});
});

969
__tests__/setup-go.test.ts Normal file
View File

@ -0,0 +1,969 @@
import * as core from '@actions/core';
import * as io from '@actions/io';
import * as tc from '@actions/tool-cache';
import fs from 'fs';
import cp from 'child_process';
import osm, {type} from 'os';
import path from 'path';
import * as main from '../src/main';
import * as im from '../src/installer';
import goJsonData from './data/golang-dl.json';
import matchers from '../matchers.json';
import goTestManifest from './data/versions-manifest.json';
const matcherPattern = matchers.problemMatcher[0].pattern[0];
const matcherRegExp = new RegExp(matcherPattern.regexp);
const win32Join = path.win32.join;
const posixJoin = path.posix.join;
jest.setTimeout(10000);
describe('setup-go', () => {
let inputs = {} as any;
let os = {} as any;
let inSpy: jest.SpyInstance;
let getBooleanInputSpy: jest.SpyInstance;
let exportVarSpy: jest.SpyInstance;
let findSpy: jest.SpyInstance;
let cnSpy: jest.SpyInstance;
let logSpy: jest.SpyInstance;
let getSpy: jest.SpyInstance;
let platSpy: jest.SpyInstance;
let archSpy: jest.SpyInstance;
let joinSpy: jest.SpyInstance;
let dlSpy: jest.SpyInstance;
let extractTarSpy: jest.SpyInstance;
let extractZipSpy: jest.SpyInstance;
let cacheSpy: jest.SpyInstance;
let dbgSpy: jest.SpyInstance;
let whichSpy: jest.SpyInstance;
let existsSpy: jest.SpyInstance;
let readFileSpy: jest.SpyInstance;
let mkdirpSpy: jest.SpyInstance;
let mkdirSpy: jest.SpyInstance;
let symlinkSpy: jest.SpyInstance;
let execSpy: jest.SpyInstance;
let getManifestSpy: jest.SpyInstance;
let getAllVersionsSpy: jest.SpyInstance;
beforeAll(async () => {
process.env['GITHUB_ENV'] = ''; // Stub out Environment file functionality so we can verify it writes to standard out (toolkit is backwards compatible)
}, 100000);
beforeEach(() => {
process.env['GITHUB_PATH'] = ''; // Stub out ENV file functionality so we can verify it writes to standard out
// @actions/core
inputs = {};
inSpy = jest.spyOn(core, 'getInput');
inSpy.mockImplementation(name => inputs[name]);
getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
getBooleanInputSpy.mockImplementation(name => inputs[name]);
exportVarSpy = jest.spyOn(core, 'exportVariable');
// node
os = {};
platSpy = jest.spyOn(osm, 'platform');
platSpy.mockImplementation(() => os['platform']);
archSpy = jest.spyOn(osm, 'arch');
archSpy.mockImplementation(() => os['arch']);
execSpy = jest.spyOn(cp, 'execSync');
// switch path join behaviour based on set os.platform
joinSpy = jest.spyOn(path, 'join');
joinSpy.mockImplementation((...paths: string[]): string => {
if (os['platform'] == 'win32') {
return win32Join(...paths);
}
return posixJoin(...paths);
});
// @actions/tool-cache
findSpy = jest.spyOn(tc, 'find');
dlSpy = jest.spyOn(tc, 'downloadTool');
extractTarSpy = jest.spyOn(tc, 'extractTar');
extractZipSpy = jest.spyOn(tc, 'extractZip');
cacheSpy = jest.spyOn(tc, 'cacheDir');
getSpy = jest.spyOn(im, 'getVersionsDist');
getManifestSpy = jest.spyOn(tc, 'getManifestFromRepo');
getAllVersionsSpy = jest.spyOn(im, 'getManifest');
// io
whichSpy = jest.spyOn(io, 'which');
existsSpy = jest.spyOn(fs, 'existsSync');
readFileSpy = jest.spyOn(fs, 'readFileSync');
mkdirpSpy = jest.spyOn(io, 'mkdirP');
// fs
mkdirSpy = jest.spyOn(fs, 'mkdir');
symlinkSpy = jest.spyOn(fs, 'symlinkSync');
symlinkSpy.mockImplementation(() => {});
// gets
getManifestSpy.mockImplementation(() => <tc.IToolRelease[]>goTestManifest);
// writes
cnSpy = jest.spyOn(process.stdout, 'write');
logSpy = jest.spyOn(core, 'info');
dbgSpy = jest.spyOn(core, 'debug');
getSpy.mockImplementation(() => <im.IGoVersion[] | null>goJsonData);
cnSpy.mockImplementation(line => {
// uncomment to debug
// process.stderr.write('write:' + line + '\n');
});
logSpy.mockImplementation(line => {
// uncomment to debug
//process.stderr.write('log:' + line + '\n');
});
dbgSpy.mockImplementation(msg => {
// uncomment to see debug output
// process.stderr.write(msg + '\n');
});
});
afterEach(() => {
//jest.resetAllMocks();
jest.clearAllMocks();
//jest.restoreAllMocks();
});
afterAll(async () => {
jest.restoreAllMocks();
}, 100000);
it('can extract the major.minor.patch version from a given Go version string', async () => {
const goVersionOutput = 'go version go1.16.6 darwin/amd64';
expect(main.parseGoVersion(goVersionOutput)).toBe('1.16.6');
});
it('can find 1.9.7 from manifest on osx', async () => {
os.platform = 'darwin';
os.arch = 'x64';
const match = await im.getInfoFromManifest('1.9.7', true, 'mocktoken');
expect(match).toBeDefined();
expect(match!.resolvedVersion).toBe('1.9.7');
expect(match!.type).toBe('manifest');
expect(match!.downloadUrl).toBe(
'https://github.com/actions/go-versions/releases/download/1.9.7/go-1.9.7-darwin-x64.tar.gz'
);
});
it('can find 1.9 from manifest on linux', async () => {
os.platform = 'linux';
os.arch = 'x64';
const match = await im.getInfoFromManifest('1.9.7', true, 'mocktoken');
expect(match).toBeDefined();
expect(match!.resolvedVersion).toBe('1.9.7');
expect(match!.type).toBe('manifest');
expect(match!.downloadUrl).toBe(
'https://github.com/actions/go-versions/releases/download/1.9.7/go-1.9.7-linux-x64.tar.gz'
);
});
it('can find 1.9 from manifest on windows', async () => {
os.platform = 'win32';
os.arch = 'x64';
const match = await im.getInfoFromManifest('1.9.7', true, 'mocktoken');
expect(match).toBeDefined();
expect(match!.resolvedVersion).toBe('1.9.7');
expect(match!.type).toBe('manifest');
expect(match!.downloadUrl).toBe(
'https://github.com/actions/go-versions/releases/download/1.9.7/go-1.9.7-win32-x64.zip'
);
});
it('finds stable match for exact dot zero version', async () => {
os.platform = 'darwin';
os.arch = 'x64';
// spec: 1.13.0 => 1.13
const match: im.IGoVersion | undefined = await im.findMatch('1.13.0');
expect(match).toBeDefined();
const version: string = match ? match.version : '';
expect(version).toBe('go1.13');
const fileName = match ? match.files[0].filename : '';
expect(fileName).toBe('go1.13.darwin-amd64.tar.gz');
});
it('finds latest patch version for minor version spec', async () => {
os.platform = 'linux';
os.arch = 'x64';
// spec: 1.13 => 1.13.7 (latest)
const match: im.IGoVersion | undefined = await im.findMatch('1.13');
expect(match).toBeDefined();
const version: string = match ? match.version : '';
expect(version).toBe('go1.13.7');
const fileName = match ? match.files[0].filename : '';
expect(fileName).toBe('go1.13.7.linux-amd64.tar.gz');
});
it('finds latest patch version for caret version spec', async () => {
os.platform = 'linux';
os.arch = 'x64';
// spec: ^1.13.6 => 1.13.7
const match: im.IGoVersion | undefined = await im.findMatch('^1.13.6');
expect(match).toBeDefined();
const version: string = match ? match.version : '';
expect(version).toBe('go1.13.7');
const fileName = match ? match.files[0].filename : '';
expect(fileName).toBe('go1.13.7.linux-amd64.tar.gz');
});
it('finds latest version for major version spec', async () => {
os.platform = 'win32';
os.arch = 'x32';
// spec: 1 => 1.13.7 (latest)
const match: im.IGoVersion | undefined = await im.findMatch('1');
expect(match).toBeDefined();
const version: string = match ? match.version : '';
expect(version).toBe('go1.13.7');
const fileName = match ? match.files[0].filename : '';
expect(fileName).toBe('go1.13.7.windows-386.zip');
});
it('finds unstable pre-release version', async () => {
os.platform = 'linux';
os.arch = 'x64';
// spec: 1.14, stable=false => go1.14rc1
const match: im.IGoVersion | undefined = await im.findMatch('1.14.0-rc.1');
expect(match).toBeDefined();
const version: string = match ? match.version : '';
expect(version).toBe('go1.14rc1');
const fileName = match ? match.files[0].filename : '';
expect(fileName).toBe('go1.14rc1.linux-amd64.tar.gz');
});
it('evaluates to stable with input as true', async () => {
inputs['go-version'] = '1.13.0';
inputs.stable = 'true';
const toolPath = path.normalize('/cache/go/1.13.0/x64');
findSpy.mockImplementation(() => toolPath);
await main.run();
expect(logSpy).toHaveBeenCalledWith(`Setup go version spec 1.13.0`);
});
it('evaluates to stable with no input', async () => {
inputs['go-version'] = '1.13.0';
inSpy.mockImplementation(name => inputs[name]);
const toolPath = path.normalize('/cache/go/1.13.0/x64');
findSpy.mockImplementation(() => toolPath);
await main.run();
expect(logSpy).toHaveBeenCalledWith(`Setup go version spec 1.13.0`);
});
it('does not export any variables for Go versions >=1.9', async () => {
inputs['go-version'] = '1.13.0';
inSpy.mockImplementation(name => inputs[name]);
const toolPath = path.normalize('/cache/go/1.13.0/x64');
findSpy.mockImplementation(() => toolPath);
const vars: {[key: string]: string} = {};
exportVarSpy.mockImplementation((name: string, val: string) => {
vars[name] = val;
});
await main.run();
expect(vars).toStrictEqual({});
});
it('exports GOROOT for Go versions <1.9', async () => {
inputs['go-version'] = '1.8';
inSpy.mockImplementation(name => inputs[name]);
const toolPath = path.normalize('/cache/go/1.8.0/x64');
findSpy.mockImplementation(() => toolPath);
const vars: {[key: string]: string} = {};
exportVarSpy.mockImplementation((name: string, val: string) => {
vars[name] = val;
});
await main.run();
expect(vars).toStrictEqual({
GOROOT: toolPath
});
});
it('finds a version of go already in the cache', async () => {
inputs['go-version'] = '1.13.0';
const toolPath = path.normalize('/cache/go/1.13.0/x64');
findSpy.mockImplementation(() => toolPath);
await main.run();
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
});
it('finds a version in the cache and adds it to the path', async () => {
inputs['go-version'] = '1.13.0';
const toolPath = path.normalize('/cache/go/1.13.0/x64');
findSpy.mockImplementation(() => toolPath);
await main.run();
const expPath = path.join(toolPath, 'bin');
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
});
it('handles unhandled error and reports error', async () => {
const errMsg = 'unhandled error message';
inputs['go-version'] = '1.13.0';
findSpy.mockImplementation(() => {
throw new Error(errMsg);
});
await main.run();
expect(cnSpy).toHaveBeenCalledWith('::error::' + errMsg + osm.EOL);
});
it('downloads a version not in the cache', async () => {
os.platform = 'linux';
os.arch = 'x64';
inputs['go-version'] = '1.13.1';
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(() => '/some/temp/path');
const toolPath = path.normalize('/cache/go/1.13.0/x64');
extractTarSpy.mockImplementation(() => '/some/other/temp/path');
cacheSpy.mockImplementation(() => toolPath);
await main.run();
const expPath = path.join(toolPath, 'bin');
expect(dlSpy).toHaveBeenCalled();
expect(extractTarSpy).toHaveBeenCalled();
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
});
it('downloads a version not in the cache (windows)', async () => {
os.platform = 'win32';
os.arch = 'x64';
inputs['go-version'] = '1.13.1';
process.env['RUNNER_TEMP'] = 'C:\\temp\\';
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(() => 'C:\\temp\\some\\path');
extractZipSpy.mockImplementation(() => 'C:\\temp\\some\\other\\path');
const toolPath = path.normalize('C:\\cache\\go\\1.13.0\\x64');
cacheSpy.mockImplementation(() => toolPath);
await main.run();
const expPath = path.win32.join(toolPath, 'bin');
expect(dlSpy).toHaveBeenCalledWith(
'https://storage.googleapis.com/golang/go1.13.1.windows-amd64.zip',
'C:\\temp\\go1.13.1.windows-amd64.zip',
undefined
);
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
});
it('does not find a version that does not exist', async () => {
os.platform = 'linux';
os.arch = 'x64';
inputs['go-version'] = '9.99.9';
findSpy.mockImplementation(() => '');
await main.run();
expect(cnSpy).toHaveBeenCalledWith(
`::error::Unable to find Go version '9.99.9' for platform linux and architecture x64.${osm.EOL}`
);
});
it('downloads a version from a manifest match', async () => {
os.platform = 'linux';
os.arch = 'x64';
const versionSpec = '1.12.16';
inputs['go-version'] = versionSpec;
inputs['token'] = 'faketoken';
const expectedUrl =
'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
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path');
const toolPath = path.normalize('/cache/go/1.12.16/x64');
extractTarSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () => toolPath);
await main.run();
const expPath = path.join(toolPath, 'bin');
expect(dlSpy).toHaveBeenCalled();
expect(extractTarSpy).toHaveBeenCalled();
expect(logSpy).not.toHaveBeenCalledWith(
'Not found in manifest. Falling back to download directly from Go'
);
expect(logSpy).toHaveBeenCalledWith(
`Acquiring 1.12.16 from ${expectedUrl}`
);
expect(logSpy).toHaveBeenCalledWith(`Added go to the path`);
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
});
it('downloads a major and minor from a manifest match', async () => {
os.platform = 'linux';
os.arch = 'x64';
const versionSpec = '1.12';
inputs['go-version'] = versionSpec;
inputs['token'] = 'faketoken';
const expectedUrl =
'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
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path');
const toolPath = path.normalize('/cache/go/1.12.17/x64');
extractTarSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () => toolPath);
await main.run();
const expPath = path.join(toolPath, 'bin');
expect(dlSpy).toHaveBeenCalled();
expect(extractTarSpy).toHaveBeenCalled();
expect(logSpy).not.toHaveBeenCalledWith(
'Not found in manifest. Falling back to download directly from Go'
);
expect(logSpy).toHaveBeenCalledWith(
`Acquiring 1.12.17 from ${expectedUrl}`
);
expect(logSpy).toHaveBeenCalledWith(`Added go to the path`);
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
});
it('falls back to a version from go dist', async () => {
os.platform = 'linux';
os.arch = 'x64';
const versionSpec = '1.12.14';
inputs['go-version'] = versionSpec;
inputs['token'] = 'faketoken';
// ... but not in the local cache
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path');
const toolPath = path.normalize('/cache/go/1.12.14/x64');
extractTarSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () => toolPath);
await main.run();
const expPath = path.join(toolPath, 'bin');
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.12.14');
expect(findSpy).toHaveBeenCalled();
expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.12.14...');
expect(dlSpy).toHaveBeenCalled();
expect(logSpy).toHaveBeenCalledWith('matching 1.12.14...');
expect(extractTarSpy).toHaveBeenCalled();
expect(logSpy).toHaveBeenCalledWith(
'Not found in manifest. Falling back to download directly from Go'
);
expect(logSpy).toHaveBeenCalledWith(`Install from dist`);
expect(logSpy).toHaveBeenCalledWith(`Added go to the path`);
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
});
it('reports a failed download', async () => {
const errMsg = 'unhandled download message';
os.platform = 'linux';
os.arch = 'x64';
inputs['go-version'] = '1.13.1';
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(() => {
throw new Error(errMsg);
});
await main.run();
expect(cnSpy).toHaveBeenCalledWith(
`::error::Failed to download version 1.13.1: Error: ${errMsg}${osm.EOL}`
);
});
it('does not add BIN if go is not in path', async () => {
whichSpy.mockImplementation(async () => {
return '';
});
const added = await main.addBinToPath();
expect(added).toBeFalsy();
});
it('adds bin if dir not exists', async () => {
whichSpy.mockImplementation(async () => {
return '/usr/local/go/bin/go';
});
execSpy.mockImplementation(() => {
return '/Users/testuser/go';
});
mkdirpSpy.mockImplementation(async () => {});
existsSpy.mockImplementation(() => {
return false;
});
const added = await main.addBinToPath();
expect(added).toBeTruthy();
});
interface Annotation {
file: string;
line: number;
column: number;
message: string;
}
//
// problem matcher regex pattern tests
function testMatch(line: string): Annotation {
const annotation = <Annotation>{};
const match = matcherRegExp.exec(line);
if (match) {
annotation.line = parseInt(match[matcherPattern.line], 10);
annotation.column = parseInt(match[matcherPattern.column], 10);
annotation.file = match[matcherPattern.file].trim();
annotation.message = match[matcherPattern.message].trim();
}
return annotation;
}
it('matches on relative unix path', async () => {
const line = './main.go:13:2: undefined: fmt.Printl';
const annotation = testMatch(line);
expect(annotation).toBeDefined();
expect(annotation.line).toBe(13);
expect(annotation.column).toBe(2);
expect(annotation.file).toBe('./main.go');
expect(annotation.message).toBe('undefined: fmt.Printl');
});
it('matches on unix path up the tree', async () => {
const line = '../main.go:13:2: undefined: fmt.Printl';
const annotation = testMatch(line);
expect(annotation).toBeDefined();
expect(annotation.line).toBe(13);
expect(annotation.column).toBe(2);
expect(annotation.file).toBe('../main.go');
expect(annotation.message).toBe('undefined: fmt.Printl');
});
it('matches on unix path down the tree', async () => {
const line = 'foo/main.go:13:2: undefined: fmt.Printl';
const annotation = testMatch(line);
expect(annotation).toBeDefined();
expect(annotation.line).toBe(13);
expect(annotation.column).toBe(2);
expect(annotation.file).toBe('foo/main.go');
expect(annotation.message).toBe('undefined: fmt.Printl');
});
it('matches on rooted unix path', async () => {
const line = '/assert.go:4:1: missing return at end of function';
const annotation = testMatch(line);
expect(annotation).toBeDefined();
expect(annotation.line).toBe(4);
expect(annotation.column).toBe(1);
expect(annotation.file).toBe('/assert.go');
expect(annotation.message).toBe('missing return at end of function');
});
it('matches on unix path with spaces', async () => {
const line = ' ./assert.go:5:2: missing return at end of function ';
const annotation = testMatch(line);
expect(annotation).toBeDefined();
expect(annotation.line).toBe(5);
expect(annotation.column).toBe(2);
expect(annotation.file).toBe('./assert.go');
expect(annotation.message).toBe('missing return at end of function');
});
it('matches on unix path with tabs', async () => {
const line = '\t./assert.go:5:2: missing return at end of function ';
const annotation = testMatch(line);
expect(annotation).toBeDefined();
expect(annotation.line).toBe(5);
expect(annotation.column).toBe(2);
expect(annotation.file).toBe('./assert.go');
expect(annotation.message).toBe('missing return at end of function');
});
it('matches on relative windows path', async () => {
const line = '.\\main.go:13:2: undefined: fmt.Printl';
const annotation = testMatch(line);
expect(annotation).toBeDefined();
expect(annotation.line).toBe(13);
expect(annotation.column).toBe(2);
expect(annotation.file).toBe('.\\main.go');
expect(annotation.message).toBe('undefined: fmt.Printl');
});
it('matches on windows path up the tree', async () => {
const line = '..\\main.go:13:2: undefined: fmt.Printl';
const annotation = testMatch(line);
expect(annotation).toBeDefined();
expect(annotation.line).toBe(13);
expect(annotation.column).toBe(2);
expect(annotation.file).toBe('..\\main.go');
expect(annotation.message).toBe('undefined: fmt.Printl');
});
// 1.13.1 => 1.13.1
// 1.13 => 1.13.0
// 1.10beta1 => 1.10.0-beta.1, 1.10rc1 => 1.10.0-rc.1
// 1.8.5beta1 => 1.8.5-beta.1, 1.8.5rc1 => 1.8.5-rc.1
it('converts prerelease versions', async () => {
expect(im.makeSemver('1.10beta1')).toBe('1.10.0-beta.1');
expect(im.makeSemver('1.10rc1')).toBe('1.10.0-rc.1');
});
it('converts dot zero versions', async () => {
expect(im.makeSemver('1.13')).toBe('1.13.0');
});
it('does not convert exact versions', async () => {
expect(im.makeSemver('1.13.1')).toBe('1.13.1');
});
describe('check-latest flag', () => {
it("use local version and don't check manifest if check-latest is not specified", async () => {
os.platform = 'linux';
os.arch = 'x64';
inputs['go-version'] = '1.16';
inputs['check-latest'] = false;
const toolPath = path.normalize('/cache/go/1.16.1/x64');
findSpy.mockReturnValue(toolPath);
await main.run();
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
expect(logSpy).not.toHaveBeenCalledWith(
'Attempting to resolve the latest version from the manifest...'
);
});
it('check latest version and resolve it from local cache', async () => {
os.platform = 'linux';
os.arch = 'x64';
inputs['go-version'] = '1.16';
inputs['check-latest'] = true;
const toolPath = path.normalize('/cache/go/1.16.1/x64');
findSpy.mockReturnValue(toolPath);
dlSpy.mockImplementation(async () => '/some/temp/path');
extractTarSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () => toolPath);
await main.run();
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.16');
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
});
it('check latest version and install it from manifest', async () => {
os.platform = 'linux';
os.arch = 'x64';
const versionSpec = '1.17';
const patchVersion = '1.17.6';
inputs['go-version'] = versionSpec;
inputs['stable'] = 'true';
inputs['check-latest'] = true;
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path');
const toolPath = path.normalize('/cache/go/1.17.6/x64');
extractTarSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () => toolPath);
await main.run();
expect(logSpy).toHaveBeenCalledWith(
`Setup go version spec ${versionSpec}`
);
expect(logSpy).toHaveBeenCalledWith(
'Attempting to resolve the latest version from the manifest...'
);
expect(logSpy).toHaveBeenCalledWith(`Resolved as '${patchVersion}'`);
expect(logSpy).toHaveBeenCalledWith(
`Attempting to download ${patchVersion}...`
);
expect(logSpy).toHaveBeenCalledWith('Extracting Go...');
expect(logSpy).toHaveBeenCalledWith('Adding to the cache ...');
expect(logSpy).toHaveBeenCalledWith('Added go to the path');
expect(logSpy).toHaveBeenCalledWith(
`Successfully set up Go version ${versionSpec}`
);
});
it('fallback to dist if version is not found in manifest', async () => {
os.platform = 'linux';
os.arch = 'x64';
const versionSpec = '1.13';
inputs['go-version'] = versionSpec;
inputs['check-latest'] = true;
inputs['always-auth'] = false;
inputs['token'] = 'faketoken';
// ... but not in the local cache
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path');
const toolPath = path.normalize('/cache/go/1.13.7/x64');
extractTarSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () => toolPath);
await main.run();
const expPath = path.join(toolPath, 'bin');
expect(dlSpy).toHaveBeenCalled();
expect(extractTarSpy).toHaveBeenCalled();
expect(logSpy).toHaveBeenCalledWith(
'Attempting to resolve the latest version from the manifest...'
);
expect(logSpy).toHaveBeenCalledWith(
`Failed to resolve version ${versionSpec} from manifest`
);
expect(logSpy).toHaveBeenCalledWith(
`Attempting to download ${versionSpec}...`
);
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
});
it('fallback to dist if manifest is not available', async () => {
os.platform = 'linux';
os.arch = 'x64';
const versionSpec = '1.13';
process.env['GITHUB_PATH'] = '';
inputs['go-version'] = versionSpec;
inputs['check-latest'] = true;
inputs['always-auth'] = false;
inputs['token'] = 'faketoken';
// ... but not in the local cache
findSpy.mockImplementation(() => '');
getManifestSpy.mockImplementation(() => {
throw new Error('Unable to download manifest');
});
getAllVersionsSpy.mockImplementationOnce(() => undefined);
dlSpy.mockImplementation(async () => '/some/temp/path');
const toolPath = path.normalize('/cache/go/1.13.7/x64');
extractTarSpy.mockImplementation(async () => '/some/other/temp/path');
cacheSpy.mockImplementation(async () => toolPath);
await main.run();
const expPath = path.join(toolPath, 'bin');
expect(logSpy).toHaveBeenCalledWith(
`Failed to resolve version ${versionSpec} from manifest`
);
expect(dlSpy).toHaveBeenCalled();
expect(extractTarSpy).toHaveBeenCalled();
expect(logSpy).toHaveBeenCalledWith(
'Attempting to resolve the latest version from the manifest...'
);
expect(logSpy).toHaveBeenCalledWith(
'Unable to resolve a version from the manifest...'
);
expect(logSpy).toHaveBeenCalledWith(
`Failed to resolve version ${versionSpec} from manifest`
);
expect(logSpy).toHaveBeenCalledWith(
`Attempting to download ${versionSpec}...`
);
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
});
});
describe('go-version-file', () => {
const goModContents = `module example.com/mymodule
go 1.14
require (
example.com/othermodule v1.2.3
example.com/thismodule v1.2.3
example.com/thatmodule v1.2.3
)
replace example.com/thatmodule => ../thatmodule
exclude example.com/thismodule v1.3.0
`;
const goWorkContents = `go 1.19
use .
`;
it('reads version from go.mod', async () => {
inputs['go-version-file'] = 'go.mod';
existsSpy.mockImplementation(() => true);
readFileSpy.mockImplementation(() => Buffer.from(goModContents));
await main.run();
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.14');
expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.14...');
expect(logSpy).toHaveBeenCalledWith('matching 1.14...');
});
it('reads version from go.work', async () => {
inputs['go-version-file'] = 'go.work';
existsSpy.mockImplementation(() => true);
readFileSpy.mockImplementation(() => Buffer.from(goWorkContents));
await main.run();
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.19');
expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.19...');
expect(logSpy).toHaveBeenCalledWith('matching 1.19...');
});
it('reads version from .go-version', async () => {
inputs['go-version-file'] = '.go-version';
existsSpy.mockImplementation(() => true);
readFileSpy.mockImplementation(() => Buffer.from(`1.13.0${osm.EOL}`));
await main.run();
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.13.0');
expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.13.0...');
expect(logSpy).toHaveBeenCalledWith('matching 1.13.0...');
});
it('is overwritten by go-version', async () => {
inputs['go-version'] = '1.13.1';
inputs['go-version-file'] = 'go.mod';
existsSpy.mockImplementation(() => true);
readFileSpy.mockImplementation(() => Buffer.from(goModContents));
await main.run();
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.13.1');
expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.13.1...');
expect(logSpy).toHaveBeenCalledWith('matching 1.13.1...');
});
it('reports a read failure', async () => {
inputs['go-version-file'] = 'go.mod';
existsSpy.mockImplementation(() => false);
await main.run();
expect(cnSpy).toHaveBeenCalledWith(
`::error::The specified go version file at: go.mod does not exist${osm.EOL}`
);
});
it('acquires specified architecture of go', async () => {
for (const {arch, version, osSpec} of [
{arch: 'amd64', version: '1.13.7', osSpec: 'linux'},
{arch: 'armv6l', version: '1.12.2', osSpec: 'linux'}
]) {
os.platform = osSpec;
os.arch = arch;
const fileExtension = os.platform === 'win32' ? 'zip' : 'tar.gz';
const platform = os.platform === 'win32' ? 'win' : os.platform;
inputs['go-version'] = version;
inputs['architecture'] = arch;
const expectedUrl =
platform === 'win32'
? `https://github.com/actions/go-versions/releases/download/${version}/go-${version}-${platform}-${arch}.${fileExtension}`
: `https://storage.googleapis.com/golang/go${version}.${osSpec}-${arch}.${fileExtension}`;
// ... but not in the local cache
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path');
const toolPath = path.normalize(`/cache/go/${version}/${arch}`);
cacheSpy.mockImplementation(async () => toolPath);
await main.run();
expect(logSpy).toHaveBeenCalledWith(
`Acquiring go${version} from ${expectedUrl}`
);
}
}, 100000);
it.each(['stable', 'oldstable'])(
'acquires latest go version with %s go-version input',
async (alias: string) => {
const arch = 'x64';
os.platform = 'darwin';
os.arch = arch;
inputs['go-version'] = alias;
inputs['architecture'] = os.arch;
// ... but not in the local cache
findSpy.mockImplementation(() => '');
dlSpy.mockImplementation(async () => '/some/temp/path');
const toolPath = path.normalize(`/cache/go/${alias}/${arch}`);
cacheSpy.mockImplementation(async () => toolPath);
await main.run();
const releaseIndex = alias === 'stable' ? 0 : 1;
expect(logSpy).toHaveBeenCalledWith(
`${alias} version resolved as ${goTestManifest[releaseIndex].version}`
);
}
);
});
});

14
__tests__/verify-go.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
if [ -z "$1" ]; then
echo "Must supply go version argument"
exit 1
fi
go_version="$(go version)"
echo "Found go version '$go_version'"
if [ -z "$(echo $go_version | grep $1)" ]; then
echo "Unexpected version"
exit 1
fi

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

@ -1,14 +1,31 @@
name: 'Setup Go environment'
description: 'Setup a Go environment and add it to the PATH, additionally providing proxy support'
description: 'Setup a Go environment and add it to the PATH'
author: 'GitHub'
inputs:
go-version:
description: 'The Go version to download (if necessary) and use. Example: 1.9.3'
default: '1.10'
# Deprecated option, do not use. Will not be supported after October 1, 2019
version:
description: 'Deprecated. Use go-version instead. Will not be supported after October 1, 2019'
deprecationMessage: 'The version property will not be supported after October 1, 2019. Use go-version instead'
description: 'The Go version to download (if necessary) and use. Supports semver spec and ranges. Be sure to enclose this option in single quotation marks.'
go-version-file:
description: 'Path to the go.mod or go.work file.'
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'
default: false
token:
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 || '' }}
cache:
description: Used to specify whether caching is needed. Set to true, if you'd like to enable caching.
default: true
cache-dependency-path:
description: 'Used to specify the path to a dependency file - go.sum'
architecture:
description: 'Target architecture for Go to use. Examples: x86, x64. Will use system architecture by default.'
outputs:
go-version:
description: 'The installed Go version. Useful when given a version range as input.'
cache-hit:
description: 'A boolean value to indicate if a cache was hit'
runs:
using: 'node12'
main: 'lib/setup-go.js'
using: 'node20'
main: 'dist/setup/index.js'
post: 'dist/cache-save/index.js'
post-if: success()

82956
dist/cache-save/index.js vendored Normal file

File diff suppressed because one or more lines are too long

90580
dist/setup/index.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,69 @@
# 0. Caching dependencies
Date: 2022-04-13
Status: Accepted
# Context
`actions/setup-go` is the one of the most popular action related to Golang in GitHub Actions. Many customers use it in conjunction with [actions/cache](https://github.com/actions/cache) to speed up dependency installation process.
See more examples on proper usage in [actions/cache documentation](https://github.com/actions/cache/blob/main/examples.md#go---modules).
# Goals & Anti-Goals
Integration of caching functionality into `actions/setup-go` action will bring the following benefits for action users:
- Decrease the entry threshold for using the cache for Go dependencies and simplify initial configuration
- Simplify YAML pipelines because there will be no need for additional steps to enable caching
- More users will use cache for Go so more customers will have fast builds!
We don't pursue the goal to provide wide customization of caching in scope of `actions/setup-go` action. The purpose of this integration is covering ~90% of basic use-cases. If user needs flexible customization, we should advice them to use `actions/cache` directly.
# Decision
- Add `cache` input parameter to `actions/setup-go`. For now, input will accept the following values:
- `true` - enable caching for go dependencies
- `false`- disable caching for go dependencies. This value will be set as default value
- Cache feature will be disabled by default to make sure that we don't break existing customers. We will consider enabling cache by default in next major releases
- Action will try to search a go.sum files in the repository and throw error in the scenario that it was not found
- The hash of found file will be used as cache key (the same approach like [actions/cache](https://github.com/actions/cache/blob/main/examples.md#go---modules) recommends)
- The following key cache will be used `${{ runner.os }}-go${{ go-version }}-${{ hashFiles('<go.sum-path>') }}`
- Action will cache global cache from the `go env GOMODCACHE` and `go env GOCACHE` commands.
- Add a `cache-dependency-path` input parameter to `actions/setup-go`. The new input will accept an array or regex of dependency files. The field will accept a path (relative to the repository root) to dependency files. If the provided path contains wildcards, the action will search all matching files and calculate a common hash like the ${{ hashFiles('**/go.sum') }} YAML construction does.
# Example of real use-cases
- With cache
```yml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version: '18'
cache: true
```
- With cache-dependency-path
```yml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version: '18'
cache: true
cache-dependency-path: **/go.sum
```
```yml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version: '18'
cache: true
cache-dependency-path: |
**/go.sum
**/go.mod
```
# Release process
As soon as functionality is implemented, we will release minor update of action. No need to bump major version since there are no breaking changes for existing users.
After that, we will update [starter-workflows](https://github.com/actions/starter-workflows/blob/main/ci/go.yml)

View File

@ -1,17 +1,116 @@
# Contributors
Thank you for contributing!
# Checkin
We have prepared a short guide so that the process of making your contribution is as simple and clear as possible. Please check it out before you contribute!
- Do checkin source (src)
- Do checkin build output (lib)
- Do checkin runtime node_modules
- Do not checkin
## How can I contribute...
# Adding a dev dependency
* [Contribute Documentation :green_book:](#contribute-documentation)
Remember to update .gitignore.
* [Contribute Code :computer:](#contribute-code)
# Updating toolkit dependency
* [Provide Support on Issues :pencil:](#provide-support-on-issues)
Until released publically, update tgz packages in toolkit
* [Review Pull Requests :mag:](#review-pull-requests)
## Contribute documentation
Documentation is a super important, critical part of this project. Docs are how we keep track of what we're doing, how, and why. It's how we stay on the same page about our policies and how we tell others everything they need to be able to use this project or contribute to it.
Documentation contributions of any size are welcome! Feel free to contribute even if you're just rewording a sentence to be more clear, or fixing a spelling mistake!
**How to contribute:**
Pull requests are the easiest way to contribute changes to git repos at GitHub. They are the preferred contribution method, as they offer a nice way of commenting and amending the proposed 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
- Make sure your changes are formatted correctly and consistently with the rest of the documentation
- Re-read what you wrote, and run a spellchecker on it to make sure you didn't miss anything
- 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
**Once you've filed the pull request:**
- Maintainers will review your pull request
- If a maintainer requests changes, first of all, try to think about this request critically and only after that implement and request another review
- If your PR gets accepted, it will soon be merged into the main branch. But your contribution will take effect only after the release of a new version of the action
> Sometimes maintainers reject pull requests and that's ok! Usually, along with rejection, we supply the reason for it. Nonetheless, we still really appreciate you taking the time to do it, and we don't take that lightly :heart:
## Contribute code
We like code commits a lot! They're super handy, and they keep the project going and doing the work it needs to do to be useful to others.
Code contributions of just about any size are acceptable!
The main difference between code contributions and documentation contributions is that contributing code requires the inclusion of relevant tests for the code being added or changed. Contributions without accompanying tests will be held off until a test is added unless the maintainers consider the specific tests to be either impossible or way too much of a burden for such a contribution.
**How to contribute:**
Pull requests are the easiest way to contribute changes to git repos at GitHub. They are the preferred contribution method, as they offer a nice way of commenting and amending the proposed 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
- **Run `pre-checkin` script to format, lint, build and test changes**
- 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 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
**Learn more about how to work with the repository:**
- 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 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
- You can also start formatting, building code, and testing with a single `pre-checkin` command
**Learn more about how to implement tests:**
Adding or changing tests is an integral part of making a change to the code.
Unit tests are in the `__tests__` folder, and end-to-end tests are in the `workflows` folder (in particular, in the file [versions.yml](https://github.com/actions/setup-go/blob/main/.github/workflows/versions.yml)).
- The contributor can add various types of tests (like unit tests or end-to-end tests), which, in his opinion, will be necessary and sufficient for testing new or changed functionality
- Tests should cover a successful execution, as well as some edge cases and possible errors
- As already mentioned, pull requests without tests will be considered more carefully by maintainers. If you are sure that in this situation the tests are not needed or cannot be implemented with a commensurate effort - please add this clarification message to your pull request
**Once you've filed the pull request:**
- CI will start automatically with some checks. Wait until the end of the execution and make sure that all checks passed successfully. If some checks fail, you can open them one by one, try to find the reason for failing and make changes to your code to resolve the problem
- Maintainers will review your pull request
- If a maintainer requests changes, first of all, try to think about his request critically and only after that implement and request another review
- If your PR gets accepted, it will soon be merged into the main branch. But your contribution will take effect only after the release of a new version of the action
> Sometimes maintainers reject pull requests and that's ok! Usually, along with rejection, we supply the reason for it. Nonetheless, we still really appreciate you taking the time to do it, and we don't take that lightly :heart:
## Provide support on issues
Helping out other users with their questions is an awesome way of contributing to any community. It's not uncommon for most of the issues on open source projects to be support-related questions by users trying to understand something they ran into or find their way around a known bug.
**To help other folks out with their questions:**
- Go to the [issue tracker](https://github.com/actions/setup-go/issues)
- Read through the list until you find something that you're familiar enough with to answer to
- Respond to the issue with whatever details are needed to clarify the question, or get more details about what's going on
- Once the discussion wraps up and things are clarified, ask the original issue filer (or a maintainer) to close it for you
*Some notes on picking up support issues:*
- Avoid responding to issues you don't know you can answer accurately
- Try to refer to past issues with accepted answers as much as possible. Link to them from your replies
- Be kind and patient with users. Often, folks who have run into confusing things might be upset or impatient. This is natural. If you feel uncomfortable in conversation with them, it's better to stay away or withdraw from the issue.
> If some user is violating our code of conduct [standards](https://github.com/actions/setup-go/blob/main/CODE_OF_CONDUCT.md#our-standards), refer to the [Enforcement](https://github.com/actions/setup-go/blob/main/CODE_OF_CONDUCT.md#enforcement) section of the Code of Conduct to resolve the conflict
## Review pull requests
Another great way to contribute is pull request reviews. Please, be extra kind: people who submit code/doc contributions are putting themselves in a pretty vulnerable position, and have put time and care into what they've done (even if that's not obvious to you!) Please, always respond with respect, and be understanding, but don't feel like you need to sacrifice your standards for their sake, either.
**How to review:**
- Go to the [pull requests](https://github.com/actions/setup-go/pulls)
- Make sure you're familiar with the code or documentation is updated, unless it's a minor change (spellchecking, minor formatting, etc.)
- Review changes using the GitHub functionality. You can ask a clarifying question, point out an error or suggest an alternative.
> Note: You may ask for minor changes - "nitpicks", but consider whether they are real blockers to merging or not
- Submit your review, which may include comments, an approval, or a changes request

View File

@ -1,211 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
// Load tempDirectory before it gets wiped by tool-cache
let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || '';
const core = __importStar(require("@actions/core"));
const tc = __importStar(require("@actions/tool-cache"));
const os = __importStar(require("os"));
const path = __importStar(require("path"));
const util = __importStar(require("util"));
const semver = __importStar(require("semver"));
const restm = __importStar(require("typed-rest-client/RestClient"));
let osPlat = os.platform();
let osArch = os.arch();
if (!tempDirectory) {
let baseLocation;
if (process.platform === 'win32') {
// On windows use the USERPROFILE env variable
baseLocation = process.env['USERPROFILE'] || 'C:\\';
}
else {
if (process.platform === 'darwin') {
baseLocation = '/Users';
}
else {
baseLocation = '/home';
}
}
tempDirectory = path.join(baseLocation, 'actions', 'temp');
}
function getGo(version) {
return __awaiter(this, void 0, void 0, function* () {
const selected = yield determineVersion(version);
if (selected) {
version = selected;
}
// check cache
let toolPath;
toolPath = tc.find('go', normalizeVersion(version));
if (!toolPath) {
// download, extract, cache
toolPath = yield acquireGo(version);
core.debug('Go tool is cached under ' + toolPath);
}
setGoEnvironmentVariables(toolPath);
toolPath = path.join(toolPath, 'bin');
//
// prepend the tools path. instructs the agent to prepend for future tasks
//
core.addPath(toolPath);
});
}
exports.getGo = getGo;
function acquireGo(version) {
return __awaiter(this, void 0, void 0, function* () {
//
// Download - a tool installer intimately knows how to get the tool (and construct urls)
//
let fileName = getFileName(version);
let downloadUrl = getDownloadUrl(fileName);
core.debug('Downloading Go from: ' + downloadUrl);
let downloadPath = null;
try {
downloadPath = yield tc.downloadTool(downloadUrl);
}
catch (error) {
core.debug(error);
throw `Failed to download version ${version}: ${error}`;
}
//
// Extract
//
let extPath = tempDirectory;
if (!extPath) {
throw new Error('Temp directory not set');
}
if (osPlat == 'win32') {
extPath = yield tc.extractZip(downloadPath);
}
else {
extPath = yield tc.extractTar(downloadPath);
}
//
// Install into the local tool cache - node extracts with a root folder that matches the fileName downloaded
//
const toolRoot = path.join(extPath, 'go');
version = normalizeVersion(version);
return yield tc.cacheDir(toolRoot, 'go', version);
});
}
function getFileName(version) {
const arches = {
x64: 'amd64',
arm: 'armv6l',
arm64: 'arm64',
default: '386'
};
const platform = osPlat == 'win32' ? 'windows' : osPlat;
const arch = arches[osArch] || arches['default'];
const ext = osPlat == 'win32' ? 'zip' : 'tar.gz';
const filename = util.format('go%s.%s-%s.%s', version, platform, arch, ext);
return filename;
}
function getDownloadUrl(filename) {
return util.format('https://storage.googleapis.com/golang/%s', filename);
}
function setGoEnvironmentVariables(goRoot) {
core.exportVariable('GOROOT', goRoot);
const goPath = process.env['GOPATH'] || '';
const goBin = process.env['GOBIN'] || '';
// set GOPATH and GOBIN as user value
if (goPath) {
core.exportVariable('GOPATH', goPath);
}
if (goBin) {
core.exportVariable('GOBIN', goBin);
}
}
// This function is required to convert the version 1.10 to 1.10.0.
// Because caching utility accept only sementic version,
// which have patch number as well.
function normalizeVersion(version) {
const versionPart = version.split('.');
if (versionPart[1] == null) {
//append minor and patch version if not available
return version.concat('.0.0');
}
else {
// handle beta and rc: 1.10beta1 => 1.10.0-beta1, 1.10rc1 => 1.10.0-rc1
if (versionPart[1].includes('beta') || versionPart[1].includes('rc')) {
versionPart[1] = versionPart[1]
.replace('beta', '.0-beta')
.replace('rc', '.0-rc');
return versionPart.join('.');
}
}
if (versionPart[2] == null) {
//append patch version if not available
return version.concat('.0');
}
else {
// handle beta and rc: 1.8.5beta1 => 1.8.5-beta1, 1.8.5rc1 => 1.8.5-rc1
if (versionPart[2].includes('beta') || versionPart[2].includes('rc')) {
versionPart[2] = versionPart[2]
.replace('beta', '-beta')
.replace('rc', '-rc');
return versionPart.join('.');
}
}
return version;
}
function determineVersion(version) {
return __awaiter(this, void 0, void 0, function* () {
if (!version.endsWith('.x')) {
const versionPart = version.split('.');
if (versionPart[1] == null || versionPart[2] == null) {
return yield getLatestVersion(version.concat('.x'));
}
else {
return version;
}
}
return yield getLatestVersion(version);
});
}
function getLatestVersion(version) {
return __awaiter(this, void 0, void 0, function* () {
// clean .x syntax: 1.10.x -> 1.10
const trimmedVersion = version.slice(0, version.length - 2);
const versions = yield getPossibleVersions(trimmedVersion);
core.debug(`evaluating ${versions.length} versions`);
if (version.length === 0) {
throw new Error('unable to get latest version');
}
core.debug(`matched: ${versions[0]}`);
return versions[0];
});
}
function getAvailableVersions() {
return __awaiter(this, void 0, void 0, function* () {
let rest = new restm.RestClient('setup-go');
let tags = (yield rest.get('https://golang.org/dl/?mode=json&include=all'))
.result || [];
return tags.map(tag => tag.version.replace('go', ''));
});
}
function getPossibleVersions(version) {
return __awaiter(this, void 0, void 0, function* () {
const versions = yield getAvailableVersions();
const possibleVersions = versions.filter(v => v.startsWith(version));
const versionMap = new Map();
possibleVersions.forEach(v => versionMap.set(normalizeVersion(v), v));
return Array.from(versionMap.keys())
.sort(semver.rcompare)
.map(v => versionMap.get(v));
});
}

View File

@ -1,44 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const installer = __importStar(require("./installer"));
const path = __importStar(require("path"));
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
//
// Version is optional. If supplied, install / use from the tool cache
// If not supplied then task is still used to setup proxy, auth, etc...
//
let version = core.getInput('version');
if (!version) {
version = core.getInput('go-version');
}
if (version) {
yield installer.getGo(version);
}
// TODO: setup proxy from runner proxy config
const matchersPath = path.join(__dirname, '..', '.github');
console.log(`##[add-matcher]${path.join(matchersPath, 'go.json')}`);
}
catch (error) {
core.setFailed(error.message);
}
});
}
run();

16
matchers.json Normal file
View File

@ -0,0 +1,16 @@
{
"problemMatcher": [
{
"owner": "go",
"pattern": [
{
"regexp": "^\\s*(.+\\.go):(?:(\\d+):(\\d+):)? (.*)",
"file": 1,
"line": 2,
"column": 3,
"message": 4
}
]
}
]
}

View File

@ -1,9 +0,0 @@
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Some files were not shown because too many files have changed in this diff Show More