mirror of
				https://github.com/actions/setup-go.git
				synced 2025-10-31 15:50:33 +00:00 
			
		
		
		
	Compare commits
	
		
			22 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 424fc82d43 | ||
|   | 82388ea9d4 | ||
|   | fdeec47002 | ||
|   | 3e9d5483e6 | ||
|   | 02f7ea9f09 | ||
|   | 5805cf725b | ||
|   | 35030c1fd2 | ||
|   | 59d644db2a | ||
|   | 76929df236 | ||
|   | b06835a88c | ||
|   | b8a24202e2 | ||
|   | e234d99c78 | ||
|   | 0ea1f64ec9 | ||
|   | 331ce1d993 | ||
|   | 1087a81afd | ||
|   | ecd878f81d | ||
|   | eca066937b | ||
|   | e816064dae | ||
|   | bba6fe1d58 | ||
|   | 3b4dc6cbed | ||
|   | afe68ffd57 | ||
|   | 6eb700292f | 
							
								
								
									
										38
									
								
								.github/ISSUE_TEMPLATE/bug_report.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								.github/ISSUE_TEMPLATE/bug_report.md
									
									
									
									
										vendored
									
									
										Normal 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
									
								
							
							
						
						
									
										1
									
								
								.github/ISSUE_TEMPLATE/config.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| blank_issues_enabled: false | ||||
							
								
								
									
										18
									
								
								.github/ISSUE_TEMPLATE/feature_request.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								.github/ISSUE_TEMPLATE/feature_request.md
									
									
									
									
										vendored
									
									
										Normal 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! --> | ||||
							
								
								
									
										9
									
								
								.github/pull_request_template.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								.github/pull_request_template.md
									
									
									
									
										vendored
									
									
										Normal 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. | ||||
							
								
								
									
										51
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,51 @@ | ||||
| # `dist/index.js` is a special file in Actions. | ||||
| # When you reference an action with `uses:` in a workflow, | ||||
| # `index.js` is the code that will run. | ||||
| # For our project, we generate this file through a build process from other source files. | ||||
| # We need to make sure the checked-in `index.js` actually matches what we expect it to be. | ||||
| name: Check dist/ | ||||
|  | ||||
| on: | ||||
|   push: | ||||
|     branches: | ||||
|       - main | ||||
|     paths-ignore: | ||||
|       - '**.md' | ||||
|   pull_request: | ||||
|     paths-ignore: | ||||
|       - '**.md' | ||||
|   workflow_dispatch: | ||||
|  | ||||
| jobs: | ||||
|   check-dist: | ||||
|     runs-on: ubuntu-latest | ||||
|  | ||||
|     steps: | ||||
|       - uses: actions/checkout@v2 | ||||
|  | ||||
|       - name: Set Node.js 12.x | ||||
|         uses: actions/setup-node@v1 | ||||
|         with: | ||||
|           node-version: 12.x | ||||
|  | ||||
|       - name: Install dependencies | ||||
|         run: npm ci | ||||
|  | ||||
|       - name: Rebuild the dist/ directory | ||||
|         run: npm run build | ||||
|  | ||||
|       - name: Compare the expected and actual dist/ directories | ||||
|         run: | | ||||
|           if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then | ||||
|             echo "Detected uncommitted changes after build.  See status below:" | ||||
|             git diff | ||||
|             exit 1 | ||||
|           fi | ||||
|         id: diff | ||||
|  | ||||
|       # If index.js was different than expected, upload the expected version as an artifact | ||||
|       - uses: actions/upload-artifact@v2 | ||||
|         if: ${{ failure() && steps.diff.conclusion == 'failure' }} | ||||
|         with: | ||||
|           name: dist | ||||
|           path: dist/ | ||||
							
								
								
									
										8
									
								
								.github/workflows/licensed.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/workflows/licensed.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,8 +1,12 @@ | ||||
| name: Licensed | ||||
|  | ||||
| on: | ||||
|   push: {branches: main} | ||||
|   pull_request: {branches: main} | ||||
|   push: | ||||
|     branches: | ||||
|       - main | ||||
|   pull_request: | ||||
|     branches: | ||||
|       - main | ||||
|  | ||||
| jobs: | ||||
|   test: | ||||
|   | ||||
							
								
								
									
										27
									
								
								.github/workflows/release-new-action-version.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								.github/workflows/release-new-action-version.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| 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.1.0 | ||||
|         with: | ||||
|           source-tag: ${{ env.TAG_NAME }} | ||||
|           slack-webhook: ${{ secrets.SLACK_WEBHOOK }} | ||||
							
								
								
									
										2
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							| @@ -65,10 +65,12 @@ jobs: | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v2 | ||||
|  | ||||
|       - name: setup-go ${{ matrix.go }} | ||||
|         uses: ./ | ||||
|         with: | ||||
|           go-version: ${{ matrix.go }} | ||||
|  | ||||
|       - name: verify go | ||||
|         run: __tests__/verify-go.sh ${{ matrix.go }} | ||||
|         shell: bash | ||||
|   | ||||
							
								
								
									
										3
									
								
								.github/workflows/workflow.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.github/workflows/workflow.yml
									
									
									
									
										vendored
									
									
								
							| @@ -20,9 +20,10 @@ jobs: | ||||
|         uses: actions/checkout@v2 | ||||
|  | ||||
|       - name: Setup node 12 | ||||
|       uses: actions/setup-node@v1 | ||||
|         uses: actions/setup-node@v2 | ||||
|         with: | ||||
|           node-version: 12 | ||||
|           cache: npm | ||||
|  | ||||
|       - name: npm install | ||||
|         run: npm install | ||||
|   | ||||
							
								
								
									
										1
									
								
								CODEOWNERS
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								CODEOWNERS
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| * @actions/spark | ||||
							
								
								
									
										29
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								README.md
									
									
									
									
									
								
							| @@ -21,25 +21,25 @@ The V2 offers: | ||||
|  | ||||
| It will first check the local cache for a version match. If version is not found locally, It will pull it from `main` branch of [go-versions](https://github.com/actions/go-versions/blob/main/versions-manifest.json) repository and on miss or failure, it will fall back to the previous behavior of download directly from [go dist](https://storage.googleapis.com/golang). | ||||
|  | ||||
| Matching by semver spec: | ||||
| Matching by [semver spec](https://github.com/npm/node-semver): | ||||
| ```yaml | ||||
| steps: | ||||
| - uses: actions/checkout@v2 | ||||
| - uses: actions/setup-go@v2 | ||||
|   - uses: actions/checkout@v2 | ||||
|   - uses: actions/setup-go@v2 | ||||
|     with: | ||||
|       go-version: '^1.13.1' # The Go version to download (if necessary) and use. | ||||
| - run: go version | ||||
|   - run: go version | ||||
| ``` | ||||
|  | ||||
| Matching an unstable pre-release: | ||||
| ```yaml | ||||
| steps: | ||||
| - uses: actions/checkout@v2 | ||||
| - uses: actions/setup-go@v2 | ||||
|   - uses: actions/checkout@v2 | ||||
|   - uses: actions/setup-go@v2 | ||||
|     with: | ||||
|       stable: 'false' | ||||
|       go-version: '1.14.0-rc1' # The Go version to download (if necessary) and use. | ||||
| - run: go version | ||||
|   - run: go version | ||||
| ``` | ||||
|  | ||||
| # Usage | ||||
| @@ -49,11 +49,11 @@ See [action.yml](action.yml) | ||||
| Basic: | ||||
| ```yaml | ||||
| steps: | ||||
| - uses: actions/checkout@master | ||||
| - uses: actions/setup-go@v1 | ||||
|   - uses: actions/checkout@master | ||||
|   - uses: actions/setup-go@v2 | ||||
|     with: | ||||
|       go-version: '1.9.3' # The Go version to download (if necessary) and use. | ||||
| - run: go run hello.go | ||||
|   - run: go run hello.go | ||||
| ``` | ||||
|  | ||||
| Matrix Testing: | ||||
| @@ -68,12 +68,19 @@ jobs: | ||||
|     steps: | ||||
|       - uses: actions/checkout@v2 | ||||
|       - name: Setup go | ||||
|         uses: actions/setup-go@v1 | ||||
|         uses: actions/setup-go@v2 | ||||
|         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 | ||||
|  | ||||
| # License | ||||
|  | ||||
| The scripts and documentation in this project are released under the [MIT License](LICENSE) | ||||
|   | ||||
| @@ -497,6 +497,16 @@ describe('setup-go', () => { | ||||
|     expect(annotation.message).toBe('undefined: fmt.Printl'); | ||||
|   }); | ||||
|  | ||||
|   it('matches on unix path down the tree', async () => { | ||||
|     let line = 'foo/main.go:13:2: undefined: fmt.Printl'; | ||||
|     let 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 () => { | ||||
|     let line = '/assert.go:4:1: missing return at end of function'; | ||||
|     let annotation = testMatch(line); | ||||
|   | ||||
							
								
								
									
										4
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							| @@ -5084,9 +5084,9 @@ function installGoVersion(info, auth) { | ||||
| } | ||||
| function extractGoArchive(archivePath) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         const arch = os_1.default.arch(); | ||||
|         const platform = os_1.default.platform(); | ||||
|         let extPath; | ||||
|         if (arch === 'win32') { | ||||
|         if (platform === 'win32') { | ||||
|             extPath = yield tc.extractZip(archivePath); | ||||
|         } | ||||
|         else { | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
|             "owner": "go", | ||||
|             "pattern": [ | ||||
|                 { | ||||
|                     "regexp": "^\\s*(\\.{0,2}[\\/\\\\].+\\.go):(?:(\\d+):(\\d+):)? (.*)", | ||||
|                     "regexp": "^\\s*(.+\\.go):(?:(\\d+):(\\d+):)? (.*)", | ||||
|                     "file": 1, | ||||
|                     "line": 2, | ||||
|                     "column": 3, | ||||
|   | ||||
							
								
								
									
										7182
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										7182
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -30,15 +30,15 @@ | ||||
|     "semver": "^6.1.1" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@types/jest": "^24.0.13", | ||||
|     "@types/jest": "^27.0.2", | ||||
|     "@types/node": "^12.0.4", | ||||
|     "@types/semver": "^6.0.0", | ||||
|     "@zeit/ncc": "^0.21.0", | ||||
|     "jest": "^25.2.1", | ||||
|     "jest-circus": "^24.7.1", | ||||
|     "jest": "^27.2.5", | ||||
|     "jest-circus": "^27.2.5", | ||||
|     "nock": "^10.0.6", | ||||
|     "prettier": "^1.17.1", | ||||
|     "ts-jest": "^24.0.2", | ||||
|     "ts-jest": "^27.0.5", | ||||
|     "typescript": "^3.8.3" | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -122,10 +122,10 @@ async function installGoVersion( | ||||
| } | ||||
|  | ||||
| export async function extractGoArchive(archivePath: string): Promise<string> { | ||||
|   const arch = os.arch(); | ||||
|   const platform = os.platform(); | ||||
|   let extPath: string; | ||||
|  | ||||
|   if (arch === 'win32') { | ||||
|   if (platform === 'win32') { | ||||
|     extPath = await tc.extractZip(archivePath); | ||||
|   } else { | ||||
|     extPath = await tc.extractTar(archivePath); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user