Skip to content

Commit

Permalink
Update playground.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh committed Oct 19, 2023
1 parent d693949 commit 4adb860
Showing 1 changed file with 108 additions and 3 deletions.
111 changes: 108 additions & 3 deletions .github/workflows/playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,112 @@ jobs:
playground:
name: Play
runs-on: ["self-hosted", "windows", "x64", "playground"]
strategy:
fail-fast: false
matrix:
os: [ "windows" ]
go: [ "this" ]
env:
GOTESTFLAGS: -cover -coverprofile=module-coverage.txt -coverpkg=./...
GO386FLAGS: ''
GORACEFLAGS: ''
steps:
- run: echo ${env:PATH}
- run: echo $PATH
shell: bash
- name: Use msys2 on windows
if: matrix.os == 'windows'
# The executable for msys2 is also called bash.cmd
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#shells
# If we prepend its location to the PATH
# subsequent 'shell: bash' steps will use msys2 instead of gitbash
run: echo "C:/msys64/usr/bin" >> $GITHUB_PATH
- uses: actions/checkout@v3
with:
repository: libp2p/go-libp2p
submodules: recursive
# Update to v4 is blocked by https://github.com/actions/setup-go/pull/411
# - uses: actions/setup-go@v4
- uses: actions/setup-go@v3
with:
go-version: stable
# cache: false
- id: config
uses: pl-strflt/uci/.github/actions/read-config@main
- id: go-mod
uses: pl-strflt/uci/.github/actions/read-go-mod@main
- id: go
env:
MATRIX_GO: ${{ matrix.go }}
GO_MOD_VERSION: ${{ fromJSON(steps.go-mod.outputs.json).Go }}
run: |
if [[ "$MATRIX_GO" == "this" ]]; then
echo "version=$GO_MOD_VERSION.x" >> $GITHUB_OUTPUT
elif [[ "$MATRIX_GO" == "next" ]]; then
MAJOR="${GO_MOD_VERSION%.[0-9]*}"
MINOR="${GO_MOD_VERSION#[0-9]*.}"
echo "version=$MAJOR.$(($MINOR+1)).x" >> $GITHUB_OUTPUT
elif [[ "$MATRIX_GO" == "prev" ]]; then
MAJOR="${GO_MOD_VERSION%.[0-9]*}"
MINOR="${GO_MOD_VERSION#[0-9]*.}"
echo "version=$MAJOR.$(($MINOR-1)).x" >> $GITHUB_OUTPUT
else
echo "version=$MATRIX_GO" >> $GITHUB_OUTPUT
fi
- if: toJSON(fromJSON(steps.config.outputs.json).shuffle) != 'false'
run: |
echo "GOTESTFLAGS=-shuffle=on $GOTESTFLAGS" >> $GITHUB_ENV
echo "GO386FLAGS=-shuffle=on $GO386FLAGS" >> $GITHUB_ENV
echo "GORACEFLAGS=-shuffle=on $GORACEFLAGS" >> $GITHUB_ENV
- if: toJSON(fromJSON(steps.config.outputs.json).verbose) != 'false'
run: |
echo "GOTESTFLAGS=-v $GOTESTFLAGS" >> $GITHUB_ENV
echo "GO386FLAGS=-v $GO386FLAGS" >> $GITHUB_ENV
echo "GORACEFLAGS=-v $GORACEFLAGS" >> $GITHUB_ENV
# Update to v4 is blocked by https://github.com/actions/setup-go/pull/411
# - uses: actions/setup-go@v4
- uses: actions/setup-go@v3
with:
go-version: ${{ steps.go.outputs.version }}
- name: Go information
run: |
go version
go env
- name: Run repo-specific setup
uses: ./.github/actions/go-test-setup
if: hashFiles('./.github/actions/go-test-setup') != ''
- name: Run tests
if: contains(fromJSON(steps.config.outputs.json).skipOSes, matrix.os) == false
uses: protocol/multiple-go-modules@v1.2
env:
GOFLAGS: ${{ format('{0} {1}', env.GOTESTFLAGS, env.GOFLAGS) }}
with:
run: go test ./...
- name: Run tests (32 bit)
# can't run 32 bit tests on OSX.
if: matrix.os != 'macos' &&
fromJSON(steps.config.outputs.json).skip32bit != true &&
contains(fromJSON(steps.config.outputs.json).skipOSes, matrix.os) == false
uses: protocol/multiple-go-modules@v1.2
env:
GOARCH: 386
GOFLAGS: ${{ format('{0} {1}', env.GO386FLAGS, env.GOFLAGS) }}
with:
run: |
export "PATH=$PATH_386:$PATH"
go test ./...
- name: Run tests with race detector
# speed things up. Windows and OSX VMs are slow
if: matrix.os == 'ubuntu' &&
fromJSON(steps.config.outputs.json).skipRace != true &&
contains(fromJSON(steps.config.outputs.json).skipOSes, matrix.os) == false
uses: protocol/multiple-go-modules@v1.2
env:
GOFLAGS: ${{ format('{0} {1}', env.GORACEFLAGS, env.GOFLAGS) }}
with:
run: go test -race ./...
- name: Collect coverage files
id: coverages
run: echo "files=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_OUTPUT
- name: Upload coverage to Codecov
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
files: ${{ steps.coverages.outputs.files }}
env_vars: OS=${{ matrix.os }}, GO=${{ steps.go.outputs.version }}

0 comments on commit 4adb860

Please sign in to comment.