-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove toolchain directories from the cache
- Loading branch information
Showing
16 changed files
with
527 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Validate 'setup-go' | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
schedule: | ||
- cron: 0 0 * * * | ||
|
||
jobs: | ||
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.21] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: substitute go.mod with toolchain | ||
run: | | ||
cp __tests__/toolchain.go.mod go.mod | ||
shell: bash | ||
|
||
- name: setup-go ${{ matrix.go }} | ||
uses: ./ | ||
with: | ||
go-version: ${{ matrix.go }} | ||
|
||
- name: verify go | ||
run: __tests__/verify-go.sh ${{ matrix.go }} | ||
shell: bash |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module example-mod | ||
|
||
go 1.21.0 | ||
|
||
toolchain go1.21.0 | ||
toolchain go1.21.1 | ||
|
||
require golang.org/x/tools v0.13.0 | ||
|
||
require ( | ||
golang.org/x/mod v0.12.0 // indirect | ||
golang.org/x/sys v0.12.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import {isSelfHosted} from '../src/utils'; | ||
|
||
describe('utils', () => { | ||
describe('isSelfHosted', () => { | ||
let AGENT_ISSELFHOSTED: string | undefined; | ||
let RUNNER_ENVIRONMENT: string | undefined; | ||
|
||
beforeEach(() => { | ||
AGENT_ISSELFHOSTED = process.env['AGENT_ISSELFHOSTED']; | ||
delete process.env['AGENT_ISSELFHOSTED']; | ||
RUNNER_ENVIRONMENT = process.env['RUNNER_ENVIRONMENT']; | ||
delete process.env['RUNNER_ENVIRONMENT']; | ||
}); | ||
|
||
afterEach(() => { | ||
if (AGENT_ISSELFHOSTED === undefined) { | ||
delete process.env['AGENT_ISSELFHOSTED']; | ||
} else { | ||
process.env['AGENT_ISSELFHOSTED'] = AGENT_ISSELFHOSTED; | ||
} | ||
if (RUNNER_ENVIRONMENT === undefined) { | ||
delete process.env['RUNNER_ENVIRONMENT']; | ||
} else { | ||
process.env['RUNNER_ENVIRONMENT'] = RUNNER_ENVIRONMENT; | ||
} | ||
}); | ||
|
||
it('isSelfHosted should be true if no environment variables set', () => { | ||
expect(isSelfHosted()).toBeTruthy(); | ||
}); | ||
|
||
it('isSelfHosted should be true if environment variable is not set to denote GitHub hosted', () => { | ||
process.env['RUNNER_ENVIRONMENT'] = 'some'; | ||
expect(isSelfHosted()).toBeTruthy(); | ||
}); | ||
|
||
it('isSelfHosted should be true if environment variable set to denote Azure Pipelines self hosted', () => { | ||
process.env['AGENT_ISSELFHOSTED'] = '1'; | ||
expect(isSelfHosted()).toBeTruthy(); | ||
}); | ||
|
||
it('isSelfHosted should be false if environment variable set to denote GitHub hosted', () => { | ||
process.env['RUNNER_ENVIRONMENT'] = 'github-hosted'; | ||
expect(isSelfHosted()).toBeFalsy(); | ||
}); | ||
|
||
it('isSelfHosted should be false if environment variable is not set to denote Azure Pipelines self hosted', () => { | ||
process.env['AGENT_ISSELFHOSTED'] = 'some'; | ||
expect(isSelfHosted()).toBeFalsy(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.