Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: actions/setup-go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2
Choose a base ref
...
head repository: actions/setup-go
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.3.1
Choose a head ref

Commits on Feb 16, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5b0ae0e View commit details

Commits on Feb 22, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fb9a043 View commit details

Commits on Feb 24, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    edcbc0c View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2bb2aab View commit details

Commits on Feb 28, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f6164bd View commit details

Commits on Mar 9, 2022

  1. Add test for export of GOROOT to env var

    Signed-off-by: Manuel Mendez <mmendez534@gmail.com>
    mmlb committed Mar 9, 2022
    Copy the full SHA
    ec07be5 View commit details

Commits on Mar 10, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    24c791c View commit details
  2. Merge pull request #204 from actions/joshmgross/service-codeowners

    Update CODEOWNERS to actions-service
    brcrista authored Mar 10, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9a16260 View commit details

Commits on Mar 11, 2022

  1. 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>
    mmlb committed Mar 11, 2022
    Copy the full SHA
    83124a1 View commit details

Commits on Mar 14, 2022

  1. Verified

    This commit was signed with the committer’s verified signature.
    joshmgross Josh Gross
    Copy the full SHA
    2a34c33 View commit details
  2. Fix formatting

    joshmgross committed Mar 14, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    joshmgross Josh Gross
    Copy the full SHA
    802876f View commit details
  3. Update dist

    joshmgross committed Mar 14, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    joshmgross Josh Gross
    Copy the full SHA
    229eefa View commit details
  4. Remove duplicated spyOn

    joshmgross committed Mar 14, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    joshmgross Josh Gross
    Copy the full SHA
    0c03929 View commit details

Commits on Mar 17, 2022

  1. Merge pull request #175 from mmlb/do-not-export-GOROOT

    Do not export GOROOT for Go versions >= 1.9
    brcrista authored Mar 17, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7572680 View commit details

Commits on Mar 24, 2022

  1. 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>
    dependabot[bot] authored Mar 24, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fcc0174 View commit details
  2. Merge pull request #208 from actions/dependabot/npm_and_yarn/minimist…

    …-1.2.6
    
    Bump minimist from 1.2.5 to 1.2.6
    brcrista authored Mar 24, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6577160 View commit details

Commits on Mar 25, 2022

  1. Update README to v3

    Vladimir Safonkin committed Mar 25, 2022
    Copy the full SHA
    3e6475c View commit details

Commits on Mar 28, 2022

  1. Remove stable input description from README

    Vladimir Safonkin committed Mar 28, 2022
    Copy the full SHA
    acdbc53 View commit details
  2. await io.mkdirP

    Frassle committed Mar 28, 2022
    Copy the full SHA
    0b4fbc5 View commit details
  3. Merge pull request #210 from vsafonkin/v-vsafonkin/update-readme-v3

    Update README to v3
    brcrista authored Mar 28, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8e9a229 View commit details
  4. Update dist

    Frassle committed Mar 28, 2022
    Copy the full SHA
    13df686 View commit details
  5. Merge pull request #211 from Frassle/awaitmkdirp

    await io.mkdirP
    brcrista authored Mar 28, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a5865a9 View commit details

Commits on Mar 29, 2022

  1. Update usage examples on readme (#212)

    * Fix action usage examples on readme
    
    * Revert changes on package-lock
    
    * Fix some checkout action version
    Vladimir Safonkin authored Mar 29, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    341b20a View commit details

Commits on Mar 31, 2022

  1. 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`
    magnetikonline authored Mar 31, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    dcb4ec9 View commit details

Commits on Apr 1, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    bf7ccf1 View commit details

Commits on Apr 7, 2022

  1. Set LF for all files (#214)

    * Set LF for all files
    
    * Set gitattr text=auto
    Vladimir Safonkin authored Apr 7, 2022
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    115d6e6 View commit details

Commits on Apr 8, 2022

  1. 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>
    3 people authored Apr 8, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4a4352b View commit details

Commits on Apr 17, 2022

  1. Fix condition for old go versions

    Vladimir Safonkin committed Apr 17, 2022
    Copy the full SHA
    ad70bef View commit details

Commits on Apr 18, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0794822 View commit details

Commits on Apr 19, 2022

  1. Merge pull request #221 from vsafonkin/v-vsafonkin/fix-gopath-condition

    Fix condition for GOPATH output
    Vladimir Safonkin authored Apr 19, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    46eabca View commit details

Commits on Apr 20, 2022

  1. Add note about go building

    Vladimir Safonkin committed Apr 20, 2022
    Copy the full SHA
    3332358 View commit details
  2. Merge pull request #222 from vsafonkin/v-vsafonkin/add-readme-note

    Add note about golang building process
    Vladimir Safonkin authored Apr 20, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b46db95 View commit details

Commits on Apr 26, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    56a61c9 View commit details

Commits on May 3, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    193b404 View commit details

Commits on May 12, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    265edc1 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fcdc436 View commit details

Commits on May 25, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b22fbbc View commit details

Commits on Jun 14, 2022

  1. Add cache error handling

    Vladimir Safonkin committed Jun 14, 2022
    Copy the full SHA
    6036aa2 View commit details

Commits on Jun 28, 2022

  1. Rework cache handling

    Vladimir Safonkin committed Jun 28, 2022
    Copy the full SHA
    0fd9200 View commit details
  2. Build js

    Vladimir Safonkin committed Jun 28, 2022
    Copy the full SHA
    ed8da5d View commit details
  3. Update license

    Vladimir Safonkin committed Jun 28, 2022
    Copy the full SHA
    e52a7c5 View commit details
  4. Fix license

    Vladimir Safonkin committed Jun 28, 2022
    Copy the full SHA
    5ea2b37 View commit details
  5. Fix license

    Vladimir Safonkin committed Jun 28, 2022
    Copy the full SHA
    df0583a View commit details
  6. Fix license

    Vladimir Safonkin committed Jun 28, 2022
    Copy the full SHA
    97919d3 View commit details
  7. Fix license

    Vladimir Safonkin committed Jun 28, 2022
    Copy the full SHA
    bb9cf42 View commit details
  8. Fix license

    Vladimir Safonkin committed Jun 28, 2022
    Copy the full SHA
    75be648 View commit details

Commits on Jul 1, 2022

  1. Minor fix

    Vladimir Safonkin committed Jul 1, 2022
    Copy the full SHA
    9eecd2d View commit details
  2. Build dist

    Vladimir Safonkin committed Jul 1, 2022
    Copy the full SHA
    dd64cc9 View commit details
  3. 1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    84cbf80 View commit details

Commits on Jul 14, 2022

  1. Copy the full SHA
    049de84 View commit details
Showing with 134,013 additions and 7,642 deletions.
  1. +1 −0 .gitattributes
  2. +5 −5 .github/workflows/check-dist.yml
  3. +6 −2 .github/workflows/licensed.yml
  4. +41 −8 .github/workflows/versions.yml
  5. +4 −4 .github/workflows/workflow.yml
  6. +1 −0 .licensed.yml
  7. +20 −0 .licenses/npm/@actions/cache.dep.yml
  8. +1 −1 .licenses/npm/@actions/core.dep.yml
  9. +10 −20 .licenses/npm/@actions/exec.dep.yml
  10. +20 −0 .licenses/npm/@actions/glob-0.1.2.dep.yml
  11. +20 −0 .licenses/npm/@actions/glob-0.2.1.dep.yml
  12. +2 −2 .licenses/npm/@actions/{http-client-1.0.8.dep.yml → http-client-2.0.1.dep.yml}
  13. +10 −20 .licenses/npm/@actions/io.dep.yml
  14. +10 −20 .licenses/npm/@actions/tool-cache.dep.yml
  15. +32 −0 .licenses/npm/@azure/abort-controller.dep.yml
  16. +32 −0 .licenses/npm/@azure/core-asynciterator-polyfill.dep.yml
  17. +33 −0 .licenses/npm/@azure/core-auth.dep.yml
  18. +33 −0 .licenses/npm/@azure/core-http.dep.yml
  19. +33 −0 .licenses/npm/@azure/core-lro.dep.yml
  20. +32 −0 .licenses/npm/@azure/core-paging.dep.yml
  21. +32 −0 .licenses/npm/@azure/core-tracing.dep.yml
  22. +32 −0 .licenses/npm/@azure/logger.dep.yml
  23. +33 −0 .licenses/npm/@azure/ms-rest-js.dep.yml
  24. +32 −0 .licenses/npm/@azure/storage-blob.dep.yml
  25. +225 −0 .licenses/npm/@opentelemetry/api.dep.yml
  26. +32 −0 .licenses/npm/@types/node-fetch.dep.yml
  27. +32 −0 .licenses/npm/@types/node.dep.yml
  28. +32 −0 .licenses/npm/@types/tunnel.dep.yml
  29. +32 −0 .licenses/npm/abort-controller.dep.yml
  30. +34 −0 .licenses/npm/asynckit.dep.yml
  31. +55 −0 .licenses/npm/balanced-match.dep.yml
  32. +55 −0 .licenses/npm/brace-expansion.dep.yml
  33. +32 −0 .licenses/npm/combined-stream.dep.yml
  34. +31 −0 .licenses/npm/concat-map.dep.yml
  35. +32 −0 .licenses/npm/delayed-stream.dep.yml
  36. +33 −0 .licenses/npm/event-target-shim.dep.yml
  37. +38 −0 .licenses/npm/events.dep.yml
  38. +33 −0 .licenses/npm/form-data-2.5.1.dep.yml
  39. +33 −0 .licenses/npm/form-data-3.0.1.dep.yml
  40. +33 −0 .licenses/npm/form-data-4.0.0.dep.yml
  41. +34 −0 .licenses/npm/ip-regex.dep.yml
  42. +34 −0 .licenses/npm/mime-db.dep.yml
  43. +47 −0 .licenses/npm/mime-types.dep.yml
  44. +26 −0 .licenses/npm/minimatch.dep.yml
  45. +56 −0 .licenses/npm/node-fetch.dep.yml
  46. +33 −0 .licenses/npm/process.dep.yml
  47. +43 −0 .licenses/npm/psl.dep.yml
  48. +34 −0 .licenses/npm/punycode.dep.yml
  49. +52 −0 .licenses/npm/sax.dep.yml
  50. +23 −0 .licenses/npm/tough-cookie-3.0.1.dep.yml
  51. +23 −0 .licenses/npm/tough-cookie-4.0.0.dep.yml
  52. +30 −0 .licenses/npm/tr46.dep.yml
  53. +35 −0 .licenses/npm/tslib-1.14.1.dep.yml
  54. +35 −0 .licenses/npm/tslib-2.3.1.dep.yml
  55. +33 −0 .licenses/npm/universalify.dep.yml
  56. 0 .licenses/npm/{uuid.dep.yml → uuid-3.4.0.dep.yml}
  57. +20 −0 .licenses/npm/uuid-8.3.2.dep.yml
  58. +23 −0 .licenses/npm/webidl-conversions.dep.yml
  59. +32 −0 .licenses/npm/whatwg-url.dep.yml
  60. +30 −0 .licenses/npm/xml2js.dep.yml
  61. +32 −0 .licenses/npm/xmlbuilder.dep.yml
  62. +1 −1 CODEOWNERS
  63. +2 −2 CONDUCT → CODE_OF_CONDUCT.md
  64. +100 −32 README.md
  65. +99 −0 __tests__/cache-restore.test.ts
  66. +179 −0 __tests__/cache-utils.test.ts
  67. +12 −0 __tests__/data/go.mod
  68. +217 −44 __tests__/setup-go.test.ts
  69. +19 −6 action.yml
  70. +60,754 −0 dist/cache-save/index.js
  71. +0 −6,359 dist/index.js
  72. +63,918 −0 dist/setup/index.js
  73. +69 −0 docs/adrs/0000-caching-dependencies.md
  74. +107 −9 docs/contributors.md
  75. +6,238 −1,037 package-lock.json
  76. +9 −6 package.json
  77. +63 −0 src/cache-restore.ts
  78. +81 −0 src/cache-save.ts
  79. +75 −0 src/cache-utils.ts
  80. +8 −0 src/constants.ts
  81. +64 −42 src/installer.ts
  82. +66 −19 src/main.ts
  83. +15 −0 src/package-managers.ts
  84. +5 −3 src/system.ts
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* text=auto
.licenses/** -diff linguist-generated=true
10 changes: 5 additions & 5 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
@@ -21,12 +21,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set Node.js 12.x
uses: actions/setup-node@v2
- name: Set Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 12.x
node-version: 16.x

- name: Install dependencies
run: npm ci
@@ -44,7 +44,7 @@ jobs:
id: diff

# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
8 changes: 6 additions & 2 deletions .github/workflows/licensed.yml
Original file line number Diff line number Diff line change
@@ -13,12 +13,16 @@ jobs:
runs-on: ubuntu-latest
name: Check licenses
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- run: npm ci
- name: Install licensed
run: |
cd $RUNNER_TEMP
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.3.1/licensed-3.3.1-linux-x64.tar.gz
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.4.4/licensed-3.4.4-linux-x64.tar.gz
sudo tar -xzf licensed.tar.gz
sudo mv licensed /usr/local/bin/licensed
- run: licensed status
49 changes: 41 additions & 8 deletions .github/workflows/versions.yml
Original file line number Diff line number Diff line change
@@ -19,10 +19,10 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
go: [1.12, 1.13, 1.14]
go: [1.17, 1.18, 1.19]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: setup-go ${{ matrix.go }}
uses: ./
@@ -41,7 +41,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
go-version: [1.16, 1.17]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup Go and check latest
uses: ./
with:
@@ -50,6 +50,22 @@ jobs:
- 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@v3
- name: Setup Go and check latest
uses: ./
with:
go-version-file: __tests__/data/go.mod
- name: verify go
run: __tests__/verify-go.sh 1.14
shell: bash

setup-versions-from-manifest:
name: Setup ${{ matrix.go }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
@@ -60,13 +76,13 @@ jobs:
go: [1.12.16, 1.13.11, 1.14.3]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: setup-go ${{ matrix.go }}
uses: ./
with:
go-version: ${{ matrix.go }}

- name: verify go
run: __tests__/verify-go.sh ${{ matrix.go }}
shell: bash
@@ -78,10 +94,10 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
go: [1.7, 1.8.6]
go: [1.9, 1.8.6]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: setup-go ${{ matrix.go }}
uses: ./
@@ -91,3 +107,20 @@ jobs:
- 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.16, 1.17]
steps:
- uses: actions/checkout@v3
- name: Setup Go and check latest
uses: ./
with:
go-version: ${{ matrix.go-version }}
architecture: x64
- name: Verify Go
run: go version
8 changes: 4 additions & 4 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -17,12 +17,12 @@ jobs:
operating-system: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup node 12
uses: actions/setup-node@v2
- name: Setup node 16
uses: actions/setup-node@v3
with:
node-version: 12
node-version: 16
cache: npm

- name: npm ci
1 change: 1 addition & 0 deletions .licensed.yml
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ allowed:
- mit
- cc0-1.0
- unlicense
- 0bsd

reviewed:
npm:
20 changes: 20 additions & 0 deletions .licenses/npm/@actions/cache.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .licenses/npm/@actions/core.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 10 additions & 20 deletions .licenses/npm/@actions/exec.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .licenses/npm/@actions/glob-0.1.2.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .licenses/npm/@actions/glob-0.2.1.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 10 additions & 20 deletions .licenses/npm/@actions/io.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 10 additions & 20 deletions .licenses/npm/@actions/tool-cache.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/@azure/abort-controller.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/@azure/core-asynciterator-polyfill.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .licenses/npm/@azure/core-auth.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .licenses/npm/@azure/core-http.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .licenses/npm/@azure/core-lro.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/@azure/core-paging.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/@azure/core-tracing.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/@azure/logger.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .licenses/npm/@azure/ms-rest-js.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/@azure/storage-blob.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

225 changes: 225 additions & 0 deletions .licenses/npm/@opentelemetry/api.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/@types/node-fetch.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/@types/node.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/@types/tunnel.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/abort-controller.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions .licenses/npm/asynckit.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions .licenses/npm/balanced-match.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions .licenses/npm/brace-expansion.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/combined-stream.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions .licenses/npm/concat-map.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/delayed-stream.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .licenses/npm/event-target-shim.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions .licenses/npm/events.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .licenses/npm/form-data-2.5.1.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .licenses/npm/form-data-3.0.1.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .licenses/npm/form-data-4.0.0.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions .licenses/npm/ip-regex.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions .licenses/npm/mime-db.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions .licenses/npm/mime-types.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions .licenses/npm/minimatch.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions .licenses/npm/node-fetch.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .licenses/npm/process.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions .licenses/npm/psl.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions .licenses/npm/punycode.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions .licenses/npm/sax.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions .licenses/npm/tough-cookie-3.0.1.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions .licenses/npm/tough-cookie-4.0.0.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions .licenses/npm/tr46.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions .licenses/npm/tslib-1.14.1.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions .licenses/npm/tslib-2.3.1.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .licenses/npm/universalify.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
20 changes: 20 additions & 0 deletions .licenses/npm/uuid-8.3.2.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions .licenses/npm/webidl-conversions.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/whatwg-url.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions .licenses/npm/xml2js.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/xmlbuilder.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @actions/spark
* @actions/actions-service
4 changes: 2 additions & 2 deletions CONDUCT → CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ 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@github.com. All
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.
@@ -73,4 +73,4 @@ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.ht
[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
https://www.contributor-covenant.org/faq
132 changes: 100 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,84 @@
# setup-go

<p align="left">
<a href="https://github.com/actions/setup-go/actions"><img alt="GitHub Actions status" src="https://github.com/actions/setup-go/workflows/build-test/badge.svg"></a>

<a href="https://github.com/actions/setup-go/actions"><img alt="versions status" src="https://github.com/actions/setup-go/workflows/go-versions/badge.svg"></a>
</p>
[![build-test](https://github.com/actions/setup-go/actions/workflows/workflow.yml/badge.svg)](https://github.com/actions/setup-go/actions/workflows/workflow.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.

# V3

# V2
The V3 edition of the action offers:

The V2 offers:
- Adds GOBIN to the PATH
- Proxy Support
- `stable` input
- Adds `GOBIN` to the `PATH`
- Proxy support
- Check latest version
- Caching packages dependencies
- 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@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '^1.13.1' # The Go version to download (if necessary) and use.
- run: go version
```
```yaml
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '>=1.17.0'
- run: go version
```
Matching an unstable pre-release:
```yaml
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
stable: 'false'
go-version: '1.14.0-rc1' # The Go version to download (if necessary) and use.
go-version: '1.18.0-rc.1' # The Go version to download (if necessary) and use.
- run: go version
```
```yaml
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
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@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.16.1' # The Go version to download (if necessary) and use.
- run: go run hello.go
```
## Check latest version:
## Check latest version
The `check-latest` flag defaults to `false`. Use the default or set `check-latest` to `false` if you prefer stability and if you want to ensure a specific Go version is always used.

@@ -68,15 +88,61 @@ If `check-latest` is set to `true`, the action first checks if the cached versio

```yaml
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.14'
check-latest: true
- 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 [actions/cache](https://github.com/actions/cache) under the hood but requires less configuration settings. The `cache` input is optional, and caching is turned off by default.

The action 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.

**Caching without specifying dependency file path**
```yaml
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.17'
check-latest: true
cache: true
- run: go run hello.go
```

**Caching in monorepos**
```yaml
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.17'
check-latest: true
cache: true
cache-dependency-path: subdir/go.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 containing the version of Go to be used by a project. As the `go.mod` file contains only major and minor (e.g. 1.18) tags, the action will search for the latest available patch version sequentially in the runner's directory with the cached tools, in the [version-manifest.json](https://github.com/actions/go-versions/blob/main/versions-manifest.json) file or at the go servers.

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@v3
- uses: actions/setup-go@v3
with:
go-version-file: 'path/to/go.mod'
- run: go version
```

## Matrix testing

## Matrix Testing:
```yaml
jobs:
build:
@@ -86,29 +152,31 @@ jobs:
go: [ '1.14', '1.13' ]
name: Go ${{ matrix.go }} sample
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
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-rc2`, `1.16.0-beta1`
SemVer's version range syntax: `^1.13.1`
For more information about semantic versioning please refer [semver](https://github.com/npm/node-semver) documentation
- 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.

# License

The scripts and documentation in this project are released under the [MIT License](LICENSE)

# Contributions

Contributions are welcome! See [Contributor's Guide](docs/contributors.md)
Contributions are welcome! See [Contributor's Guide](docs/contributors.md)

## Code of Conduct

:wave: Be nice. See [our code of conduct](CONDUCT)
:wave: Be nice. See [our code of conduct](CODE_OF_CONDUCT.md)
99 changes: 99 additions & 0 deletions __tests__/cache-restore.test.ts
Original file line number Diff line number Diff line change
@@ -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
let hashFilesSpy = jest.spyOn(glob, 'hashFiles');
let getCacheDirectoryPathSpy = jest.spyOn(
cacheUtils,
'getCacheDirectoryPath'
);
let restoreCacheSpy = jest.spyOn(cache, 'restoreCache');
let infoSpy = jest.spyOn(core, 'info');
let 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
expect(async () => {
await cacheRestore.restoreCache(
versionSpec,
packageManager,
cacheDependencyPath
);
}).rejects.toThrowError(
'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).toBeCalledWith(`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).toBeCalledWith('cache-hit', true);
});
});
Loading