generated from ipfs/ipfs-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(examples): add specific testing to make sure the current branch ca…
…n be used with the examples
- Loading branch information
1 parent
f2fd9ee
commit 643e458
Showing
1 changed file
with
62 additions
and
0 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,62 @@ | ||
on: [push, pull_request] | ||
name: Go Test Examples Main | ||
|
||
defaults: | ||
working_directory: examples | ||
jobs: | ||
unit: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ "ubuntu", "windows", "macos" ] | ||
go: [ "1.18.x", "1.19.x" ] | ||
env: | ||
COVERAGES: "" | ||
runs-on: ${{ format('{0}-latest', matrix.os) }} | ||
name: ${{ matrix.os }} (go ${{ matrix.go }}) | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
- name: Go information | ||
run: | | ||
go version | ||
go env | ||
- name: Use msys2 on windows | ||
if: ${{ matrix.os == 'windows' }} | ||
shell: bash | ||
# 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 | ||
- name: Use go mod from current branch | ||
with: | ||
run: | ||
# in addition to the standard tests we want to test the examples against the current branch | ||
# however, that version might be in a fork so we need to replace the dependency | ||
|
||
# make sure the examples run against the current version of kubo | ||
go mod edit -replace github.com/ipfs/go-libipfs=./.. | ||
go mod tidy | ||
- name: Run tests | ||
uses: protocol/multiple-go-modules@v1.2 | ||
with: | ||
run: go test -v -shuffle=on ./... | ||
- name: Run tests (32 bit) | ||
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX. | ||
uses: protocol/multiple-go-modules@v1.2 | ||
env: | ||
GOARCH: 386 | ||
with: | ||
run: | | ||
export "PATH=${{ env.PATH_386 }}:$PATH" | ||
go test -v -shuffle=on ./... | ||
- name: Run tests with race detector | ||
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow | ||
uses: protocol/multiple-go-modules@v1.2 | ||
with: | ||
run: go test -v -race ./... |