Skip to content

output go env

output go env #221

Workflow file for this run

name: integration
on:
push:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]
jobs:
install_go_tip:
name: install tip
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- windows-2022
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3.3.0
- id: setup_go
name: install tip
uses: ./
with:
go-version: tip
- name: outputs
run: |
echo '*********** env ************'
env
echo '*********** go env ***********'
go env
echo '${{ toJson( steps.setup_go.outputs ) }}' | jq .
go version
set -ex
[[ "$(go version)" == *"devel"* ]]
install_go:
name: install go
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- ubuntu-22.04
- windows-2019
- windows-2022
- macos-11
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3.3.0
- id: setup_go_1_15_5
name: install 1.15.5
uses: ./
with:
go-version: '1.15.5'
- name: outputs
run: |
echo '*********** env ************'
env
echo '*********** go env ***********'
go env
echo '${{ toJson( steps.setup_go_1_15_5.outputs ) }}' | jq .
go version
set -ex
[[ "$(go version)" == *"1.15.5"* ]]
[[ '${{steps.setup_go_1_15_5.outputs.GOROOT}}' == *"1.15.5"* ]]
[[ '${{steps.setup_go_1_15_5.outputs.GOTOOLDIR}}' == *"1.15.5"* ]]
- id: setup_go_1_16rc1
name: install 1.16rc1
uses: ./
with:
go-version: '1.16rc1'
- name: outputs
run: |
echo '*********** env ************'
env
echo '*********** go env ***********'
go env
echo '${{ toJson( steps.setup_go_1_16rc1.outputs ) }}' | jq .
go version
set -ex
[[ "$(go version)" == *"1.16rc1"* ]]
[[ '${{steps.setup_go_1_16rc1.outputs.GOROOT}}' == *"16rc1"* ]]
[[ '${{steps.setup_go_1_16rc1.outputs.GOTOOLDIR}}' == *"16rc1"* ]]
- id: setup_go_all
name: install '*'
uses: ./
with:
go-version: '*'
- name: outputs
run: |
echo '*********** env ************'
env
echo '*********** go env ***********'
go env
echo '${{ toJson( steps.setup_go_all.outputs ) }}' | jq .
go version
- id: setup_go_1_15_5_again
name: install 1.15.5 again
uses: ./
with:
go-version: '1.15.x <1.15.6'
- name: outputs
run: |
echo '*********** env ************'
env
echo '*********** go env ***********'
go env
echo '${{ toJson( steps.setup_go_1_15_5_again.outputs ) }}' | jq .
go version
set -ex
[[ "$(go version)" == *"1.15.5"* ]]
[[ '${{steps.setup_go_1_15_5_again.outputs.GOROOT}}' == *"1.15.5"* ]]
[[ '${{steps.setup_go_1_15_5_again.outputs.GOTOOLDIR}}' == *"1.15.5"* ]]
- id: setup_go_1_13_x
name: install 1.13.x
uses: ./
with:
go-version: '1.13.x'
ignore-local: true
- name: outputs
run: |
echo '*********** env ************'
env
echo '*********** go env ***********'
go env
echo '${{ toJson( steps.setup_go_1_13_x.outputs ) }}' | jq .
go version
set -ex
[[ "$(go version)" == *"1.13"* ]]
[[ '${{steps.setup_go_1_13_x.outputs.GOROOT}}' == *"1.13"* ]]
[[ '${{steps.setup_go_1_13_x.outputs.GOTOOLDIR}}' == *"1.13"* ]]
- id: setup_go_1_21
name: install 1.21
uses: ./
with:
go-version: '1.21'
ignore-local: true
- name: outputs
run: |
echo '*********** env ************'
env
echo '*********** go env ***********'
go env
echo '${{ toJson( steps.setup_go_1_21.outputs ) }}' | jq .
go version
set -ex
[[ "$(go version)" == *"1.21.0"* ]]
[[ '${{steps.setup_go_1_21.outputs.GOROOT}}' == *"1.21.0"* ]]
[[ '${{steps.setup_go_1_21.outputs.GOTOOLDIR}}' == *"1.21.0"* ]]
- id: setup_go_1_21_0
name: install 1.21.0
uses: ./
with:
go-version: '1.21.0'
ignore-local: true
- name: outputs
run: |
echo '*********** env ************'
env
echo '*********** go env ***********'
go env
echo '${{ toJson( steps.setup_go_1_21.outputs ) }}' | jq .
go version
set -ex
[[ "$(go version)" == *"1.21.0"* ]]
[[ '${{steps.setup_go_1_21.outputs.GOROOT}}' == *"1.21.0"* ]]
[[ '${{steps.setup_go_1_21.outputs.GOTOOLDIR}}' == *"1.21.0"* ]]
- name: create_go_mod 1.15
run: |
mkdir -p tmp/go_mod_1_15
cat >> tmp/go_mod_1_15/go.mod << EOF
module example.com/some-module
go 1.15
require (
golang.org/x/exp v0.0.0-20230728194245-b0cb94b80691
golang.org/x/sync v0.3.0
)
- id: setup_go_1_15_from_go_mod
name: install 1.15 from go.mod
uses: ./
with:
go-version-file: 'tmp/go_mod_1_15/go.mod'
ignore-local: true
- name: outputs
run: |
echo '*********** env ************'
env
echo '*********** go env ***********'
go env
echo '${{ toJson( steps.setup_go_1_15_from_go_mod.outputs ) }}' | jq .
go version
set -ex
requested_min_version='1.15'
installed_version="$(go version | cut -d " " -f 3 | tr -d "go")"
lowest_version="$(echo -e "$requested_min_version\n$installed_version" | sort -rV | tail -1)"
[[ "$lowest_version" == "$requested_min_version" ]]
[[ '${{steps.setup_go_1_15_from_go_mod.outputs.GOROOT}}' == *"$installed_version"* ]]
[[ '${{steps.setup_go_1_15_from_go_mod.outputs.GOTOOLDIR}}' == *"$installed_version"* ]]
- name: create_go_mod 1.21rc1
run: |
mkdir -p tmp/go_mod_1_21rc1
cat >> tmp/go_mod_1_21rc1/go.mod << EOF
module example.com/some-module
go 1.21rc1
require (
golang.org/x/exp v0.0.0-20230728194245-b0cb94b80691
golang.org/x/sync v0.3.0
)
- id: setup_go_1_21rc1_from_go_mod
name: install 1.21rc1 from go.mod
uses: ./
with:
go-version-file: 'tmp/go_mod_1_21rc1/go.mod'
ignore-local: true
- name: outputs
run: |
echo '*********** env ************'
env
echo '*********** go env ***********'
go env
echo '${{ toJson( steps.setup_go_1_21rc1_from_go_mod.outputs ) }}' | jq .
go version
set -ex
requested_min_version='1.21rc1'
installed_version="$(go version | cut -d " " -f 3 | tr -d "go")"
lowest_version="$(echo -e "$requested_min_version\n$installed_version" | sort -rV | tail -1)"
[[ "$lowest_version" == "$requested_min_version" ]]
[[ '${{steps.setup_go_1_21rc1_from_go_mod.outputs.GOROOT}}' == *"$installed_version"* ]]
[[ '${{steps.setup_go_1_21rc1_from_go_mod.outputs.GOTOOLDIR}}' == *"$installed_version"* ]]