mirror of
https://github.com/actions/setup-go.git
synced 2025-06-14 17:47:12 +02:00
Compare commits
7 Commits
v1.0.2
...
ethomson/u
Author | SHA1 | Date | |
---|---|---|---|
63aa003870 | |||
8dd2e77965 | |||
75259a5ae0 | |||
4efa1b82d1 | |||
bc6edb526d | |||
21620fff65 | |||
595aed780b |
97
.gitignore
vendored
97
.gitignore
vendored
@ -1,7 +1,92 @@
|
|||||||
# runtime dependencies are checked in
|
# Explicitly not ignoring node_modules so that they are included in package downloaded by runner
|
||||||
# dev dependencies are *not* checked in
|
!node_modules/
|
||||||
node_modules/.bin
|
|
||||||
node_modules/typescript
|
|
||||||
node_modules/@types
|
|
||||||
node_modules/prettier
|
|
||||||
__tests__/runner/*
|
__tests__/runner/*
|
||||||
|
|
||||||
|
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# next.js build output
|
||||||
|
.next
|
||||||
|
|
||||||
|
# nuxt.js build output
|
||||||
|
.nuxt
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
@ -16,7 +16,7 @@ See [action.yml](action.yml)
|
|||||||
Basic:
|
Basic:
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@v1
|
||||||
- uses: actions/setup-go@v1
|
- uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
go-version: '1.9.3' # The Go version to download (if necessary) and use.
|
go-version: '1.9.3' # The Go version to download (if necessary) and use.
|
||||||
@ -33,7 +33,7 @@ jobs:
|
|||||||
go: [ '1.8', '1.9.3', '1.10.x' ]
|
go: [ '1.8', '1.9.3', '1.10.x' ]
|
||||||
name: Go ${{ matrix.go }} sample
|
name: Go ${{ matrix.go }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@v1
|
||||||
- name: Setup go
|
- name: Setup go
|
||||||
uses: actions/setup-go@v1
|
uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
|
10196
__tests__/data/golang-dl.json
Normal file
10196
__tests__/data/golang-dl.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -43,9 +43,10 @@ describe('installer tests', () => {
|
|||||||
|
|
||||||
describe('the latest release of a go version', () => {
|
describe('the latest release of a go version', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
nock('https://api.github.com')
|
nock('https://golang.org')
|
||||||
.get('/repos/golang/go/git/refs/tags')
|
.get('/dl/')
|
||||||
.replyWithFile(200, path.join(dataDir, 'golang-tags.json'));
|
.query({mode: 'json', include: 'all'})
|
||||||
|
.replyWithFile(200, path.join(dataDir, 'golang-dl.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -79,7 +80,7 @@ describe('installer tests', () => {
|
|||||||
|
|
||||||
it('Acquires latest release version of go if using 1.x and no matching version is installed', async () => {
|
it('Acquires latest release version of go if using 1.x and no matching version is installed', async () => {
|
||||||
await installer.getGo('1.x');
|
await installer.getGo('1.x');
|
||||||
const goDir = path.join(toolDir, 'go', '1.13.0-beta1', os.arch());
|
const goDir = path.join(toolDir, 'go', '1.13.0', os.arch());
|
||||||
|
|
||||||
expect(fs.existsSync(`${goDir}.complete`)).toBe(true);
|
expect(fs.existsSync(`${goDir}.complete`)).toBe(true);
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: 'Setup Go environment'
|
name: 'Setup Go'
|
||||||
description: 'Setup a Go environment and add it to the PATH, additionally providing proxy support'
|
description: 'Set up a specific version of Go and add the command-line tools to the PATH'
|
||||||
author: 'GitHub'
|
author: 'GitHub'
|
||||||
inputs:
|
inputs:
|
||||||
go-version:
|
go-version:
|
||||||
@ -8,6 +8,7 @@ inputs:
|
|||||||
# Deprecated option, do not use. Will not be supported after October 1, 2019
|
# Deprecated option, do not use. Will not be supported after October 1, 2019
|
||||||
version:
|
version:
|
||||||
description: 'Deprecated. Use go-version instead. Will not be supported after October 1, 2019'
|
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'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'lib/setup-go.js'
|
main: 'lib/setup-go.js'
|
||||||
|
@ -186,10 +186,9 @@ function getLatestVersion(version) {
|
|||||||
function getAvailableVersions() {
|
function getAvailableVersions() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let rest = new restm.RestClient('setup-go');
|
let rest = new restm.RestClient('setup-go');
|
||||||
let tags = (yield rest.get('https://api.github.com/repos/golang/go/git/refs/tags')).result || [];
|
let tags = (yield rest.get('https://golang.org/dl/?mode=json&include=all'))
|
||||||
return tags
|
.result || [];
|
||||||
.filter(tag => tag.ref.match(/go\d+\.[\w\.]+/g))
|
return tags.map(tag => tag.version.replace('go', ''));
|
||||||
.map(tag => tag.ref.replace('refs/tags/go', ''));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getPossibleVersions(version) {
|
function getPossibleVersions(version) {
|
||||||
|
@ -187,19 +187,16 @@ async function getLatestVersion(version: string): Promise<string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface IGoRef {
|
interface IGoRef {
|
||||||
ref: string;
|
version: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getAvailableVersions(): Promise<string[]> {
|
async function getAvailableVersions(): Promise<string[]> {
|
||||||
let rest: restm.RestClient = new restm.RestClient('setup-go');
|
let rest: restm.RestClient = new restm.RestClient('setup-go');
|
||||||
let tags: IGoRef[] =
|
let tags: IGoRef[] =
|
||||||
(await rest.get<IGoRef[]>(
|
(await rest.get<IGoRef[]>('https://golang.org/dl/?mode=json&include=all'))
|
||||||
'https://api.github.com/repos/golang/go/git/refs/tags'
|
.result || [];
|
||||||
)).result || [];
|
|
||||||
|
|
||||||
return tags
|
return tags.map(tag => tag.version.replace('go', ''));
|
||||||
.filter(tag => tag.ref.match(/go\d+\.[\w\.]+/g))
|
|
||||||
.map(tag => tag.ref.replace('refs/tags/go', ''));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getPossibleVersions(version: string): Promise<string[]> {
|
async function getPossibleVersions(version: string): Promise<string[]> {
|
||||||
|
Reference in New Issue
Block a user