Skip to content

Commit

Permalink
ci(examples): add specific testing to make sure the current branch ca…
Browse files Browse the repository at this point in the history
…n be used with the examples
  • Loading branch information
aschmahmann committed Jan 31, 2023
1 parent f2fd9ee commit 643e458
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/test-examples-against-branch.yml
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 ./...

0 comments on commit 643e458

Please sign in to comment.