Commit graph

34 commits

Author SHA1 Message Date
Berk D. Demir
38f5ff1dc5 Canonicalize versions with makeSemver in getInfoFromDist
While getInfoFromManifest stores semver versions in IGoVersionInfo
struct, getInfoFromDist uses "goX.Y.Z" versions with "go" prefix. To
make it consistent between two, convert versions from golang.org/dl
version registry to semver versions.
2020-12-16 15:07:50 -08:00
Berk D. Demir
47f75dda82 Cannot reuse IGoVersionInfo from dist for manifest
...and vice versa.

While here, also free versionInfo and versionSpec so we don't
(un)intentionally overwrite them somewhere down below.
2020-12-16 15:07:50 -08:00
Berk D. Demir
b9260615df Add version-resolver input
Tool cache can be stale in GitHub and self-hosted runners. If supplied
`go-version` is a semver range--instead of an explicit version--it will
be tried through the version inventory in cache, first. Even though
the GitHub local copy or origin distribution may have newer versions
matching the passed range, as long as the cache can satisfy the range,
the latest version from cache will be used.

Introduce an optional input, `version-resolver`. If defined, it tries to
resolve the version spec against either GitHub local copy or Go's
canonical source of version manifest.
If the value of `version-resolver` is:
  - "manifest": the manifest file under @actions/go-version get used.
  - "dist": the manifest at https://golang.org/dl/?mode=json&include=all
  gets used.  It can take values

Example:
--------
- Latest Go Version: 1.15.2
- tool-cache has go1.15 (1.15.0), latest.

build.yml:
```
[...]
  - uses: actions/setup-go@v2
    with:
      go-version: '>=1.5 <2'
[...]
```

Although the intention of the user might be to get latest
version between "oldest Go 1.15.0, newest--not inclusive--Go 2.0", the
cache will match this range with Go 1.15.0.

build.yml (v2):
```
[...]
  - uses: actions/setup-go@v2
    with:
      go-version: '>=1.5 <2'
      version-resolver: 'manifest'
[...]
```

With supplied version resolver, the semver range will be checked against
the local GitHub version manifest from @actions/go-versions[1], and
match 1.15.2. Cache will be queried with the resolved version, instead
of the range. When the cache gets updated globally, next runs will use
the tool from the cache, instead of downloading locally or in case of
resolver 'dist', directly from Google.

[1]: https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json

Closes #73
2020-12-16 15:07:50 -08:00
Thomas Boop
37335c7bb2
Swap to Environment Files (#76)
* Swap to env files
2020-10-01 10:45:00 -04:00
Bryan MacFarlane
33cbf07c96 workflow main references 2020-07-22 08:04:56 -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
6613fc89fc go env block 2020-04-06 08:42:55 -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
cec6ecefb4 output version of go it resolved to 2020-03-31 10:32:03 -04:00
Bryan MacFarlane
1c06f0e82e couple tests 2020-03-27 00:55:12 -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
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
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
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
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
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
f4b0281c15 mocked tests work with no internet 2020-02-09 09:25:20 -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