ci: run examples against latest go-ipfs even in forks (#8554)
Adin Schmahmann committed
Nov 17, 2021 at 14:56 UTC
c71a1c24113a0f8493d4aee3404126bf308c5472
1 file changed
+13
-2
.circleci/main.yml
+13
-2
@@ -106,10 +106,21 @@ jobs:
106
command: bash <(curl -s https://codecov.io/bash) -cF unittests -X search -f coverage/unit_tests.coverprofile
107
- run:
108
command: |
109
- current=$(git rev-parse HEAD)
110
- go get github.com/ipfs/go-ipfs@$current
109
+ # we want to test the examples against the current version of go-ipfs
110
+ # however, that version might be in a fork so we need to replace the dependency
111
+
112
+ # backup the go.mod and go.sum files to restore them after we run the tests
113
+ cp go.mod go.mod.bak
114
+ cp go.sum go.sum.bak
115
+
116
+ # make sure the examples run against the current version of go-ipfs
117
+ go mod edit -replace github.com/ipfs/go-ipfs=./../../..
118
go mod tidy
119
go test -v ./...
120
+
121
+ # restore the go.mod and go.sum files to their original state
122
+ mv go.mod.bak go.mod
123
+ mv go.sum.bak go.sum
124
working_directory: ~/ipfs/go-ipfs/docs/examples/go-ipfs-as-a-library
125
126
- run: