From cab303785aeab1d779fb16404b2cf97ccb72c12d Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Wed, 17 Nov 2021 12:48:14 -0500 Subject: [PATCH] ci: run examples against latest go-ipfs even in forks --- .circleci/main.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.circleci/main.yml b/.circleci/main.yml index bdfe72f07e7..410d13f808c 100644 --- a/.circleci/main.yml +++ b/.circleci/main.yml @@ -106,10 +106,21 @@ jobs: command: bash <(curl -s https://codecov.io/bash) -cF unittests -X search -f coverage/unit_tests.coverprofile - run: command: | - current=$(git rev-parse HEAD) - go get github.com/ipfs/go-ipfs@$current + # we want to test the examples against the current version of go-ipfs + # however, that version might be in a fork so we need to replace the dependency + + # backup the go.mod and go.sum files to restore them after we run the tests + cp go.mod go.mod.bak + cp go.sum go.sum.bak + + # make sure the examples run against the current version of go-ipfs + go mod edit -replace github.com/ipfs/go-ipfs=./../../.. go mod tidy go test -v ./... + + # restore the go.mod and go.sum files to their original state + mv go.mod.bak go.mod + mv go.sum.bak go.sum working_directory: ~/ipfs/go-ipfs/docs/examples/go-ipfs-as-a-library - run: