From ca4b95c28294ec80dcb5bdbc31bfa88bfc65c73c Mon Sep 17 00:00:00 2001 From: galargh Date: Tue, 13 Sep 2022 16:04:32 +0200 Subject: [PATCH 01/60] ci: rewrite circleci jobs as github actions workflows --- .circleci/config.yml | 2 +- .github/workflows/build.yml | 192 +++++++++++++++++++++++++++++ .github/workflows/docker-build.yml | 23 ++++ .github/workflows/gobuild.yml | 34 +++++ .github/workflows/golint.yml | 30 +++++ .github/workflows/gotest.yml | 60 +++++++++ .github/workflows/sharness.yml | 51 ++++++++ 7 files changed, 391 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/docker-build.yml create mode 100644 .github/workflows/gobuild.yml create mode 100644 .github/workflows/golint.yml create mode 100644 .github/workflows/gotest.yml create mode 100644 .github/workflows/sharness.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index a40a162aa18..3da57d24654 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ jobs: executor: continuation/default steps: - checkout - - run: + - run: name: Generate params # for builds on the ipfs/kubo repo, use 2xlarge for faster builds # but since this is not available for many contributors, we otherwise use medium diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000..779bf0f5195 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,192 @@ +on: + workflow_dispatch: + pull_request: + push: + branches: + - 'master' + +jobs: + build: + if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + env: + TEST_NO_DOCKER: 1 + TEST_NO_FUSE: 1 + TEST_VERBOSE: 1 + TRAVIS: 1 + GIT_PAGER: cat + IPFS_CHECK_RCMGR_DEFAULTS: 1 + defaults: + run: + shell: bash + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.19.1 + - uses: actions/checkout@v3 + - uses: protocol/cache-go-action@v1 + with: + name: ${{ github.job }} + - run: make build + - uses: actions/upload-artifact@v3 + with: + name: kubo + path: cmd/ipfs/ipfs + interop: + needs: [build] + runs-on: ubuntu-latest + defaults: + run: + shell: bash + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.19.1 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 + with: + name: kubo + - run: | + echo "::set-output name=dir::$(npm config get cache)" + id: npm-cache-dir + - uses: actions/cache@v3 + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-${{ github.job }}- + - run: | + npm init -y + npm install ipfs@^0.61.0 + npm install ipfs-interop@^8.0.10 + npm install mocha-circleci-reporter@0.0.3 + working-directory: interop + - run: | + mkdir -p /tmp/test-results/interop/ + export MOCHA_FILE="$(mktemp /tmp/test-results/interop/unit.XXXXXX.xml)" + npx ipfs-interop -- -t node -f $(sed -n -e "s|^import '\(.*\)'$|test/\1|p" node_modules/ipfs-interop/test/node.js | circleci tests split --split-by=timings) -- --reporter mocha-circleci-reporter + env: + LIBP2P_TCP_REUSEPORT: false + LIBP2P_ALLOW_WEAK_RSA_KEYS: 1 + IPFS_GO_EXEC: ${{ github.workspace }}/cmd/ipfs/ipfs + working-directory: interop + - uses: actions/upload-artifact@v3 + with: + name: interop + path: /tmp/test-results/**/* + if: always() + go-ipfs-api: + needs: [build] + runs-on: ubuntu-latest + env: + TEST_NO_DOCKER: 1 + TEST_NO_FUSE: 1 + TEST_VERBOSE: 1 + TRAVIS: 1 + GIT_PAGER: cat + IPFS_CHECK_RCMGR_DEFAULTS: 1 + defaults: + run: + shell: bash + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.19.1 + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 + with: + name: kubo + - uses: actions/checkout@v3 + with: + repository: ipfs/go-ipfs-api + path: go-ipfs-api + - run: cmd/ipfs/ipfs daemon --init --enable-namesys-pubsub & + - run: | + while ! cmd/ipfs/ipfs id --api=/ip4/127.0.0.1/tcp/5001 2>/dev/null; do + sleep 1 + done + - uses: protocol/cache-go-action@v1 + with: + name: ${{ github.job }} + - run: go test -count=1 -v ./... + working-directory: go-ipfs-api + - run: cmd/ipfs/ipfs shutdown + if: always() + go-ipfs-http-client: + needs: [build] + runs-on: ubuntu-latest + env: + TEST_NO_DOCKER: 1 + TEST_NO_FUSE: 1 + TEST_VERBOSE: 1 + TRAVIS: 1 + GIT_PAGER: cat + IPFS_CHECK_RCMGR_DEFAULTS: 1 + defaults: + run: + shell: bash + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.19.1 + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 + with: + name: kubo + - uses: actions/checkout@v3 + with: + repository: ipfs/go-ipfs-http-client + path: go-ipfs-http-client + - uses: protocol/cache-go-action@v1 + with: + name: ${{ github.job }} + - run: echo '${{ github.workspace }}/cmd/ipfs' >> $GITHUB_PATH + - run: go test -count=1 -v ./... + ipfs-webui: + needs: [build] + runs-on: ubuntu-latest + env: + NO_SANDBOX: true + LIBP2P_TCP_REUSEPORT: false + LIBP2P_ALLOW_WEAK_RSA_KEYS: 1 + E2E_IPFSD_TYPE: go + TRAVIS: 1 + GIT_PAGER: cat + IPFS_CHECK_RCMGR_DEFAULTS: 1 + defaults: + run: + shell: bash + steps: + - uses: actions/setup-node@v3 + with: + node-version: 16 + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 + with: + name: kubo + - uses: actions/checkout@v3 + with: + repository: ipfs/ipfs-webui + path: ipfs-webui + - run: | + echo "::set-output name=dir::$(npm config get cache)" + id: npm-cache-dir + - uses: actions/cache@v3 + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-${{ github.job }}- + - run: | + npm ci --prefer-offline --no-audit --progress=false + npx playwright install + working-directory: ipfs-webui + - run: npm test + working-directory: ipfs-webui + - run: npm test + env: + IPFS_GO_EXEC: ${{ github.workspace }}/cmd/ipfs/ipfs + working-directory: ipfs-webui diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 00000000000..107166b325d --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,23 @@ +on: + workflow_dispatch: + pull_request: + push: + branches: + - 'master' + +jobs: + docker-build: + if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + env: + IMAGE_NAME: ipfs/kubo + WIP_IMAGE_TAG: wip + defaults: + run: + shell: bash + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.19.1 + - uses: actions/checkout@v3 + - run: docker build -t $IMAGE_NAME:$WIP_IMAGE_TAG . diff --git a/.github/workflows/gobuild.yml b/.github/workflows/gobuild.yml new file mode 100644 index 00000000000..10280c8a40f --- /dev/null +++ b/.github/workflows/gobuild.yml @@ -0,0 +1,34 @@ +on: + workflow_dispatch: + pull_request: + push: + branches: + - 'master' + +jobs: + gobuild: + if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + env: + TEST_NO_DOCKER: 1 + TEST_VERBOSE: 1 + TRAVIS: 1 + GIT_PAGER: cat + IPFS_CHECK_RCMGR_DEFAULTS: 1 + defaults: + run: + shell: bash + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.19.1 + - uses: actions/checkout@v3 + - uses: protocol/cache-go-action@v1 + with: + name: ${{ github.job }} + - run: make cmd/ipfs-try-build + env: + TEST_NO_FUSE: 0 + - run: make cmd/ipfs-try-build + env: + TEST_NO_FUSE: 1 diff --git a/.github/workflows/golint.yml b/.github/workflows/golint.yml new file mode 100644 index 00000000000..fb32862a7f4 --- /dev/null +++ b/.github/workflows/golint.yml @@ -0,0 +1,30 @@ +on: + workflow_dispatch: + pull_request: + push: + branches: + - 'master' + +jobs: + golint: + if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + env: + TEST_NO_DOCKER: 1 + TEST_NO_FUSE: 1 + TEST_VERBOSE: 1 + TRAVIS: 1 + GIT_PAGER: cat + IPFS_CHECK_RCMGR_DEFAULTS: 1 + defaults: + run: + shell: bash + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.19.1 + - uses: actions/checkout@v3 + - uses: protocol/cache-go-action@v1 + with: + name: ${{ github.job }} + - run: make -O test_go_lint diff --git a/.github/workflows/gotest.yml b/.github/workflows/gotest.yml new file mode 100644 index 00000000000..99b462dc80b --- /dev/null +++ b/.github/workflows/gotest.yml @@ -0,0 +1,60 @@ +on: + workflow_dispatch: + pull_request: + push: + branches: + - 'master' + +jobs: + gotest: + if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + env: + TEST_NO_DOCKER: 1 + TEST_NO_FUSE: 1 + TEST_VERBOSE: 1 + TRAVIS: 1 + GIT_PAGER: cat + IPFS_CHECK_RCMGR_DEFAULTS: 1 + defaults: + run: + shell: bash + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.19.1 + - uses: actions/checkout@v3 + - uses: protocol/cache-go-action@v1 + with: + name: ${{ github.job }} + - run: | + make -j 1 test/unit/gotest.junit.xml && + [[ ! $(jq -s -c 'map(select(.Action == "fail")) | .[]' test/unit/gotest.json) ]] + - run: bash <(curl -s https://codecov.io/bash) -cF unittests -X search -f coverage/unit_tests.coverprofile + if: always() + - run: | + # we want to first test with the kubo version in the go.mod file + go test -v ./... + + # we also want to test the examples against the current version of kubo + # 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 kubo + go mod edit -replace github.com/ipfs/kubo=./../../.. + 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: docs/examples/kubo-as-a-library + - uses: actions/upload-artifact@v3 + with: + name: unit + path: test/unit/gotest.junit.xml + if: always() diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml new file mode 100644 index 00000000000..c6a99fecab1 --- /dev/null +++ b/.github/workflows/sharness.yml @@ -0,0 +1,51 @@ +on: + workflow_dispatch: + pull_request: + push: + branches: + - 'master' + +jobs: + sharness: + if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-20.04 + env: + TEST_NO_DOCKER: 0 + TEST_NO_FUSE: 1 + TEST_VERBOSE: 1 + TRAVIS: 1 + GIT_PAGER: cat + IPFS_CHECK_RCMGR_DEFAULTS: 1 + defaults: + run: + shell: bash + steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.19.1 + - uses: actions/checkout@v3 + - run: sudo apt install socat net-tools + - uses: actions/checkout@v3 + with: + repository: ipfs-shipyard/rb-pinning-service-api + ref: 773c3adbb421c551d2d89288abac3e01e1f7c3a8 + path: rb-pinning-service-api + - run: | + (for i in {1..3}; do docker-compose pull && break || sleep 5; done) && + docker-compose up -d + working-directory: rb-pinning-service-api + - uses: protocol/cache-go-action@v1 + with: + name: ${{ github.job }} + - run: echo "TEST_DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" >> $GITHUB_ENV + - run: | + echo TEST_DOCKER_HOST=$TEST_DOCKER_HOST && + make -O -j << pipeline.parameters.make_jobs >> coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml TEST_GENERATE_JUNIT=1 CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST + - run: bash <(curl -s https://codecov.io/bash) -cF sharness -X search -f coverage/sharness_tests.coverprofile + if: always() + - run: find test/sharness/test-results -name 't*-*.sh.*.counts' | test/sharness/lib/sharness/aggregate-results.sh | grep 'failed\s*0' + - uses: actions/upload-artifact@v3 + with: + name: sharness + path: test/sharness/test-results/sharness.xml + if: always() From c3a64b866ec08d9b4a8e481c261d5a7c15ffe82b Mon Sep 17 00:00:00 2001 From: galargh Date: Tue, 13 Sep 2022 16:42:13 +0200 Subject: [PATCH 02/60] ci: fix build.yml --- .github/workflows/build.yml | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 779bf0f5195..dfbc4a26ade 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,16 +39,14 @@ jobs: run: shell: bash steps: - - uses: actions/setup-go@v3 - with: - go-version: 1.19.1 - uses: actions/setup-node@v3 with: - node-version: 16 - - uses: actions/checkout@v3 + node-version: 16.12.0 - uses: actions/download-artifact@v3 with: name: kubo + path: cmd/ipfs + - run: chmod +x cmd/ipfs/ipfs - run: | echo "::set-output name=dir::$(npm config get cache)" id: npm-cache-dir @@ -58,26 +56,19 @@ jobs: key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-${{ github.job }}- + - run: mkdir interop - run: | npm init -y npm install ipfs@^0.61.0 npm install ipfs-interop@^8.0.10 npm install mocha-circleci-reporter@0.0.3 working-directory: interop - - run: | - mkdir -p /tmp/test-results/interop/ - export MOCHA_FILE="$(mktemp /tmp/test-results/interop/unit.XXXXXX.xml)" - npx ipfs-interop -- -t node -f $(sed -n -e "s|^import '\(.*\)'$|test/\1|p" node_modules/ipfs-interop/test/node.js | circleci tests split --split-by=timings) -- --reporter mocha-circleci-reporter + - run: npx ipfs-interop env: LIBP2P_TCP_REUSEPORT: false LIBP2P_ALLOW_WEAK_RSA_KEYS: 1 IPFS_GO_EXEC: ${{ github.workspace }}/cmd/ipfs/ipfs working-directory: interop - - uses: actions/upload-artifact@v3 - with: - name: interop - path: /tmp/test-results/**/* - if: always() go-ipfs-api: needs: [build] runs-on: ubuntu-latest @@ -95,10 +86,11 @@ jobs: - uses: actions/setup-go@v3 with: go-version: 1.19.1 - - uses: actions/checkout@v3 - uses: actions/download-artifact@v3 with: name: kubo + path: cmd/ipfs + - run: chmod +x cmd/ipfs/ipfs - uses: actions/checkout@v3 with: repository: ipfs/go-ipfs-api @@ -108,6 +100,7 @@ jobs: while ! cmd/ipfs/ipfs id --api=/ip4/127.0.0.1/tcp/5001 2>/dev/null; do sleep 1 done + timeout-minutes: 5 - uses: protocol/cache-go-action@v1 with: name: ${{ github.job }} @@ -132,10 +125,11 @@ jobs: - uses: actions/setup-go@v3 with: go-version: 1.19.1 - - uses: actions/checkout@v3 - uses: actions/download-artifact@v3 with: name: kubo + path: cmd/ipfs + - run: chmod +x cmd/ipfs/ipfs - uses: actions/checkout@v3 with: repository: ipfs/go-ipfs-http-client @@ -145,6 +139,7 @@ jobs: name: ${{ github.job }} - run: echo '${{ github.workspace }}/cmd/ipfs' >> $GITHUB_PATH - run: go test -count=1 -v ./... + working-directory: go-ipfs-http-client ipfs-webui: needs: [build] runs-on: ubuntu-latest @@ -162,11 +157,12 @@ jobs: steps: - uses: actions/setup-node@v3 with: - node-version: 16 - - uses: actions/checkout@v3 + node-version: 16.12.0 - uses: actions/download-artifact@v3 with: name: kubo + path: cmd/ipfs + - run: chmod +x cmd/ipfs/ipfs - uses: actions/checkout@v3 with: repository: ipfs/ipfs-webui From 08cba85a97354f67cacbc30ffbb1c9e5864d0a15 Mon Sep 17 00:00:00 2001 From: galargh Date: Tue, 13 Sep 2022 17:01:01 +0200 Subject: [PATCH 03/60] ci: fix sharness.yml --- .github/workflows/sharness.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index c6a99fecab1..a40dbb7505b 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -24,12 +24,17 @@ jobs: with: go-version: 1.19.1 - uses: actions/checkout@v3 + with: + path: kubo - run: sudo apt install socat net-tools - uses: actions/checkout@v3 with: repository: ipfs-shipyard/rb-pinning-service-api ref: 773c3adbb421c551d2d89288abac3e01e1f7c3a8 path: rb-pinning-service-api + - uses: protocol/cache-go-action@v1 + with: + name: ${{ github.job }} - run: | (for i in {1..3}; do docker-compose pull && break || sleep 5; done) && docker-compose up -d @@ -40,12 +45,15 @@ jobs: - run: echo "TEST_DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" >> $GITHUB_ENV - run: | echo TEST_DOCKER_HOST=$TEST_DOCKER_HOST && - make -O -j << pipeline.parameters.make_jobs >> coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml TEST_GENERATE_JUNIT=1 CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST - - run: bash <(curl -s https://codecov.io/bash) -cF sharness -X search -f coverage/sharness_tests.coverprofile + make -O -j "${MAKE_JOBS}" >> coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml TEST_GENERATE_JUNIT=1 CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST + env: + MAKE_JOBS: 3 + working-directory: kubo + - run: bash <(curl -s https://codecov.io/bash) -cF sharness -X search -f kubo/coverage/sharness_tests.coverprofile if: always() - - run: find test/sharness/test-results -name 't*-*.sh.*.counts' | test/sharness/lib/sharness/aggregate-results.sh | grep 'failed\s*0' + - run: find kubo/test/sharness/test-results -name 't*-*.sh.*.counts' | kubo/test/sharness/lib/sharness/aggregate-results.sh | grep 'failed\s*0' - uses: actions/upload-artifact@v3 with: name: sharness - path: test/sharness/test-results/sharness.xml + path: kubo/test/sharness/test-results/sharness.xml if: always() From f6fbe341d4d1d3290761d5fbdfd54ab02fb83f73 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 14 Sep 2022 12:27:42 +0200 Subject: [PATCH 04/60] ci: add sleep in twonode test to hide flakiness --- test/sharness/t0125-twonode.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/sharness/t0125-twonode.sh b/test/sharness/t0125-twonode.sh index 6f819400aba..aaf53cbfb80 100755 --- a/test/sharness/t0125-twonode.sh +++ b/test/sharness/t0125-twonode.sh @@ -83,6 +83,12 @@ run_advanced_test() { test_expect_success "shut down nodes" ' iptb stop && iptb_wait_stop ' + + # NOTE: data transferred stats checks are flaky + # trying to debug them by printing out the stats hides the flakiness + # my theory is that the extra time cat calls take to print out the stats + # allow for proper cleanup to happen + go-sleep 1s } test_expect_success "set up tcp testbed" ' From d873053893685a18665453ecdf465b64bea5b873 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 14 Sep 2022 13:29:02 +0200 Subject: [PATCH 05/60] ci: update codecov setup --- .github/workflows/gotest.yml | 5 ++++- .github/workflows/sharness.yml | 5 ++++- codecov.yml | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gotest.yml b/.github/workflows/gotest.yml index 99b462dc80b..6ca2ed6be2c 100644 --- a/.github/workflows/gotest.yml +++ b/.github/workflows/gotest.yml @@ -30,8 +30,11 @@ jobs: - run: | make -j 1 test/unit/gotest.junit.xml && [[ ! $(jq -s -c 'map(select(.Action == "fail")) | .[]' test/unit/gotest.json) ]] - - run: bash <(curl -s https://codecov.io/bash) -cF unittests -X search -f coverage/unit_tests.coverprofile + - uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 if: always() + with: + name: unittests + files: coverage/unit_tests.coverprofile - run: | # we want to first test with the kubo version in the go.mod file go test -v ./... diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index a40dbb7505b..dfccfc6d8ea 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -49,8 +49,11 @@ jobs: env: MAKE_JOBS: 3 working-directory: kubo - - run: bash <(curl -s https://codecov.io/bash) -cF sharness -X search -f kubo/coverage/sharness_tests.coverprofile + - uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 if: always() + with: + name: sharness + files: kubo/coverage/sharness_tests.coverprofile - run: find kubo/test/sharness/test-results -name 't*-*.sh.*.counts' | kubo/test/sharness/lib/sharness/aggregate-results.sh | grep 'failed\s*0' - uses: actions/upload-artifact@v3 with: diff --git a/codecov.yml b/codecov.yml index 71f7741477a..f6d4fc05b4d 100644 --- a/codecov.yml +++ b/codecov.yml @@ -4,6 +4,7 @@ codecov: - "!travis-ci.org" - "!ci.ipfs.team:8111" - "!ci.ipfs.team" + - "!github.com" notify: require_ci_to_pass: no after_n_builds: 2 From 265cc78dec31a75111591b260c4f274d69d2029b Mon Sep 17 00:00:00 2001 From: galargh Date: Fri, 23 Sep 2022 14:53:16 +0200 Subject: [PATCH 06/60] feat: run heavy worfklows on self-hosted runners --- .github/workflows/gobuild.yml | 7 +++++-- .github/workflows/runner.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/sharness.yml | 10 ++++++---- 3 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/runner.yml diff --git a/.github/workflows/gobuild.yml b/.github/workflows/gobuild.yml index 10280c8a40f..698b0310969 100644 --- a/.github/workflows/gobuild.yml +++ b/.github/workflows/gobuild.yml @@ -6,9 +6,12 @@ on: - 'master' jobs: - gobuild: + runner: if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest + uses: galorgh/kubo/.github/workflows/runner.yml@github-actions + gobuild: + needs: [runner] + runs-on: ${{ needs.runner.outputs.config.labels }} env: TEST_NO_DOCKER: 1 TEST_VERBOSE: 1 diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml new file mode 100644 index 00000000000..7ce5ff75035 --- /dev/null +++ b/.github/workflows/runner.yml @@ -0,0 +1,29 @@ +on: + workflow_call: + outputs: + config: + description: "The runner's configuration" + value: ${{ jobs.runner.outputs.config }} + +jobs: + runner: + runs-on: ubuntu-latest + outputs: + config: ${{ steps.runner.outputs.result }} + steps: + - uses: actions/github-script@v6 + id: config + with: + script: | + const repo = context.repo() + if (`${repo.owner}/${repo.repo}` === 'ipfs/kubo') { + return { + labels: ['self-hosted', 'linux', 'x64', 'kubo'], + parallel: 10 + } + } else { + return { + labels: ['ubuntu-latest'], + parallel: 3 + } + } diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index dfccfc6d8ea..ad1d27603bd 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -6,9 +6,13 @@ on: - 'master' jobs: + runner: + if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' + uses: galorgh/kubo/.github/workflows/runner.yml@github-actions sharness: + needs: [runner] if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' - runs-on: ubuntu-20.04 + runs-on: ${{ needs.runner.outputs.config.labels }} env: TEST_NO_DOCKER: 0 TEST_NO_FUSE: 1 @@ -45,9 +49,7 @@ jobs: - run: echo "TEST_DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" >> $GITHUB_ENV - run: | echo TEST_DOCKER_HOST=$TEST_DOCKER_HOST && - make -O -j "${MAKE_JOBS}" >> coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml TEST_GENERATE_JUNIT=1 CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST - env: - MAKE_JOBS: 3 + make -O -j '${{ needs.runner.outputs.config.parallel }}' >> coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml TEST_GENERATE_JUNIT=1 CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST working-directory: kubo - uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 if: always() From a5a841354e85305a71d92778cba3dc505d9d9961 Mon Sep 17 00:00:00 2001 From: galargh Date: Fri, 23 Sep 2022 14:59:51 +0200 Subject: [PATCH 07/60] fix: runner.yml --- .github/workflows/runner.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml index 7ce5ff75035..1e8b531eaca 100644 --- a/.github/workflows/runner.yml +++ b/.github/workflows/runner.yml @@ -15,8 +15,7 @@ jobs: id: config with: script: | - const repo = context.repo() - if (`${repo.owner}/${repo.repo}` === 'ipfs/kubo') { + if (`${context.repo.owner}/${context.repo.repo}` === 'ipfs/kubo') { return { labels: ['self-hosted', 'linux', 'x64', 'kubo'], parallel: 10 From 33bb8682da0958112f866faf7b755cfb15118950 Mon Sep 17 00:00:00 2001 From: galargh Date: Fri, 23 Sep 2022 15:20:33 +0200 Subject: [PATCH 08/60] fix: runner.yml --- .github/workflows/gobuild.yml | 2 +- .github/workflows/runner.yml | 3 ++- .github/workflows/sharness.yml | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gobuild.yml b/.github/workflows/gobuild.yml index 698b0310969..0125dbd0612 100644 --- a/.github/workflows/gobuild.yml +++ b/.github/workflows/gobuild.yml @@ -11,7 +11,7 @@ jobs: uses: galorgh/kubo/.github/workflows/runner.yml@github-actions gobuild: needs: [runner] - runs-on: ${{ needs.runner.outputs.config.labels }} + runs-on: ${{ fromJSON(needs.runner.outputs.config).labels }} env: TEST_NO_DOCKER: 1 TEST_VERBOSE: 1 diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml index 1e8b531eaca..54b70c20ec3 100644 --- a/.github/workflows/runner.yml +++ b/.github/workflows/runner.yml @@ -9,7 +9,7 @@ jobs: runner: runs-on: ubuntu-latest outputs: - config: ${{ steps.runner.outputs.result }} + config: ${{ steps.config.outputs.result }} steps: - uses: actions/github-script@v6 id: config @@ -26,3 +26,4 @@ jobs: parallel: 3 } } + - run: echo ${{ steps.config.outputs.result }} diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index ad1d27603bd..9a248be075e 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -12,7 +12,7 @@ jobs: sharness: needs: [runner] if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' - runs-on: ${{ needs.runner.outputs.config.labels }} + runs-on: ${{ fromJSON(needs.runner.outputs.config).labels }} env: TEST_NO_DOCKER: 0 TEST_NO_FUSE: 1 @@ -49,7 +49,7 @@ jobs: - run: echo "TEST_DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" >> $GITHUB_ENV - run: | echo TEST_DOCKER_HOST=$TEST_DOCKER_HOST && - make -O -j '${{ needs.runner.outputs.config.parallel }}' >> coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml TEST_GENERATE_JUNIT=1 CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST + make -O -j '${{ fromJSON(needs.runner.outputs.config).parallel }}' >> coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml TEST_GENERATE_JUNIT=1 CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST working-directory: kubo - uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 if: always() From abebd9c109f758c2eb3b9e7a85d9516d9b6d53a2 Mon Sep 17 00:00:00 2001 From: galargh Date: Fri, 23 Sep 2022 18:13:49 +0200 Subject: [PATCH 09/60] fix: sharness.yml --- .github/workflows/sharness.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 9a248be075e..512cf73c207 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -11,7 +11,6 @@ jobs: uses: galorgh/kubo/.github/workflows/runner.yml@github-actions sharness: needs: [runner] - if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' runs-on: ${{ fromJSON(needs.runner.outputs.config).labels }} env: TEST_NO_DOCKER: 0 From 9794042ebd8ac5adb92473f1defee5cac3453365 Mon Sep 17 00:00:00 2001 From: galargh Date: Fri, 23 Sep 2022 18:34:04 +0200 Subject: [PATCH 10/60] fix: sharness.yml --- .github/workflows/sharness.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 512cf73c207..8f07c734c80 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -38,9 +38,10 @@ jobs: - uses: protocol/cache-go-action@v1 with: name: ${{ github.job }} + # check if docker compose (not docker-compose) is available on default gh runners - run: | - (for i in {1..3}; do docker-compose pull && break || sleep 5; done) && - docker-compose up -d + (for i in {1..3}; do docker compose pull && break || sleep 5; done) && + docker compose up -d working-directory: rb-pinning-service-api - uses: protocol/cache-go-action@v1 with: From 2503b834e3db133548cf66ff56864c949cc05770 Mon Sep 17 00:00:00 2001 From: galargh Date: Fri, 23 Sep 2022 20:45:15 +0200 Subject: [PATCH 11/60] feat: include junit in upload --- .github/workflows/sharness.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 8f07c734c80..979fb465d37 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -60,5 +60,7 @@ jobs: - uses: actions/upload-artifact@v3 with: name: sharness - path: kubo/test/sharness/test-results/sharness.xml + path: | + kubo/test/sharness/test-results/sharness.xml + .junit if: always() From 78ee0da4564044bb7736d832e9623be8f2f92363 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 28 Sep 2022 13:50:41 +0200 Subject: [PATCH 12/60] feat: upgrade sharness and add JUnit HTML reporting --- .circleci/main.yml | 2 +- .github/workflows/sharness.yml | 2 +- test/sharness/.gitignore | 1 + test/sharness/README.md | 2 +- test/sharness/Rules.mk | 15 +- .../0001-Generate-partial-JUnit-reports.patch | 250 ------------------ test/sharness/lib/gen-junit-report.sh | 8 - test/sharness/lib/install-sharness.sh | 64 ++--- .../lib/test-aggregate-junit-reports.sh | 17 ++ test/sharness/lib/test-generate-junit-html.sh | 47 ++++ test/sharness/lib/test-lib.sh | 3 +- 11 files changed, 109 insertions(+), 302 deletions(-) delete mode 100644 test/sharness/lib/0001-Generate-partial-JUnit-reports.patch delete mode 100755 test/sharness/lib/gen-junit-report.sh create mode 100755 test/sharness/lib/test-aggregate-junit-reports.sh create mode 100755 test/sharness/lib/test-generate-junit-html.sh diff --git a/.circleci/main.yml b/.circleci/main.yml index efae6d94587..b45a17588b9 100644 --- a/.circleci/main.yml +++ b/.circleci/main.yml @@ -184,7 +184,7 @@ jobs: command: echo "export TEST_DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" >> $BASH_ENV - run: echo TEST_DOCKER_HOST=$TEST_DOCKER_HOST && - make -O -j << pipeline.parameters.make_jobs >> coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml TEST_GENERATE_JUNIT=1 CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST + make -O -j << pipeline.parameters.make_jobs >> test_sharness_expensive coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST - run: when: always command: bash <(curl -s https://codecov.io/bash) -cF sharness -X search -f coverage/sharness_tests.coverprofile diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 979fb465d37..a4da0a07d3a 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -49,7 +49,7 @@ jobs: - run: echo "TEST_DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" >> $GITHUB_ENV - run: | echo TEST_DOCKER_HOST=$TEST_DOCKER_HOST && - make -O -j '${{ fromJSON(needs.runner.outputs.config).parallel }}' >> coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml TEST_GENERATE_JUNIT=1 CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST + make -O -j '${{ fromJSON(needs.runner.outputs.config).parallel }}' >> test_sharness_expensive coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml test/sharness/test-results/sharness.html CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST working-directory: kubo - uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 if: always() diff --git a/test/sharness/.gitignore b/test/sharness/.gitignore index c7ab08146c5..0a47783a7ee 100644 --- a/test/sharness/.gitignore +++ b/test/sharness/.gitignore @@ -1,4 +1,5 @@ lib/sharness/ +lib/dependencies/ test-results/ trash directory.*.sh/ plugins diff --git a/test/sharness/README.md b/test/sharness/README.md index 16cb508c137..9358fcf9caf 100644 --- a/test/sharness/README.md +++ b/test/sharness/README.md @@ -1,4 +1,4 @@ -# ipfs whole tests using the [sharness framework](https://github.com/mlafeldt/sharness/) +# ipfs whole tests using the [sharness framework](https://github.com/pl-strflt/sharness/tree/feat/junit) ## Running all the tests diff --git a/test/sharness/Rules.mk b/test/sharness/Rules.mk index 49e41824c3f..7cc36bd421a 100644 --- a/test/sharness/Rules.mk +++ b/test/sharness/Rules.mk @@ -43,9 +43,20 @@ $(d)/aggregate: $(T_$(d)) .PHONY: $(d)/aggregate $(d)/test-results/sharness.xml: export TEST_GENERATE_JUNIT=1 -$(d)/test-results/sharness.xml: test_sharness_expensive +$(d)/test-results/sharness.xml: $(T_$(d)) @echo "*** $@ ***" - @(cd $(@D)/.. && ./lib/gen-junit-report.sh) + @(cd $(@D)/.. && ./lib/test-aggregate-junit-reports.sh) +.PHONY: $(d)/test-results/sharness.xml + +$(d)/test-results/sharness-html: $(d)/test-results/sharness.xml + @echo "*** $@ ***" + @(cd $(@D)/.. && ./lib/test-generate-junit-html.sh frames) +.PHONY: $(d)/test-results/sharness-html + +$(d)/test-results/sharness.html: $(d)/test-results/sharness.xml + @echo "*** $@ ***" + @(cd $(@D)/.. && ./lib/test-generate-junit-html.sh no-frames) +.PHONY: $(d)/test-results/sharness.html $(d)/clean-test-results: rm -rf $(@D)/test-results diff --git a/test/sharness/lib/0001-Generate-partial-JUnit-reports.patch b/test/sharness/lib/0001-Generate-partial-JUnit-reports.patch deleted file mode 100644 index 1a8b5f21b6e..00000000000 --- a/test/sharness/lib/0001-Generate-partial-JUnit-reports.patch +++ /dev/null @@ -1,250 +0,0 @@ -From bc6bf844ef4e4cd468bc1ec96f2d6af738eb8d2f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C5=81ukasz=20Magiera?= -Date: Sat, 21 Apr 2018 22:01:45 +0200 -Subject: [PATCH] Generate partial JUnit reports - ---- - sharness.sh | 114 +++++++++++++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 108 insertions(+), 6 deletions(-) - -diff --git a/sharness.sh b/sharness.sh -index 6750ff7..336e426 100644 ---- a/sharness.sh -+++ b/sharness.sh -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!/usr/bin/env bash - # - # Copyright (c) 2011-2012 Mathias Lafeldt - # Copyright (c) 2005-2012 Git project -@@ -106,6 +106,10 @@ if test -n "$color"; then - test -n "$quiet" && return;; - esac - shift -+ -+ if test -n "$TEST_GENERATE_JUNIT"; then -+ echo "$*" >> .junit/tout -+ fi - printf "%s" "$*" - tput sgr0 - echo -@@ -115,6 +119,10 @@ else - say_color() { - test -z "$1" && test -n "$quiet" && return - shift -+ -+ if test -n "$TEST_GENERATE_JUNIT"; then -+ echo "$*" >> .junit/tout -+ fi - printf "%s\n" "$*" - } - fi -@@ -129,6 +137,12 @@ say() { - say_color info "$*" - } - -+esc=$(printf '\033') -+ -+esc_xml() { -+ sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"$esc"'//g; s///g;' -+} -+ - test -n "$test_description" || error "Test script did not set test_description." - - if test "$help" = "t"; then -@@ -251,30 +265,78 @@ test_have_prereq() { - test $total_prereq = $ok_prereq - } - -+# junit_testcase generates a testcase xml file after each test -+ -+junit_testcase() { -+ if test -z "$TEST_GENERATE_JUNIT"; then -+ return -+ fi -+ -+ test_name=$1 -+ tc_file=".junit/case-$(printf "%04d" $test_count)" -+ time_sec="$(cat .junit/time | xargs printf '%04d' | sed -e 's/\(...\)$/.\1/g')" -+ -+ echo "$(expr $(cat .junit/time_total) + $(cat .junit/time) )" > .junit/time_total -+ -+ shift -+ cat > "$tc_file" <<-EOF -+ -+ $@ -+ EOF -+ -+ if test -f .junit/tout; then -+ cat >> "$tc_file" <<-EOF -+ -+ $(cat .junit/tout | esc_xml) -+ -+ EOF -+ fi -+ -+ if test -f .junit/terr; then -+ cat >> "$tc_file" <<-EOF -+ -+ $(cat .junit/terr | esc_xml) -+ -+ EOF -+ fi -+ -+ echo "" >> "$tc_file" -+ rm -f .junit/tout .junit/terr .junit/time -+} -+ - # You are not expected to call test_ok_ and test_failure_ directly, use - # the text_expect_* functions instead. - - test_ok_() { - test_success=$(($test_success + 1)) - say_color "" "ok $test_count - $@" -+ -+ junit_testcase "$@" - } - - test_failure_() { - test_failure=$(($test_failure + 1)) - say_color error "not ok $test_count - $1" -+ test_name=$1 - shift - echo "$@" | sed -e 's/^/# /' -+ junit_testcase "$test_name" ''$(echo $@ | esc_xml)'' -+ - test "$immediate" = "" || { EXIT_OK=t; exit 1; } - } - - test_known_broken_ok_() { - test_fixed=$(($test_fixed + 1)) - say_color error "ok $test_count - $@ # TODO known breakage vanished" -+ -+ junit_testcase "$@" '' - } - - test_known_broken_failure_() { - test_broken=$(($test_broken + 1)) - say_color warn "not ok $test_count - $@ # TODO known breakage" -+ -+ junit_testcase "$@" - } - - # Public: Execute commands in debug mode. -@@ -310,15 +372,25 @@ test_pause() { - test_eval_() { - # This is a separate function because some tests use - # "return" to end a test_expect_success block early. -- eval &3 2>&4 "$*" -+ if test -n "$TEST_GENERATE_JUNIT"; then -+ eval >(tee -a .junit/tout >&3) 2> >(tee -a .junit/terr >&4) "$*" -+ else -+ eval &3 2>&4 "$*" -+ fi - } - - test_run_() { - test_cleanup=: - expecting_failure=$2 -+ -+ start_time_ms=$(date "+%s%3N"); - test_eval_ "$1" - eval_ret=$? - -+ if test -n "$TEST_GENERATE_JUNIT"; then -+ echo $(expr $(date "+%s%3N") - ${start_time_ms} ) > .junit/time; -+ fi -+ - if test "$chain_lint" = "t"; then - test_eval_ "(exit 117) && $1" - if test "$?" != 117; then -@@ -355,8 +427,18 @@ test_skip_() { - of_prereq=" of $test_prereq" - fi - -- say_color skip >&3 "skipping test: $@" -- say_color skip "ok $test_count # skip $1 (missing $missing_prereq${of_prereq})" -+ say_color skip >&3 "skipping test: $1" -+ say_color skip "ok $test_count # skip $1 (missing $missing_prereqm${of_prereq})" -+ -+ if test -n "$TEST_GENERATE_JUNIT"; then -+ cat > ".junit/case-$(printf "%04d" $test_count)" <<-EOF -+ -+ -+ skip $(echo $1 | esc_xml) (missing $missing_prereq${of_prereq}) -+ -+ -+ EOF -+ fi - : true - ;; - *) -@@ -403,7 +485,7 @@ test_expect_success() { - test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq= - test "$#" = 2 || error "bug in the test script: not 2 or 3 parameters to test_expect_success" - export test_prereq -- if ! test_skip_ "$@"; then -+ if ! test_skip_ "$@" "$1"; then - say >&3 "expecting success: $2" - if test_run_ "$2"; then - test_ok_ "$1" -@@ -442,7 +524,7 @@ test_expect_failure() { - test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq= - test "$#" = 2 || error "bug in the test script: not 2 or 3 parameters to test_expect_failure" - export test_prereq -- if ! test_skip_ "$@"; then -+ if ! test_skip_ "$@" "$1"; then - say >&3 "checking known breakage: $2" - if test_run_ "$2" expecting_failure; then - test_known_broken_ok_ "$1" -@@ -675,6 +757,7 @@ test_done() { - test_results_dir="$SHARNESS_TEST_DIRECTORY/test-results" - mkdir -p "$test_results_dir" - test_results_path="$test_results_dir/${SHARNESS_TEST_FILE%.$SHARNESS_TEST_EXTENSION}.$$.counts" -+ junit_results_path="$test_results_dir/${SHARNESS_TEST_FILE%.$SHARNESS_TEST_EXTENSION}.$$.xml.part" - - cat >>"$test_results_path" <<-EOF - total $test_count -@@ -684,6 +767,16 @@ test_done() { - failed $test_failure - - EOF -+ -+ if test -n "$TEST_GENERATE_JUNIT"; then -+ time_sec="$(cat .junit/time_total | xargs printf "%04d" | sed -e 's/\(...\)$/.\1/g')" -+ -+ cat >>"$junit_results_path" <<-EOF -+ -+ $(find .junit -name 'case-*' | sort | xargs cat) -+ -+ EOF -+ fi - fi - - if test "$test_fixed" != 0; then -@@ -745,6 +838,9 @@ export PATH SHARNESS_BUILD_DIRECTORY - SHARNESS_TEST_FILE="$0" - export SHARNESS_TEST_FILE - -+SHARNESS_TEST_NAME=$(basename ${SHARNESS_TEST_FILE} ".sh") -+export SHARNESS_TEST_NAME -+ - # Prepare test area. - test_dir="trash directory.$(basename "$SHARNESS_TEST_FILE" ".$SHARNESS_TEST_EXTENSION")" - test -n "$root" && test_dir="$root/$test_dir" -@@ -771,6 +867,12 @@ mkdir -p "$test_dir" || exit 1 - # in subprocesses like git equals our $PWD (for pathname comparisons). - cd -P "$test_dir" || exit 1 - -+# Prepare JUnit report dir -+if test -n "$TEST_GENERATE_JUNIT"; then -+ mkdir -p .junit -+ echo 0 > .junit/time_total -+fi -+ - this_test=${SHARNESS_TEST_FILE##*/} - this_test=${this_test%.$SHARNESS_TEST_EXTENSION} - for skp in $SKIP_TESTS; do --- -2.17.0 - diff --git a/test/sharness/lib/gen-junit-report.sh b/test/sharness/lib/gen-junit-report.sh deleted file mode 100755 index c69f39adb0e..00000000000 --- a/test/sharness/lib/gen-junit-report.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -cat > test-results/sharness.xml <<-EOF - - - $(find test-results -name '*.xml.part' | sort | xargs cat) - -EOF diff --git a/test/sharness/lib/install-sharness.sh b/test/sharness/lib/install-sharness.sh index ac6cb2f74c3..30b04401fca 100755 --- a/test/sharness/lib/install-sharness.sh +++ b/test/sharness/lib/install-sharness.sh @@ -1,60 +1,50 @@ #!/bin/sh # install sharness.sh # -# Copyright (c) 2014 Juan Batiz-Benet +# Copyright (c) 2014, 2022 Juan Batiz-Benet, Piotr Galar # MIT Licensed; see the LICENSE file in this repository. # -# settings -version=5eee9b51b5621cec95a64018f0cc779963b230d2 -patch_version=17 +gitrepo=pl-strflt/sharness +githash=bca94f668688e5dc63b13d806ad4adcd5650bab2 -urlprefix=https://github.com/mlafeldt/sharness.git if test ! -n "$clonedir" ; then clonedir=lib fi sharnessdir=sharness - -if test -f "$clonedir/$sharnessdir/SHARNESS_VERSION_${version}_p${patch_version}" -then - # There is the right version file. Great, we are done! - exit 0 -fi +gitdir="$clonedir/$sharnessdir/.git" die() { echo >&2 "$@" exit 1 } -apply_patches() { - git config --local user.email "noone@nowhere" - git config --local user.name "No One" - git am ../0001-Generate-partial-JUnit-reports.patch +if test -d "$clonedir/$sharnessdir"; then + giturl="git@github.com:${gitrepo}.git" + echo "Checking if $giturl is already cloned (and if its origin is correct)" + if ! test -d "$gitdir" || test "$(git --git-dir "$gitdir" remote get-url origin)" != "$giturl"; then + echo "Removing $clonedir/$sharnessdir" + rm -rf "$clonedir/$sharnessdir" || die "Could not remove $clonedir/$sharnessdir" + fi +fi - touch "SHARNESS_VERSION_${version}_p${patch_version}" || die "Could not create 'SHARNESS_VERSION_${version}_p${patch_version}'" -} +if ! test -d "$clonedir/$sharnessdir"; then + giturl="https://github.com/${gitrepo}.git" + echo "Cloning $giturl into $clonedir/$sharnessdir" + git clone "$giturl" "$clonedir/$sharnessdir" || die "Could not clone $giturl into $clonedir/$sharnessdir" +fi -checkout_version() { - git checkout "$version" || die "Could not checkout '$version'" - rm -f SHARNESS_VERSION_* || die "Could not remove 'SHARNESS_VERSION_*'" - echo "Sharness version $version is checked out!" - apply_patches -} +echo "Changing directory to $clonedir/$sharnessdir" +cd "$clonedir/$sharnessdir" || die "Could not cd into '$clonedir/$sharnessdir' directory" -if test -d "$clonedir/$sharnessdir/.git" -then - # We need to update sharness! - cd "$clonedir/$sharnessdir" || die "Could not cd into '$clonedir/$sharnessdir' directory" - git fetch || die "Could not fetch to update sharness" - checkout_version -else - # We need to clone sharness! - mkdir -p "$clonedir" || die "Could not create '$clonedir' directory" - cd "$clonedir" || die "Could not cd into '$clonedir' directory" - - git clone "$urlprefix" || die "Could not clone '$urlprefix'" - cd "$sharnessdir" || die "Could not cd into '$sharnessdir' directory" - checkout_version +echo "Checking if $githash is already fetched" +if ! git show "$githash" >/dev/null 2>&1; then + echo "Fetching $githash" + git fetch origin "$githash" || die "Could not fetch $githash" fi + +echo "Resetting to $githash" +git reset --hard "$githash" || die "Could not reset to $githash" + exit 0 diff --git a/test/sharness/lib/test-aggregate-junit-reports.sh b/test/sharness/lib/test-aggregate-junit-reports.sh new file mode 100755 index 00000000000..ad39e5668f8 --- /dev/null +++ b/test/sharness/lib/test-aggregate-junit-reports.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Script to aggregate results using Sharness +# +# Copyright (c) 2014, 2022 Christian Couder, Piotr Galar +# MIT Licensed; see the LICENSE file in this repository. +# + +SHARNESS_AGGREGATE_JUNIT="lib/sharness/aggregate-junit-reports.sh" + +test -f "$SHARNESS_AGGREGATE_JUNIT" || { + echo >&2 "Cannot find: $SHARNESS_AGGREGATE_JUNIT" + echo >&2 "Please check Sharness installation." + exit 1 +} + +ls test-results/t*-*.sh.*.xml.part | "$SHARNESS_AGGREGATE_JUNIT" > test-results/sharness.xml diff --git a/test/sharness/lib/test-generate-junit-html.sh b/test/sharness/lib/test-generate-junit-html.sh new file mode 100755 index 00000000000..22ebfbed8f4 --- /dev/null +++ b/test/sharness/lib/test-generate-junit-html.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +dependencies=( + "url=https://repo1.maven.org/maven2/net/sf/saxon/Saxon-HE/11.4/Saxon-HE-11.4.jar;md5=9f35652962ffe9b687fb7e3726600f03" + "url=https://raw.githubusercontent.com/pl-strflt/ant/2b021a50901ada753a3b62d1f90e5785b1f2beb1/src/etc/junit-frames-saxon.xsl;md5=f4c6f8912a45a9cf272fa1909720c316" + "url=https://raw.githubusercontent.com/pl-strflt/ant/2b021a50901ada753a3b62d1f90e5785b1f2beb1/src/etc/junit-noframes-saxon.xsl;md5=dd3d96f8a8cce4c386bfa017e948ad57" +) + +dependenciesdir="lib/dependencies" +mkdir -p "$dependenciesdir" + +for dependency in "${dependencies[@]}"; do + url="$(echo "$dependency" | cut -d ';' -f 1 | cut -d '=' -f 2)" + md5="$(echo "$dependency" | cut -d ';' -f 2 | cut -d '=' -f 2)" + filename="$(basename "$url")" + if test -f "$dependenciesdir/$filename" && test "$(md5sum "$dependenciesdir/$filename" | cut -d ' ' -f 1)" = "$md5"; then + echo "Using cached $filename" + else + echo "Downloading $filename" + curl --retry 5 --no-progress-meter --output "$dependenciesdir/$filename" "$url" + if test "$(md5sum "$dependenciesdir/$filename" | cut -d ' ' -f 1)" != "$md5"; then + echo "$(md5sum "$dependenciesdir/$filename" | cut -d ' ' -f 1)" + echo "$md5" + echo "Downloaded $filename has wrong md5sum" + exit 1 + fi + fi +done + +case "$1" in + "frames") + java -jar lib/saxon/saxon-he-11.4.jar \ + -s:test-results/sharness.xml \ + -xsl:lib/ant/junit-frames-saxon.xsl \ + output.dir=test-results/sharness-html + ;; + "no-frames") + java -jar lib/saxon/saxon-he-11.4.jar \ + -s:test-results/sharness.xml \ + -xsl:lib/ant/junit-noframes-saxon.xsl \ + -o:test-results/sharness.html + ;; + *) + echo "Usage: $0 [frames|no-frames]" + exit 1 + ;; +esac diff --git a/test/sharness/lib/test-lib.sh b/test/sharness/lib/test-lib.sh index 0757c323cf9..ecbe38249f1 100644 --- a/test/sharness/lib/test-lib.sh +++ b/test/sharness/lib/test-lib.sh @@ -3,7 +3,7 @@ # Copyright (c) 2014 Christian Couder # MIT Licensed; see the LICENSE file in this repository. # -# We are using sharness (https://github.com/mlafeldt/sharness) +# We are using sharness (https://github.com/pl-strflt/sharness/tree/feat/junit) # which was extracted from the Git test framework. # use the ipfs tool to test against @@ -541,4 +541,3 @@ purge_blockstore() { [[ -z "$( ipfs repo gc )" ]] ' } - From 0d4af6c34b30403cf2bf79f7c71bdb24d10244e5 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 28 Sep 2022 14:47:06 +0200 Subject: [PATCH 13/60] fix: sharness.yml --- .github/workflows/sharness.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index a4da0a07d3a..6dbe31226db 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -35,9 +35,6 @@ jobs: repository: ipfs-shipyard/rb-pinning-service-api ref: 773c3adbb421c551d2d89288abac3e01e1f7c3a8 path: rb-pinning-service-api - - uses: protocol/cache-go-action@v1 - with: - name: ${{ github.job }} # check if docker compose (not docker-compose) is available on default gh runners - run: | (for i in {1..3}; do docker compose pull && break || sleep 5; done) && From fe1114f95b47a04137f24d3a2cff3737024e7106 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 28 Sep 2022 15:22:12 +0200 Subject: [PATCH 14/60] fix: symlink sharness to test directory --- test/sharness/.gitignore | 8 ++++++++ test/sharness/lib/test-lib.sh | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/test/sharness/.gitignore b/test/sharness/.gitignore index 0a47783a7ee..b9a5a21aea9 100644 --- a/test/sharness/.gitignore +++ b/test/sharness/.gitignore @@ -1,6 +1,14 @@ +# symlinks to lib/sharness +/sharness.sh +/lib-sharness +# clone of sharness lib/sharness/ +# deps downloaded by lib/*.sh scripts lib/dependencies/ +# sharness files test-results/ trash directory.*.sh/ +# makefile files plugins +# macos files *.DS_Store diff --git a/test/sharness/lib/test-lib.sh b/test/sharness/lib/test-lib.sh index ecbe38249f1..5c9d2be6e66 100644 --- a/test/sharness/lib/test-lib.sh +++ b/test/sharness/lib/test-lib.sh @@ -31,10 +31,11 @@ test "$TEST_IMMEDIATE" = 1 && immediate=t . lib/test-lib-hashes.sh -SHARNESS_LIB="lib/sharness/sharness.sh" +ln -sf lib/sharness/sharness.sh . +ln -sf lib/sharness/lib-sharness . -. "$SHARNESS_LIB" || { - echo >&2 "Cannot source: $SHARNESS_LIB" +. "sharness.sh" || { + echo >&2 "Cannot source: sharness.sh" echo >&2 "Please check Sharness installation." exit 1 } From 030e819e08347c6abc188896d2a329a92ecae304 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 28 Sep 2022 18:12:20 +0200 Subject: [PATCH 15/60] fix: test junit env var --- test/sharness/Rules.mk | 2 +- test/sharness/lib/test-lib.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/test/sharness/Rules.mk b/test/sharness/Rules.mk index 7cc36bd421a..ffe3f8a56e2 100644 --- a/test/sharness/Rules.mk +++ b/test/sharness/Rules.mk @@ -42,7 +42,7 @@ $(d)/aggregate: $(T_$(d)) @(cd $(@D) && ./lib/test-aggregate-results.sh) .PHONY: $(d)/aggregate -$(d)/test-results/sharness.xml: export TEST_GENERATE_JUNIT=1 +$(d)/test-results/sharness.xml: export TEST_JUNIT=1 $(d)/test-results/sharness.xml: $(T_$(d)) @echo "*** $@ ***" @(cd $(@D)/.. && ./lib/test-aggregate-junit-reports.sh) diff --git a/test/sharness/lib/test-lib.sh b/test/sharness/lib/test-lib.sh index 5c9d2be6e66..47405eb62d1 100644 --- a/test/sharness/lib/test-lib.sh +++ b/test/sharness/lib/test-lib.sh @@ -27,6 +27,7 @@ fi # to pass through in some cases. test "$TEST_VERBOSE" = 1 && verbose=t test "$TEST_IMMEDIATE" = 1 && immediate=t +test "$TEST_JUNIT" = 1 && junit=t # source the common hashes first. . lib/test-lib-hashes.sh @@ -111,6 +112,7 @@ if test "$TEST_VERBOSE" = 1; then echo '# TEST_NO_PLUGIN='"$TEST_NO_PLUGIN" echo '# TEST_EXPENSIVE='"$TEST_EXPENSIVE" echo '# TEST_OS='"$TEST_OS" + echo '# TEST_JUNIT='"$TEST_JUNIT" fi # source our generic test lib From 51f27e992ca9da8f250d016d814de51cc9cbd012 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 28 Sep 2022 18:20:40 +0200 Subject: [PATCH 16/60] fix: sharness.yml --- .github/workflows/sharness.yml | 36 ++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 6dbe31226db..134b14045dd 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -12,13 +12,6 @@ jobs: sharness: needs: [runner] runs-on: ${{ fromJSON(needs.runner.outputs.config).labels }} - env: - TEST_NO_DOCKER: 0 - TEST_NO_FUSE: 1 - TEST_VERBOSE: 1 - TRAVIS: 1 - GIT_PAGER: cat - IPFS_CHECK_RCMGR_DEFAULTS: 1 defaults: run: shell: bash @@ -45,19 +38,32 @@ jobs: name: ${{ github.job }} - run: echo "TEST_DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" >> $GITHUB_ENV - run: | - echo TEST_DOCKER_HOST=$TEST_DOCKER_HOST && - make -O -j '${{ fromJSON(needs.runner.outputs.config).parallel }}' >> test_sharness_expensive coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml test/sharness/test-results/sharness.html CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST + make -O -j '${{ fromJSON(needs.runner.outputs.config).parallel }}' \ + test_sharness_expensive \ + coverage/sharness_tests.coverprofile \ + test/sharness/test-results/sharness.xml \ + test/sharness/test-results/sharness.html working-directory: kubo + env: + TEST_NO_DOCKER: 1 + TEST_NO_FUSE: 1 + TEST_VERBOSE: 1 + TEST_JUNIT: 1 + IPFS_CHECK_RCMGR_DEFAULTS: 1 + CONTINUE_ON_S_FAILURE: 1 - uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 - if: always() + if: failure() || success() with: name: sharness files: kubo/coverage/sharness_tests.coverprofile - run: find kubo/test/sharness/test-results -name 't*-*.sh.*.counts' | kubo/test/sharness/lib/sharness/aggregate-results.sh | grep 'failed\s*0' - uses: actions/upload-artifact@v3 + if: failure() || success() with: - name: sharness - path: | - kubo/test/sharness/test-results/sharness.xml - .junit - if: always() + name: sharness.xml + path: kubo/test/sharness/test-results/sharness.xml + - uses: actions/upload-artifact@v3 + if: failure() || success() + with: + name: sharness.html + path: kubo/test/sharness/test-results/sharness.html From 762d78bbd26297694ca40cd98e5c1c14d254f7a7 Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 29 Sep 2022 10:57:08 +0200 Subject: [PATCH 17/60] fix: junit html report generation --- test/sharness/Rules.mk | 1 - test/sharness/lib/install-sharness.sh | 2 +- test/sharness/lib/test-generate-junit-html.sh | 39 ++++++++++++------- test/sharness/lib/test-lib.sh | 2 +- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/test/sharness/Rules.mk b/test/sharness/Rules.mk index ffe3f8a56e2..5dd03513833 100644 --- a/test/sharness/Rules.mk +++ b/test/sharness/Rules.mk @@ -42,7 +42,6 @@ $(d)/aggregate: $(T_$(d)) @(cd $(@D) && ./lib/test-aggregate-results.sh) .PHONY: $(d)/aggregate -$(d)/test-results/sharness.xml: export TEST_JUNIT=1 $(d)/test-results/sharness.xml: $(T_$(d)) @echo "*** $@ ***" @(cd $(@D)/.. && ./lib/test-aggregate-junit-reports.sh) diff --git a/test/sharness/lib/install-sharness.sh b/test/sharness/lib/install-sharness.sh index 30b04401fca..8e12cef9574 100755 --- a/test/sharness/lib/install-sharness.sh +++ b/test/sharness/lib/install-sharness.sh @@ -6,7 +6,7 @@ # gitrepo=pl-strflt/sharness -githash=bca94f668688e5dc63b13d806ad4adcd5650bab2 +githash=72650e5cf9c38908d423015773d5ee33d5ee98dd if test ! -n "$clonedir" ; then clonedir=lib diff --git a/test/sharness/lib/test-generate-junit-html.sh b/test/sharness/lib/test-generate-junit-html.sh index 22ebfbed8f4..c5f830de977 100755 --- a/test/sharness/lib/test-generate-junit-html.sh +++ b/test/sharness/lib/test-generate-junit-html.sh @@ -1,43 +1,54 @@ #!/bin/sh dependencies=( - "url=https://repo1.maven.org/maven2/net/sf/saxon/Saxon-HE/11.4/Saxon-HE-11.4.jar;md5=9f35652962ffe9b687fb7e3726600f03" - "url=https://raw.githubusercontent.com/pl-strflt/ant/2b021a50901ada753a3b62d1f90e5785b1f2beb1/src/etc/junit-frames-saxon.xsl;md5=f4c6f8912a45a9cf272fa1909720c316" - "url=https://raw.githubusercontent.com/pl-strflt/ant/2b021a50901ada753a3b62d1f90e5785b1f2beb1/src/etc/junit-noframes-saxon.xsl;md5=dd3d96f8a8cce4c386bfa017e948ad57" + "url=https://sourceforge.net/projects/saxon/files/Saxon-HE/11/Java/SaxonHE11-4J.zip;md5=8a4783d307c32c898f8995b8f337fd6b" + "url=https://raw.githubusercontent.com/pl-strflt/ant/398d29d3fdc88a9f4124a45e87997c2154763d02/src/etc/junit-frames-saxon.xsl;md5=258b2d7a6c4d53dc22f33086d4fa0131" + "url=https://raw.githubusercontent.com/pl-strflt/ant/398d29d3fdc88a9f4124a45e87997c2154763d02/src/etc/junit-noframes-saxon.xsl;md5=d65690e83721b387bb6653390f08e8d8" ) dependenciesdir="lib/dependencies" mkdir -p "$dependenciesdir" +get_md5() { + md5sum "$1" | cut -d ' ' -f 1 +} + for dependency in "${dependencies[@]}"; do url="$(echo "$dependency" | cut -d ';' -f 1 | cut -d '=' -f 2)" md5="$(echo "$dependency" | cut -d ';' -f 2 | cut -d '=' -f 2)" filename="$(basename "$url")" - if test -f "$dependenciesdir/$filename" && test "$(md5sum "$dependenciesdir/$filename" | cut -d ' ' -f 1)" = "$md5"; then + if test -f "$dependenciesdir/$filename" && test "$(get_md5 "$dependenciesdir/$filename")" = "$md5"; then echo "Using cached $filename" else echo "Downloading $filename" - curl --retry 5 --no-progress-meter --output "$dependenciesdir/$filename" "$url" - if test "$(md5sum "$dependenciesdir/$filename" | cut -d ' ' -f 1)" != "$md5"; then - echo "$(md5sum "$dependenciesdir/$filename" | cut -d ' ' -f 1)" - echo "$md5" - echo "Downloaded $filename has wrong md5sum" + curl -L --max-redirs 5 --retry 5 --no-progress-meter --output "$dependenciesdir/$filename" "$url" + actual_md5="$(get_md5 "$dependenciesdir/$filename")" + if test "$actual_md5" != "$md5"; then + echo "Downloaded $filename has wrong md5sum ('$actual_md5' != '$md5')" exit 1 fi + dirname=${filename%.*} + extension=${filename#$dirname.} + if test "$extension" = "zip"; then + echo "Removing old $dependenciesdir/$dirname" + rm -rf "$dependenciesdir/$dirname" + echo "Unzipping $dependenciesdir/$filename" + unzip "$dependenciesdir/$filename" -d "$dependenciesdir/$dirname" + fi fi done case "$1" in "frames") - java -jar lib/saxon/saxon-he-11.4.jar \ + java -jar lib/dependencies/SaxonHE11-4J/saxon-he-11.4.jar \ -s:test-results/sharness.xml \ - -xsl:lib/ant/junit-frames-saxon.xsl \ - output.dir=test-results/sharness-html + -xsl:lib/dependencies/junit-frames-saxon.xsl \ + output.dir=$(pwd)/test-results/sharness-html ;; "no-frames") - java -jar lib/saxon/saxon-he-11.4.jar \ + java -jar lib/dependencies/SaxonHE11-4J/saxon-he-11.4.jar \ -s:test-results/sharness.xml \ - -xsl:lib/ant/junit-noframes-saxon.xsl \ + -xsl:lib/dependencies/junit-noframes-saxon.xsl \ -o:test-results/sharness.html ;; *) diff --git a/test/sharness/lib/test-lib.sh b/test/sharness/lib/test-lib.sh index 47405eb62d1..47f7806cc34 100644 --- a/test/sharness/lib/test-lib.sh +++ b/test/sharness/lib/test-lib.sh @@ -27,7 +27,7 @@ fi # to pass through in some cases. test "$TEST_VERBOSE" = 1 && verbose=t test "$TEST_IMMEDIATE" = 1 && immediate=t -test "$TEST_JUNIT" = 1 && junit=t +test "$TEST_JUNIT" = 1 && junit=t && no_color=t # source the common hashes first. . lib/test-lib-hashes.sh From c09a3f28a8b74200153a100714bc16bf0df01097 Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 29 Sep 2022 11:17:43 +0200 Subject: [PATCH 18/60] ci: install xmllint for sharness build --- .github/workflows/sharness.yml | 2 +- test/sharness/lib/install-sharness.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 134b14045dd..438a60630ec 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v3 with: path: kubo - - run: sudo apt install socat net-tools + - run: sudo apt install socat net-tools libxml2-utils - uses: actions/checkout@v3 with: repository: ipfs-shipyard/rb-pinning-service-api diff --git a/test/sharness/lib/install-sharness.sh b/test/sharness/lib/install-sharness.sh index 8e12cef9574..3b5b59e849a 100755 --- a/test/sharness/lib/install-sharness.sh +++ b/test/sharness/lib/install-sharness.sh @@ -6,7 +6,7 @@ # gitrepo=pl-strflt/sharness -githash=72650e5cf9c38908d423015773d5ee33d5ee98dd +githash=a1f356d4ad6019faadb5877bfa0024067601ce65 if test ! -n "$clonedir" ; then clonedir=lib From 3927f4dccb01c28179978417c4e07b4510f0359d Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 29 Sep 2022 13:26:27 +0200 Subject: [PATCH 19/60] chore: upgrade sharness so that sequences are escaped properly --- test/sharness/lib/install-sharness.sh | 2 +- test/sharness/lib/test-lib.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/sharness/lib/install-sharness.sh b/test/sharness/lib/install-sharness.sh index 3b5b59e849a..9d403d9d8fe 100755 --- a/test/sharness/lib/install-sharness.sh +++ b/test/sharness/lib/install-sharness.sh @@ -6,7 +6,7 @@ # gitrepo=pl-strflt/sharness -githash=a1f356d4ad6019faadb5877bfa0024067601ce65 +githash=604986df33c1a8f1bbfe14d7075840524a46da99 if test ! -n "$clonedir" ; then clonedir=lib diff --git a/test/sharness/lib/test-lib.sh b/test/sharness/lib/test-lib.sh index 47f7806cc34..47405eb62d1 100644 --- a/test/sharness/lib/test-lib.sh +++ b/test/sharness/lib/test-lib.sh @@ -27,7 +27,7 @@ fi # to pass through in some cases. test "$TEST_VERBOSE" = 1 && verbose=t test "$TEST_IMMEDIATE" = 1 && immediate=t -test "$TEST_JUNIT" = 1 && junit=t && no_color=t +test "$TEST_JUNIT" = 1 && junit=t # source the common hashes first. . lib/test-lib-hashes.sh From 3ccec0052b81a2b3d832d038027325710378fa81 Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 29 Sep 2022 13:35:40 +0200 Subject: [PATCH 20/60] fix: execute html generation in bash --- test/sharness/lib/test-generate-junit-html.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sharness/lib/test-generate-junit-html.sh b/test/sharness/lib/test-generate-junit-html.sh index c5f830de977..7ff8b44357a 100755 --- a/test/sharness/lib/test-generate-junit-html.sh +++ b/test/sharness/lib/test-generate-junit-html.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash dependencies=( "url=https://sourceforge.net/projects/saxon/files/Saxon-HE/11/Java/SaxonHE11-4J.zip;md5=8a4783d307c32c898f8995b8f337fd6b" From 96a52f7256e4b61cb2fc728f1a8cb4be88749f42 Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 29 Sep 2022 15:03:04 +0200 Subject: [PATCH 21/60] chore: upgrade sharness --- test/sharness/lib/install-sharness.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sharness/lib/install-sharness.sh b/test/sharness/lib/install-sharness.sh index 9d403d9d8fe..0a70cf5eba9 100755 --- a/test/sharness/lib/install-sharness.sh +++ b/test/sharness/lib/install-sharness.sh @@ -6,7 +6,7 @@ # gitrepo=pl-strflt/sharness -githash=604986df33c1a8f1bbfe14d7075840524a46da99 +githash=32c9f11531ef53780073d0cd5ba8266c4d0091f7 if test ! -n "$clonedir" ; then clonedir=lib From ca53a7ac1d86af3fe0272e8773118c648d36acd8 Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 29 Sep 2022 16:00:30 +0200 Subject: [PATCH 22/60] chore: do not print out control sequences from gateway car test --- test/sharness/t0118-gateway-car.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sharness/t0118-gateway-car.sh b/test/sharness/t0118-gateway-car.sh index 3d8d7b08f46..62b2725d0cd 100755 --- a/test/sharness/t0118-gateway-car.sh +++ b/test/sharness/t0118-gateway-car.sh @@ -111,7 +111,7 @@ test_launch_ipfs_daemon_without_network ' test_expect_success "GET for application/vnd.ipld.car with query filename includes Content-Disposition with custom filename" ' - curl -svX GET -H "Accept: application/vnd.ipld.car" "http://127.0.0.1:$GWAY_PORT/ipfs/$ROOT_DIR_CID/subdir/ascii.txt?filename=foobar.car" > curl_output_filename 2>&1 && + curl -svX GET -H "Accept: application/vnd.ipld.car" "http://127.0.0.1:$GWAY_PORT/ipfs/$ROOT_DIR_CID/subdir/ascii.txt?filename=foobar.car" >/dev/null 2>curl_output_filename && cat curl_output_filename && grep "< Content-Disposition: attachment\; filename=\"foobar.car\"" curl_output_filename ' From 8080d3055abb36a56c0f1f810305758e87837360 Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 29 Sep 2022 16:08:45 +0200 Subject: [PATCH 23/60] fix: XML report generation in CircleCI --- .circleci/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/main.yml b/.circleci/main.yml index b45a17588b9..4ab8f3ef418 100644 --- a/.circleci/main.yml +++ b/.circleci/main.yml @@ -152,6 +152,7 @@ jobs: TEST_NO_DOCKER: 0 TEST_NO_FUSE: 1 TEST_VERBOSE: 1 + TEST_JUNIT: 1 steps: - run: sudo apt update - run: | From 197d1f95c0c5585107d900c54a4012fd7dac339b Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 29 Sep 2022 16:09:03 +0200 Subject: [PATCH 24/60] feat: allow configuring sharness coloring through env vars --- test/sharness/lib/test-lib.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/sharness/lib/test-lib.sh b/test/sharness/lib/test-lib.sh index 47405eb62d1..dc3c89479c6 100644 --- a/test/sharness/lib/test-lib.sh +++ b/test/sharness/lib/test-lib.sh @@ -28,6 +28,7 @@ fi test "$TEST_VERBOSE" = 1 && verbose=t test "$TEST_IMMEDIATE" = 1 && immediate=t test "$TEST_JUNIT" = 1 && junit=t +test "$TEST_NO_COLOR" = 1 && no_color=t # source the common hashes first. . lib/test-lib-hashes.sh @@ -113,6 +114,7 @@ if test "$TEST_VERBOSE" = 1; then echo '# TEST_EXPENSIVE='"$TEST_EXPENSIVE" echo '# TEST_OS='"$TEST_OS" echo '# TEST_JUNIT='"$TEST_JUNIT" + echo '# TEST_NO_COLOR='"$TEST_NO_COLOR" fi # source our generic test lib From 76b70d4b12e37cfaa99dd4d5a5cf22a96f8b2bec Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 29 Sep 2022 18:00:45 +0200 Subject: [PATCH 25/60] chore: upgrade sharness and junit XSLs --- test/sharness/lib/install-sharness.sh | 2 +- test/sharness/lib/test-generate-junit-html.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/sharness/lib/install-sharness.sh b/test/sharness/lib/install-sharness.sh index 0a70cf5eba9..41b27188c93 100755 --- a/test/sharness/lib/install-sharness.sh +++ b/test/sharness/lib/install-sharness.sh @@ -6,7 +6,7 @@ # gitrepo=pl-strflt/sharness -githash=32c9f11531ef53780073d0cd5ba8266c4d0091f7 +githash=803df39d3cba16bb7d493dd6cd8bc5e29826da61 if test ! -n "$clonedir" ; then clonedir=lib diff --git a/test/sharness/lib/test-generate-junit-html.sh b/test/sharness/lib/test-generate-junit-html.sh index 7ff8b44357a..cc18762cbb9 100755 --- a/test/sharness/lib/test-generate-junit-html.sh +++ b/test/sharness/lib/test-generate-junit-html.sh @@ -2,8 +2,8 @@ dependencies=( "url=https://sourceforge.net/projects/saxon/files/Saxon-HE/11/Java/SaxonHE11-4J.zip;md5=8a4783d307c32c898f8995b8f337fd6b" - "url=https://raw.githubusercontent.com/pl-strflt/ant/398d29d3fdc88a9f4124a45e87997c2154763d02/src/etc/junit-frames-saxon.xsl;md5=258b2d7a6c4d53dc22f33086d4fa0131" - "url=https://raw.githubusercontent.com/pl-strflt/ant/398d29d3fdc88a9f4124a45e87997c2154763d02/src/etc/junit-noframes-saxon.xsl;md5=d65690e83721b387bb6653390f08e8d8" + "url=https://raw.githubusercontent.com/pl-strflt/ant/c781f7d79b92cc55530245d9554682a47f46851e/src/etc/junit-frames-saxon.xsl;md5=6eb013566903a91e4959413f6ff144d0" + "url=https://raw.githubusercontent.com/pl-strflt/ant/c781f7d79b92cc55530245d9554682a47f46851e/src/etc/junit-noframes-saxon.xsl;md5=8d54882d5f9d32a7743ec675cc2e30ac" ) dependenciesdir="lib/dependencies" From fd83fc430dcb2d1cdb01edc1ff69620b74b5ae9f Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 29 Sep 2022 19:11:28 +0200 Subject: [PATCH 26/60] chore: expect success from fixed sharness tests --- test/sharness/t0110-gateway.sh | 4 ++-- test/sharness/t0160-resolve.sh | 42 ++++------------------------------ 2 files changed, 7 insertions(+), 39 deletions(-) diff --git a/test/sharness/t0110-gateway.sh b/test/sharness/t0110-gateway.sh index 87aa61c70a2..5244bd2145e 100755 --- a/test/sharness/t0110-gateway.sh +++ b/test/sharness/t0110-gateway.sh @@ -121,14 +121,14 @@ test_expect_success "GET invalid IPNS root returns 400 (Bad Request)" ' test_curl_resp_http_code "http://127.0.0.1:$port/ipns/QmInvalid/pleaseDontAddMe" "HTTP/1.1 400 Bad Request" ' -test_expect_failure "GET IPNS path succeeds" ' +test_expect_success "GET IPNS path succeeds" ' ipfs name publish --allow-offline "$HASH" && PEERID=$(ipfs config Identity.PeerID) && test_check_peerid "$PEERID" && curl -sfo actual "http://127.0.0.1:$port/ipns/$PEERID" ' -test_expect_failure "GET IPNS path output looks good" ' +test_expect_success "GET IPNS path output looks good" ' test_cmp expected actual ' diff --git a/test/sharness/t0160-resolve.sh b/test/sharness/t0160-resolve.sh index ca11947b093..f65b29c11b6 100755 --- a/test/sharness/t0160-resolve.sh +++ b/test/sharness/t0160-resolve.sh @@ -35,15 +35,6 @@ test_resolve_setup_name() { ' } -test_resolve_setup_name_fail() { - local key="$1" - local ref="$2" - - test_expect_failure "resolve: prepare $key" ' - ipfs name publish --key="$key" --allow-offline "$ref" - ' -} - test_resolve() { src=$1 dst=$2 @@ -129,23 +120,7 @@ test_resolve_cmd_b32() { ' } - -#todo remove this once the online resolve is fixed -test_resolve_fail() { - src=$1 - dst=$2 - - test_expect_failure "resolve succeeds: $src" ' - ipfs resolve "$src" >actual - ' - - test_expect_failure "resolved correctly: $src -> $dst" ' - printf "$dst" >expected && - test_cmp expected actual - ' -} - -test_resolve_cmd_fail() { +test_resolve_cmd_success() { test_resolve "/ipfs/$a_hash" "/ipfs/$a_hash" test_resolve "/ipfs/$a_hash/b" "/ipfs/$b_hash" test_resolve "/ipfs/$a_hash/b/c" "/ipfs/$c_hash" @@ -155,23 +130,16 @@ test_resolve_cmd_fail() { test_resolve "/ipld/$dag_hash/i/j" "/ipld/$dag_hash/i/j" test_resolve "/ipld/$dag_hash/i" "/ipld/$dag_hash/i" - # At the moment, publishing _fails_ because we fail to put to the DHT. - # However, resolving succeeds because we resolve the record we put to our own - # node. - # - # We should find a nice way to truly support offline publishing. But this - # behavior isn't terrible. - - test_resolve_setup_name_fail "self" "/ipfs/$a_hash" + test_resolve_setup_name "self" "/ipfs/$a_hash" test_resolve "/ipns/$self_hash" "/ipfs/$a_hash" test_resolve "/ipns/$self_hash/b" "/ipfs/$b_hash" test_resolve "/ipns/$self_hash/b/c" "/ipfs/$c_hash" - test_resolve_setup_name_fail "self" "/ipfs/$b_hash" + test_resolve_setup_name "self" "/ipfs/$b_hash" test_resolve "/ipns/$self_hash" "/ipfs/$b_hash" test_resolve "/ipns/$self_hash/c" "/ipfs/$c_hash" - test_resolve_setup_name_fail "self" "/ipfs/$c_hash" + test_resolve_setup_name "self" "/ipfs/$c_hash" test_resolve "/ipns/$self_hash" "/ipfs/$c_hash" } @@ -181,7 +149,7 @@ test_resolve_cmd_b32 # should work online test_launch_ipfs_daemon -test_resolve_cmd_fail +test_resolve_cmd_success test_kill_ipfs_daemon test_done From 20c639636fc9f81c33860b199aa7dfa7c27ff017 Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 29 Sep 2022 19:31:01 +0200 Subject: [PATCH 27/60] fix: sharness test setup --- .circleci/main.yml | 1 + .github/workflows/sharness.yml | 3 ++- test/sharness/lib/test-lib.sh | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.circleci/main.yml b/.circleci/main.yml index 4ab8f3ef418..47763d9091b 100644 --- a/.circleci/main.yml +++ b/.circleci/main.yml @@ -150,6 +150,7 @@ jobs: environment: <<: *default_environment TEST_NO_DOCKER: 0 + TEST_NO_PLUGIN: 1 TEST_NO_FUSE: 1 TEST_VERBOSE: 1 TEST_JUNIT: 1 diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 438a60630ec..b387528a55b 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -45,7 +45,8 @@ jobs: test/sharness/test-results/sharness.html working-directory: kubo env: - TEST_NO_DOCKER: 1 + TEST_NO_DOCKER: 0 + TEST_NO_PLUGIN: 1 TEST_NO_FUSE: 1 TEST_VERBOSE: 1 TEST_JUNIT: 1 diff --git a/test/sharness/lib/test-lib.sh b/test/sharness/lib/test-lib.sh index dc3c89479c6..4ce2a60276e 100644 --- a/test/sharness/lib/test-lib.sh +++ b/test/sharness/lib/test-lib.sh @@ -109,12 +109,15 @@ expr "$TEST_OS" : "CYGWIN_NT" >/dev/null || test_set_prereq STD_ERR_MSG if test "$TEST_VERBOSE" = 1; then echo '# TEST_VERBOSE='"$TEST_VERBOSE" + echo '# TEST_IMMEDIATE='"$TEST_IMMEDIATE" echo '# TEST_NO_FUSE='"$TEST_NO_FUSE" + echo '# TEST_NO_DOCKER='"$TEST_NO_DOCKER" echo '# TEST_NO_PLUGIN='"$TEST_NO_PLUGIN" echo '# TEST_EXPENSIVE='"$TEST_EXPENSIVE" echo '# TEST_OS='"$TEST_OS" echo '# TEST_JUNIT='"$TEST_JUNIT" echo '# TEST_NO_COLOR='"$TEST_NO_COLOR" + echo '# TEST_ULIMIT_PRESET='"$TEST_ULIMIT_PRESET" fi # source our generic test lib From ba204a9ba1c980712aa4eef2a2881e5111cc5bfb Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 13 Oct 2022 14:52:00 +0200 Subject: [PATCH 28/60] fix: interop build on github actions --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dfbc4a26ade..d323bcdd4bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,9 +61,8 @@ jobs: npm init -y npm install ipfs@^0.61.0 npm install ipfs-interop@^8.0.10 - npm install mocha-circleci-reporter@0.0.3 working-directory: interop - - run: npx ipfs-interop + - run: npx ipfs-interop -- -t node env: LIBP2P_TCP_REUSEPORT: false LIBP2P_ALLOW_WEAK_RSA_KEYS: 1 From b9e877c2e79d96f275eeeda73edbe915364e92c7 Mon Sep 17 00:00:00 2001 From: galargh Date: Thu, 13 Oct 2022 15:34:13 +0200 Subject: [PATCH 29/60] ci: give github actions workflows names --- .github/workflows/build.yml | 14 ++++++++------ .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/docker-build.yml | 2 ++ .github/workflows/gobuild.yml | 2 ++ .github/workflows/golang-analysis.yml | 9 ++++++++- .github/workflows/golint.yml | 2 ++ .github/workflows/gotest.yml | 2 ++ .github/workflows/runner.yml | 6 ++++-- .github/workflows/sharness.yml | 2 ++ 9 files changed, 31 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d323bcdd4bf..f73a4b96589 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,3 +1,5 @@ +name: Interop + on: workflow_dispatch: pull_request: @@ -6,7 +8,7 @@ on: - 'master' jobs: - build: + prepare: if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest env: @@ -32,8 +34,8 @@ jobs: with: name: kubo path: cmd/ipfs/ipfs - interop: - needs: [build] + ipfs-interop: + needs: [prepare] runs-on: ubuntu-latest defaults: run: @@ -69,7 +71,7 @@ jobs: IPFS_GO_EXEC: ${{ github.workspace }}/cmd/ipfs/ipfs working-directory: interop go-ipfs-api: - needs: [build] + needs: [prepare] runs-on: ubuntu-latest env: TEST_NO_DOCKER: 1 @@ -108,7 +110,7 @@ jobs: - run: cmd/ipfs/ipfs shutdown if: always() go-ipfs-http-client: - needs: [build] + needs: [prepare] runs-on: ubuntu-latest env: TEST_NO_DOCKER: 1 @@ -140,7 +142,7 @@ jobs: - run: go test -count=1 -v ./... working-directory: go-ipfs-http-client ipfs-webui: - needs: [build] + needs: [prepare] runs-on: ubuntu-latest env: NO_SANDBOX: true diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index af9006adf88..e12af6b4e41 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,5 +1,5 @@ # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed -name: "CodeQL" +name: CodeQL on: workflow_dispatch: diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 107166b325d..e17a6682482 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -1,3 +1,5 @@ +name: Build Docker image + on: workflow_dispatch: pull_request: diff --git a/.github/workflows/gobuild.yml b/.github/workflows/gobuild.yml index 0125dbd0612..4405955b41e 100644 --- a/.github/workflows/gobuild.yml +++ b/.github/workflows/gobuild.yml @@ -1,3 +1,5 @@ +name: Go Build + on: workflow_dispatch: pull_request: diff --git a/.github/workflows/golang-analysis.yml b/.github/workflows/golang-analysis.yml index 3a74e61a26e..ec1124b3f4d 100644 --- a/.github/workflows/golang-analysis.yml +++ b/.github/workflows/golang-analysis.yml @@ -1,8 +1,15 @@ -on: [push, pull_request] name: Go Checks +on: + workflow_dispatch: + pull_request: + push: + branches: + - 'master' + jobs: unit: + if: github.repository == 'galorgh/kubo' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest name: All steps: diff --git a/.github/workflows/golint.yml b/.github/workflows/golint.yml index fb32862a7f4..fc1f4046969 100644 --- a/.github/workflows/golint.yml +++ b/.github/workflows/golint.yml @@ -1,3 +1,5 @@ +name: Go Lint + on: workflow_dispatch: pull_request: diff --git a/.github/workflows/gotest.yml b/.github/workflows/gotest.yml index 6ca2ed6be2c..40ad437edb8 100644 --- a/.github/workflows/gotest.yml +++ b/.github/workflows/gotest.yml @@ -1,3 +1,5 @@ +name: Go Test + on: workflow_dispatch: pull_request: diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml index 54b70c20ec3..bf2471c8387 100644 --- a/.github/workflows/runner.yml +++ b/.github/workflows/runner.yml @@ -1,12 +1,14 @@ +name: Inspect environment + on: workflow_call: outputs: config: description: "The runner's configuration" - value: ${{ jobs.runner.outputs.config }} + value: ${{ jobs.choose.outputs.config }} jobs: - runner: + choose: runs-on: ubuntu-latest outputs: config: ${{ steps.config.outputs.result }} diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index b387528a55b..6c54a915759 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -1,3 +1,5 @@ +name: Sharness + on: workflow_dispatch: pull_request: From 6c1ecca7f673432120815204e166eebba1057145 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 15:44:55 +0200 Subject: [PATCH 30/60] feat: add reports to the sharness workflow --- .github/workflows/sharness.yml | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 6c54a915759..6fdd834bbbc 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -44,7 +44,8 @@ jobs: test_sharness_expensive \ coverage/sharness_tests.coverprofile \ test/sharness/test-results/sharness.xml \ - test/sharness/test-results/sharness.html + test/sharness/test-results/sharness.html \ + test/sharness/test-results/sharness-html working-directory: kubo env: TEST_NO_DOCKER: 0 @@ -60,13 +61,30 @@ jobs: name: sharness files: kubo/coverage/sharness_tests.coverprofile - run: find kubo/test/sharness/test-results -name 't*-*.sh.*.counts' | kubo/test/sharness/lib/sharness/aggregate-results.sh | grep 'failed\s*0' - - uses: actions/upload-artifact@v3 + - id: one-page + uses: pl-strflt/tf-aws-github-runner/.github/actions/upload-artifact@main if: failure() || success() with: - name: sharness.xml - path: kubo/test/sharness/test-results/sharness.xml - - uses: actions/upload-artifact@v3 + source: kubo/test/sharness/test-results/sharness.html + destination: sharness.html + - id: full + uses: pl-strflt/tf-aws-github-runner/.github/actions/upload-artifact@main + if: failure() || success() + with: + source: kubo/test/sharness/test-results/sharness-html + destination: sharness-html/ + - if: failure() || success() + run: | + echo "$MD" >> $GITHUB_STEP_SUMMARY + env: + MD: | + # HTML Reports + + - View the [one page HTML report](${{ steps.one-page.outputs.url }}) + - View the [full HTML report](${{ steps.full.outputs.url }}index.html) + - uses: dorny/test-reporter@c9b3d0e2bd2a4e96aaf424dbaa31c46b42318226 # v1.6.0 if: failure() || success() with: - name: sharness.html - path: kubo/test/sharness/test-results/sharness.html + name: Sharness JUnit + path: kubo/test/sharness/test-results/sharness.xml + reporter: java-junit From 97878ae7614b9c419b53cb6c3d5e1f6e58ec1b74 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 15:48:49 +0200 Subject: [PATCH 31/60] fix: action repository names --- .github/workflows/sharness.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 6fdd834bbbc..d4df821f2a0 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -62,13 +62,13 @@ jobs: files: kubo/coverage/sharness_tests.coverprofile - run: find kubo/test/sharness/test-results -name 't*-*.sh.*.counts' | kubo/test/sharness/lib/sharness/aggregate-results.sh | grep 'failed\s*0' - id: one-page - uses: pl-strflt/tf-aws-github-runner/.github/actions/upload-artifact@main + uses: pl-strflt/tf-aws-gh-runner/.github/actions/upload-artifact@main if: failure() || success() with: source: kubo/test/sharness/test-results/sharness.html destination: sharness.html - id: full - uses: pl-strflt/tf-aws-github-runner/.github/actions/upload-artifact@main + uses: pl-strflt/tf-aws-gh-runner/.github/actions/upload-artifact@main if: failure() || success() with: source: kubo/test/sharness/test-results/sharness-html From fb92ce0ee00264d362ad81ad3f35a59e2a7457ae Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 16:14:44 +0200 Subject: [PATCH 32/60] fix: working directory for the test reporter --- .github/workflows/sharness.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index d4df821f2a0..d89fe3dabf9 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -86,5 +86,6 @@ jobs: if: failure() || success() with: name: Sharness JUnit - path: kubo/test/sharness/test-results/sharness.xml + path: test/sharness/test-results/sharness.xml reporter: java-junit + working-directory: kubo From ee9503ea0dccb0871ffbff4ee6fffab07be1ca4a Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 16:58:25 +0200 Subject: [PATCH 33/60] chore: remove broken test reporter --- .github/workflows/sharness.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index d89fe3dabf9..167281f28b2 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -82,10 +82,4 @@ jobs: - View the [one page HTML report](${{ steps.one-page.outputs.url }}) - View the [full HTML report](${{ steps.full.outputs.url }}index.html) - - uses: dorny/test-reporter@c9b3d0e2bd2a4e96aaf424dbaa31c46b42318226 # v1.6.0 - if: failure() || success() - with: - name: Sharness JUnit - path: test/sharness/test-results/sharness.xml - reporter: java-junit - working-directory: kubo + From 35c6a37171d6c950b36dcb1531dfbc312426b4a4 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 17:43:31 +0200 Subject: [PATCH 34/60] chore: add step names and more sharness artifact uploads --- .github/workflows/runner.yml | 6 ++- .github/workflows/sharness.yml | 82 +++++++++++++++++++++++++--------- 2 files changed, 65 insertions(+), 23 deletions(-) diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml index bf2471c8387..70f980f9148 100644 --- a/.github/workflows/runner.yml +++ b/.github/workflows/runner.yml @@ -20,12 +20,14 @@ jobs: if (`${context.repo.owner}/${context.repo.repo}` === 'ipfs/kubo') { return { labels: ['self-hosted', 'linux', 'x64', 'kubo'], - parallel: 10 + parallel: 10, + aws: true } } else { return { labels: ['ubuntu-latest'], - parallel: 3 + parallel: 3, + aws: false } } - run: echo ${{ steps.config.outputs.result }} diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 167281f28b2..9b52e016a0d 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -18,34 +18,44 @@ jobs: run: shell: bash steps: - - uses: actions/setup-go@v3 + - name: Setup Go + uses: actions/setup-go@v3 with: go-version: 1.19.1 - - uses: actions/checkout@v3 + - name: Checkout Kubo + uses: actions/checkout@v3 with: path: kubo - - run: sudo apt install socat net-tools libxml2-utils - - uses: actions/checkout@v3 + - name: Install missing tools + run: sudo apt install socat net-tools libxml2-utils + - name: Checkout IPFS Pinning Service API + uses: actions/checkout@v3 with: repository: ipfs-shipyard/rb-pinning-service-api ref: 773c3adbb421c551d2d89288abac3e01e1f7c3a8 path: rb-pinning-service-api - # check if docker compose (not docker-compose) is available on default gh runners - - run: | + # TODO: check if docker compose (not docker-compose) is available on default gh runners + - name: Start IPFS Pinning Service API + run: | (for i in {1..3}; do docker compose pull && break || sleep 5; done) && docker compose up -d working-directory: rb-pinning-service-api - - uses: protocol/cache-go-action@v1 + - name: Restore Go Cache + uses: protocol/cache-go-action@v1 with: name: ${{ github.job }} - - run: echo "TEST_DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" >> $GITHUB_ENV - - run: | - make -O -j '${{ fromJSON(needs.runner.outputs.config).parallel }}' \ + - name: Find IPFS Pinning Service API address + run: echo "TEST_DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" >> $GITHUB_ENV + - name: Run Sharness tests (quiet) + run: | + make -O -j "$PARALLEL" \ test_sharness_expensive \ coverage/sharness_tests.coverprofile \ test/sharness/test-results/sharness.xml \ test/sharness/test-results/sharness.html \ - test/sharness/test-results/sharness-html + test/sharness/test-results/sharness-html \ + > test/sharness/test-results/sharness.txt \ + 2> >(tee -a test/sharness/test-results/sharness.txt) working-directory: kubo env: TEST_NO_DOCKER: 0 @@ -55,31 +65,61 @@ jobs: TEST_JUNIT: 1 IPFS_CHECK_RCMGR_DEFAULTS: 1 CONTINUE_ON_S_FAILURE: 1 - - uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 + PARALLEL: ${{ fromJSON(needs.runner.outputs.config).parallel }} + - name: Upload coverage report + uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 if: failure() || success() with: name: sharness files: kubo/coverage/sharness_tests.coverprofile - - run: find kubo/test/sharness/test-results -name 't*-*.sh.*.counts' | kubo/test/sharness/lib/sharness/aggregate-results.sh | grep 'failed\s*0' - - id: one-page - uses: pl-strflt/tf-aws-gh-runner/.github/actions/upload-artifact@main + - name: Aggregate results + run: find kubo/test/sharness/test-results -name 't*-*.sh.*.counts' | kubo/test/sharness/lib/sharness/aggregate-results.sh > kubo/test/sharness/test-results/summary.txt + - name: Check for failures in aggregate results + run: grep 'failed\s*0' kubo/test/sharness/test-results/summary.txt + - name: Upload stdout and stderr if: failure() || success() + uses: actions/upload-artifact@v6 + with: + name: sharness.txt + path: kubo/test/sharness/test-results/sharness.txt + - name: Add aggregate results to the summary + if: failure() || success() + run: | + echo "# Summary" >> $GITHUB_STEP_SUMMARY + echo >> $GITHUB_STEP_SUMMARY + cat kubo/test/sharness/test-results/summary.txt >> $GITHUB_STEP_SUMMARY + - name: Upload one-page HTML report to S3 + id: one-page + uses: pl-strflt/tf-aws-gh-runner/.github/actions/upload-artifact@main + if: fromJSON(needs.runner.outputs.config).aws && (failure() || success()) with: source: kubo/test/sharness/test-results/sharness.html destination: sharness.html - - id: full + - name: Upload one-page HTML report + if: (! fromJSON(needs.runner.outputs.config).aws) && (failure() || success()) + uses: actions/upload-artifact@v6 + with: + name: sharness.html + path: kubo/test/sharness/test-results/sharness.html + - name: Upload full HTML report to S3 + id: full uses: pl-strflt/tf-aws-gh-runner/.github/actions/upload-artifact@main - if: failure() || success() + if: fromJSON(needs.runner.outputs.config).aws && (failure() || success()) with: source: kubo/test/sharness/test-results/sharness-html destination: sharness-html/ - - if: failure() || success() - run: | - echo "$MD" >> $GITHUB_STEP_SUMMARY + - name: Upload full HTML report + if: (! fromJSON(needs.runner.outputs.config).aws) && (failure() || success()) + uses: actions/upload-artifact@v6 + with: + name: sharness-html + path: kubo/test/sharness/test-results/sharness-html + - name: Add S3 links to the summary + if: fromJSON(needs.runner.outputs.config).aws && (failure() || success()) + run: echo "$MD" >> $GITHUB_STEP_SUMMARY env: MD: | # HTML Reports - View the [one page HTML report](${{ steps.one-page.outputs.url }}) - View the [full HTML report](${{ steps.full.outputs.url }}index.html) - From c2f5254d2311367806f3b016de1bccd3a3eb228b Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 17:46:46 +0200 Subject: [PATCH 35/60] fix: actions/upload-artifact --- .github/workflows/sharness.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 9b52e016a0d..3ad8f9dcfb0 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -78,7 +78,7 @@ jobs: run: grep 'failed\s*0' kubo/test/sharness/test-results/summary.txt - name: Upload stdout and stderr if: failure() || success() - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v3 with: name: sharness.txt path: kubo/test/sharness/test-results/sharness.txt @@ -97,7 +97,7 @@ jobs: destination: sharness.html - name: Upload one-page HTML report if: (! fromJSON(needs.runner.outputs.config).aws) && (failure() || success()) - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v3 with: name: sharness.html path: kubo/test/sharness/test-results/sharness.html @@ -110,7 +110,7 @@ jobs: destination: sharness-html/ - name: Upload full HTML report if: (! fromJSON(needs.runner.outputs.config).aws) && (failure() || success()) - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v3 with: name: sharness-html path: kubo/test/sharness/test-results/sharness-html From bcfc117113a12b0ef49c3ee45101ea304dd2dbb4 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 18:11:49 +0200 Subject: [PATCH 36/60] fix: out file for sharness --- .github/workflows/sharness.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 3ad8f9dcfb0..cb8e05d4525 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -54,8 +54,8 @@ jobs: test/sharness/test-results/sharness.xml \ test/sharness/test-results/sharness.html \ test/sharness/test-results/sharness-html \ - > test/sharness/test-results/sharness.txt \ - 2> >(tee -a test/sharness/test-results/sharness.txt) + > sharness.out \ + 2> >(tee -a sharness.out) working-directory: kubo env: TEST_NO_DOCKER: 0 @@ -80,8 +80,8 @@ jobs: if: failure() || success() uses: actions/upload-artifact@v3 with: - name: sharness.txt - path: kubo/test/sharness/test-results/sharness.txt + name: sharness.out + path: kubo/sharness.out - name: Add aggregate results to the summary if: failure() || success() run: | From fac48caa839fbec73275a8cc9a25ab5e9c6517e1 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 18:33:22 +0200 Subject: [PATCH 37/60] chore: cleanup after testing in galorgh org --- .github/workflows/gobuild.yml | 2 +- .github/workflows/golang-analysis.yml | 2 +- .github/workflows/sharness.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gobuild.yml b/.github/workflows/gobuild.yml index 4405955b41e..32ca004725e 100644 --- a/.github/workflows/gobuild.yml +++ b/.github/workflows/gobuild.yml @@ -10,7 +10,7 @@ on: jobs: runner: if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' - uses: galorgh/kubo/.github/workflows/runner.yml@github-actions + uses: ipfs/kubo/.github/workflows/runner.yml@master gobuild: needs: [runner] runs-on: ${{ fromJSON(needs.runner.outputs.config).labels }} diff --git a/.github/workflows/golang-analysis.yml b/.github/workflows/golang-analysis.yml index ec1124b3f4d..958ece6686d 100644 --- a/.github/workflows/golang-analysis.yml +++ b/.github/workflows/golang-analysis.yml @@ -9,7 +9,7 @@ on: jobs: unit: - if: github.repository == 'galorgh/kubo' || github.event_name == 'workflow_dispatch' + if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest name: All steps: diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index cb8e05d4525..3fa0cc82649 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -10,7 +10,7 @@ on: jobs: runner: if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' - uses: galorgh/kubo/.github/workflows/runner.yml@github-actions + uses: ipfs/kubo/.github/workflows/runner.yml@master sharness: needs: [runner] runs-on: ${{ fromJSON(needs.runner.outputs.config).labels }} From f84a0c68731accf0b511f25842b73d300cf730b2 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 18:42:33 +0200 Subject: [PATCH 38/60] chore: mark newly added gh actions workflows as experimental --- .github/workflows/build.yml | 2 +- .github/workflows/docker-build.yml | 2 +- .github/workflows/gobuild.yml | 2 +- .github/workflows/golint.yml | 2 +- .github/workflows/gotest.yml | 2 +- .github/workflows/runner.yml | 2 +- .github/workflows/sharness.yml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f73a4b96589..fde6bf110c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Interop +name: '[EXPERIMENTAL] Interop' on: workflow_dispatch: diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index e17a6682482..6cab36baf52 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -1,4 +1,4 @@ -name: Build Docker image +name: '[EXPERIMENTAL] Build Docker image' on: workflow_dispatch: diff --git a/.github/workflows/gobuild.yml b/.github/workflows/gobuild.yml index 32ca004725e..0501162238a 100644 --- a/.github/workflows/gobuild.yml +++ b/.github/workflows/gobuild.yml @@ -1,4 +1,4 @@ -name: Go Build +name: '[EXPERIMENTAL] Go Build' on: workflow_dispatch: diff --git a/.github/workflows/golint.yml b/.github/workflows/golint.yml index fc1f4046969..77b41f1cd02 100644 --- a/.github/workflows/golint.yml +++ b/.github/workflows/golint.yml @@ -1,4 +1,4 @@ -name: Go Lint +name: '[EXPERIMENTAL] Go Lint' on: workflow_dispatch: diff --git a/.github/workflows/gotest.yml b/.github/workflows/gotest.yml index 40ad437edb8..fbda8c090f3 100644 --- a/.github/workflows/gotest.yml +++ b/.github/workflows/gotest.yml @@ -1,4 +1,4 @@ -name: Go Test +name: '[EXPERIMENTAL] Go Test' on: workflow_dispatch: diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml index 70f980f9148..0ef29f9cbf4 100644 --- a/.github/workflows/runner.yml +++ b/.github/workflows/runner.yml @@ -1,4 +1,4 @@ -name: Inspect environment +name: '[EXPERIMENTAL] Inspect environment' on: workflow_call: diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 3fa0cc82649..c57cd15e92b 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -1,4 +1,4 @@ -name: Sharness +name: '[EXPERIMENTAL] Sharness' on: workflow_dispatch: From 47029ef157c8de75ff1ee28950c00ff7e4100f75 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 18:48:19 +0200 Subject: [PATCH 39/60] chore: enable testing gobuild and sharness workflow in ipfs --- .github/workflows/gobuild.yml | 2 +- .github/workflows/sharness.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gobuild.yml b/.github/workflows/gobuild.yml index 0501162238a..d6caa832e87 100644 --- a/.github/workflows/gobuild.yml +++ b/.github/workflows/gobuild.yml @@ -10,7 +10,7 @@ on: jobs: runner: if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' - uses: ipfs/kubo/.github/workflows/runner.yml@master + uses: ipfs/kubo/.github/workflows/runner.yml@ci/move-to-github-actions # TODO: change to master gobuild: needs: [runner] runs-on: ${{ fromJSON(needs.runner.outputs.config).labels }} diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index c57cd15e92b..2234ff3bb11 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -10,7 +10,7 @@ on: jobs: runner: if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' - uses: ipfs/kubo/.github/workflows/runner.yml@master + uses: ipfs/kubo/.github/workflows/runner.yml@ci/move-to-github-actions # TODO: change to master sharness: needs: [runner] runs-on: ${{ fromJSON(needs.runner.outputs.config).labels }} From 7a9301437bd731abcb5d297a601ad1486282307d Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 19:06:03 +0200 Subject: [PATCH 40/60] fix: install libxml2-tools on circleci --- .circleci/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/main.yml b/.circleci/main.yml index 47763d9091b..c9ea493894a 100644 --- a/.circleci/main.yml +++ b/.circleci/main.yml @@ -162,7 +162,7 @@ jobs: tar xfz go1.19.1.linux-amd64.tar.gz echo "export PATH=$(pwd)/go/bin:\$PATH" >> ~/.bashrc - run: go version - - run: sudo apt install socat net-tools + - run: sudo apt install socat net-tools libxml2-utils - checkout - run: From c5a27882f0373930eb0c5cc83f4dbf2c4bcc58db Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 19:15:19 +0200 Subject: [PATCH 41/60] chore: update ubuntu image on circleci --- .circleci/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/main.yml b/.circleci/main.yml index c9ea493894a..e84711e5aee 100644 --- a/.circleci/main.yml +++ b/.circleci/main.yml @@ -144,7 +144,7 @@ jobs: path: /tmp/circleci-test-results sharness: machine: - image: ubuntu-2004:202010-01 + image: ubuntu-2204:2022.10.1 resource_class: << pipeline.parameters.resource_class >> working_directory: ~/ipfs/kubo environment: From 3a6ce5de5b3fd524d13213a626b8132679591b66 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 19:37:14 +0200 Subject: [PATCH 42/60] chore: upload aggregate xml --- .github/workflows/sharness.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 2234ff3bb11..0699771ccc9 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -82,6 +82,12 @@ jobs: with: name: sharness.out path: kubo/sharness.out + - name: Upload aggregate XML + if: failure() || success() + uses: actions/upload-artifact@v3 + with: + name: sharness.xml + path: kubo/test/sharness/test-results/sharness.xml - name: Add aggregate results to the summary if: failure() || success() run: | From 37ea70afcb59d50ccb540f99931a90e50981c6d8 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 19:39:12 +0200 Subject: [PATCH 43/60] wip: upload partial XML parts and counts --- .github/workflows/sharness.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 0699771ccc9..119dbc80c32 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -88,6 +88,18 @@ jobs: with: name: sharness.xml path: kubo/test/sharness/test-results/sharness.xml + - name: Upload partial XMLs + if: failure() || success() + uses: actions/upload-artifact@v3 + with: + name: sharness.xml.parts + path: kubo/test/sharness/test-results/*.xml.part + - name: Upload partial counts + if: failure() || success() + uses: actions/upload-artifact@v3 + with: + name: sharness.counts + path: kubo/test/sharness/test-results/*.counts - name: Add aggregate results to the summary if: failure() || success() run: | From 3c2aa3670c57ac348d347de0513ae428f9a2f160 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 19:48:53 +0200 Subject: [PATCH 44/60] fix: apostrophes in the docker image test --- test/sharness/t0300-docker-image.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/sharness/t0300-docker-image.sh b/test/sharness/t0300-docker-image.sh index a3a802b287f..704d78f1542 100755 --- a/test/sharness/t0300-docker-image.sh +++ b/test/sharness/t0300-docker-image.sh @@ -80,7 +80,7 @@ test_expect_success "check that init script configs were applied" ' test_expect_success "simple ipfs add/cat can be run in docker container" ' expected="Hello Worlds" && - HASH=$(docker_exec "$DOC_ID" "echo $(cat expected) | ipfs add | cut -d' ' -f2") && + HASH=$(docker_exec "$DOC_ID" "echo $(cat expected) | ipfs add | cut -d'"' '"' -f2") && docker_exec "$DOC_ID" "ipfs cat $HASH" >actual && test_cmp expected actual ' @@ -102,4 +102,3 @@ test_expect_success "stop docker container" ' docker_rm "$DOC_ID" docker_rmi "$IMAGE_ID" test_done - From 9f93b1298142ecdc831c915fefe1606b0ff1d08a Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 20:20:30 +0200 Subject: [PATCH 45/60] fix: simple ipfs add/cat can be run in docker container --- test/sharness/t0300-docker-image.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/sharness/t0300-docker-image.sh b/test/sharness/t0300-docker-image.sh index 704d78f1542..a0af244e44b 100755 --- a/test/sharness/t0300-docker-image.sh +++ b/test/sharness/t0300-docker-image.sh @@ -79,9 +79,9 @@ test_expect_success "check that init script configs were applied" ' ' test_expect_success "simple ipfs add/cat can be run in docker container" ' - expected="Hello Worlds" && + echo "Hello Worlds" > expected && HASH=$(docker_exec "$DOC_ID" "echo $(cat expected) | ipfs add | cut -d'"' '"' -f2") && - docker_exec "$DOC_ID" "ipfs cat $HASH" >actual && + (docker_exec "$DOC_ID" "ipfs cat $HASH" | tee actual) && test_cmp expected actual ' From 925ce63fb297e3978d0e3a9d7570310cee82ca34 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 20:21:52 +0200 Subject: [PATCH 46/60] chore: display sharness out --- .github/workflows/sharness.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 119dbc80c32..c62ad52c98f 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -46,16 +46,15 @@ jobs: name: ${{ github.job }} - name: Find IPFS Pinning Service API address run: echo "TEST_DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" >> $GITHUB_ENV - - name: Run Sharness tests (quiet) + - name: Run Sharness tests run: | make -O -j "$PARALLEL" \ test_sharness_expensive \ coverage/sharness_tests.coverprofile \ test/sharness/test-results/sharness.xml \ test/sharness/test-results/sharness.html \ - test/sharness/test-results/sharness-html \ - > sharness.out \ - 2> >(tee -a sharness.out) + test/sharness/test-results/sharness-html + working-directory: kubo env: TEST_NO_DOCKER: 0 @@ -76,12 +75,6 @@ jobs: run: find kubo/test/sharness/test-results -name 't*-*.sh.*.counts' | kubo/test/sharness/lib/sharness/aggregate-results.sh > kubo/test/sharness/test-results/summary.txt - name: Check for failures in aggregate results run: grep 'failed\s*0' kubo/test/sharness/test-results/summary.txt - - name: Upload stdout and stderr - if: failure() || success() - uses: actions/upload-artifact@v3 - with: - name: sharness.out - path: kubo/sharness.out - name: Upload aggregate XML if: failure() || success() uses: actions/upload-artifact@v3 From 6adb32828912c34e37ac5a6c81b1c2afde6a9f04 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 20:22:03 +0200 Subject: [PATCH 47/60] Revert "wip: upload partial XML parts and counts" This reverts commit 37ea70afcb59d50ccb540f99931a90e50981c6d8. --- .github/workflows/sharness.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index c62ad52c98f..965430a8525 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -81,18 +81,6 @@ jobs: with: name: sharness.xml path: kubo/test/sharness/test-results/sharness.xml - - name: Upload partial XMLs - if: failure() || success() - uses: actions/upload-artifact@v3 - with: - name: sharness.xml.parts - path: kubo/test/sharness/test-results/*.xml.part - - name: Upload partial counts - if: failure() || success() - uses: actions/upload-artifact@v3 - with: - name: sharness.counts - path: kubo/test/sharness/test-results/*.counts - name: Add aggregate results to the summary if: failure() || success() run: | From 34d6a1aca7399fe24d9e3e090981845873d6e12f Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 20:23:52 +0200 Subject: [PATCH 48/60] Revert "chore: upload aggregate xml" This reverts commit 3a6ce5de5b3fd524d13213a626b8132679591b66. --- .github/workflows/sharness.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 965430a8525..3a39396f909 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -75,12 +75,6 @@ jobs: run: find kubo/test/sharness/test-results -name 't*-*.sh.*.counts' | kubo/test/sharness/lib/sharness/aggregate-results.sh > kubo/test/sharness/test-results/summary.txt - name: Check for failures in aggregate results run: grep 'failed\s*0' kubo/test/sharness/test-results/summary.txt - - name: Upload aggregate XML - if: failure() || success() - uses: actions/upload-artifact@v3 - with: - name: sharness.xml - path: kubo/test/sharness/test-results/sharness.xml - name: Add aggregate results to the summary if: failure() || success() run: | From e383874ade3292758feeebcae861ce3a35538b23 Mon Sep 17 00:00:00 2001 From: galargh Date: Wed, 19 Oct 2022 20:57:35 +0200 Subject: [PATCH 49/60] fix: simple ipfs add/cat can be run in docker container --- test/sharness/t0300-docker-image.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/sharness/t0300-docker-image.sh b/test/sharness/t0300-docker-image.sh index a0af244e44b..3c390a4535f 100755 --- a/test/sharness/t0300-docker-image.sh +++ b/test/sharness/t0300-docker-image.sh @@ -79,9 +79,9 @@ test_expect_success "check that init script configs were applied" ' ' test_expect_success "simple ipfs add/cat can be run in docker container" ' - echo "Hello Worlds" > expected && - HASH=$(docker_exec "$DOC_ID" "echo $(cat expected) | ipfs add | cut -d'"' '"' -f2") && - (docker_exec "$DOC_ID" "ipfs cat $HASH" | tee actual) && + echo "Hello Worlds" | tr -d "[:cntrl:]" > expected && + HASH=$(docker_exec "$DOC_ID" "echo $(cat expected) | ipfs add -q" | tr -d "[:cntrl:]") && + docker_exec "$DOC_ID" "ipfs cat $HASH" | tr -d "[:cntrl:]" > actual && test_cmp expected actual ' From 7ac1d8a46783cd45dd15f81e79ceede7ca45b0a1 Mon Sep 17 00:00:00 2001 From: Piotr Galar Date: Mon, 14 Nov 2022 12:25:34 +0100 Subject: [PATCH 50/60] Update .github/workflows/sharness.yml --- .github/workflows/sharness.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 3a39396f909..e427fe25f76 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -27,7 +27,7 @@ jobs: with: path: kubo - name: Install missing tools - run: sudo apt install socat net-tools libxml2-utils + run: sudo apt install socat net-tools fish libxml2-utils - name: Checkout IPFS Pinning Service API uses: actions/checkout@v3 with: From d32d816ccab0ba704f7ee30851d44a4853c5395a Mon Sep 17 00:00:00 2001 From: Piotr Galar Date: Tue, 15 Nov 2022 19:20:43 +0100 Subject: [PATCH 51/60] Apply suggestions from code review --- .github/workflows/sharness.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index e427fe25f76..e7f34947d18 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -27,7 +27,7 @@ jobs: with: path: kubo - name: Install missing tools - run: sudo apt install socat net-tools fish libxml2-utils + run: sudo apt install -y socat net-tools fish libxml2-utils - name: Checkout IPFS Pinning Service API uses: actions/checkout@v3 with: From 7db9ea78b0d784e9ae3999f7cddc2297c62880e5 Mon Sep 17 00:00:00 2001 From: galargh Date: Mon, 5 Dec 2022 10:08:18 +0100 Subject: [PATCH 52/60] ci: stop using deprecated set-output command --- .github/workflows/build.yml | 4 ++-- .github/workflows/docker-image.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fde6bf110c4..0b9e22d625e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,7 +50,7 @@ jobs: path: cmd/ipfs - run: chmod +x cmd/ipfs/ipfs - run: | - echo "::set-output name=dir::$(npm config get cache)" + echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT id: npm-cache-dir - uses: actions/cache@v3 with: @@ -169,7 +169,7 @@ jobs: repository: ipfs/ipfs-webui path: ipfs-webui - run: | - echo "::set-output name=dir::$(npm config get cache)" + echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT id: npm-cache-dir - uses: actions/cache@v3 with: diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 76e0c1c1190..8a90910f78a 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -32,7 +32,7 @@ jobs: run: | TAGS="$(./bin/get-docker-tags.sh $(date -u +%F))" TAGS="${TAGS//$'\n'/'%0A'}" - echo "::set-output name=value::$(echo $TAGS)" + echo "value=$(echo $TAGS)" >> $GITHUB_OUTPUT shell: bash - name: Log in to Docker Hub From 7e85c5a39c9996b3bce86926271f27b8ca258804 Mon Sep 17 00:00:00 2001 From: galargh Date: Mon, 5 Dec 2022 10:32:39 +0100 Subject: [PATCH 53/60] Apply suggestions from code review --- .circleci/main.yml | 3 ++- .github/workflows/build.yml | 9 ++++++--- .github/workflows/sharness.yml | 8 ++++++-- Rules.mk | 3 +-- appveyor.yml | 18 +++++++++--------- coverage/Rules.mk | 2 +- test/sharness/Rules.mk | 12 +++--------- 7 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.circleci/main.yml b/.circleci/main.yml index 1886d0d7874..8c4ee470d4c 100644 --- a/.circleci/main.yml +++ b/.circleci/main.yml @@ -153,6 +153,7 @@ jobs: TEST_NO_FUSE: 1 TEST_VERBOSE: 1 TEST_JUNIT: 1 + TEST_EXPENSIVE: 1 steps: - run: sudo apt update - run: | @@ -185,7 +186,7 @@ jobs: command: echo "export TEST_DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" >> $BASH_ENV - run: echo TEST_DOCKER_HOST=$TEST_DOCKER_HOST && - make -O -j << pipeline.parameters.make_jobs >> test_sharness_expensive coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST + make -O -j << pipeline.parameters.make_jobs >> test_sharness coverage/sharness_tests.coverprofile test/sharness/test-results/sharness.xml CONTINUE_ON_S_FAILURE=1 TEST_DOCKER_HOST=$TEST_DOCKER_HOST - run: when: always command: bash <(curl -s https://codecov.io/bash) -cF sharness -X search -f coverage/sharness_tests.coverprofile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b9e22d625e..ccf81d419e5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,9 @@ on: branches: - 'master' +env: + GO_VERSION: 1.19.1 + jobs: prepare: if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch' @@ -24,7 +27,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.19.1 + go-version: ${{ env.GO_VERSION }} - uses: actions/checkout@v3 - uses: protocol/cache-go-action@v1 with: @@ -86,7 +89,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.19.1 + go-version: ${{ env.GO_VERSION }} - uses: actions/download-artifact@v3 with: name: kubo @@ -125,7 +128,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.19.1 + go-version: ${{ env.GO_VERSION }} - uses: actions/download-artifact@v3 with: name: kubo diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index e7f34947d18..ec1756979f4 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -46,15 +46,18 @@ jobs: name: ${{ github.job }} - name: Find IPFS Pinning Service API address run: echo "TEST_DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" >> $GITHUB_ENV + - uses: actions/cache@v3 + with: + path: test/sharness/lib/dependencies + key: ${{ runner.os }}-test-generate-junit-html-${{ hashFiles('test/sharness/lib/test-generate-junit-html.sh') }} - name: Run Sharness tests run: | make -O -j "$PARALLEL" \ - test_sharness_expensive \ + test_sharness \ coverage/sharness_tests.coverprofile \ test/sharness/test-results/sharness.xml \ test/sharness/test-results/sharness.html \ test/sharness/test-results/sharness-html - working-directory: kubo env: TEST_NO_DOCKER: 0 @@ -62,6 +65,7 @@ jobs: TEST_NO_FUSE: 1 TEST_VERBOSE: 1 TEST_JUNIT: 1 + TEST_EXPENSIVE: 1 IPFS_CHECK_RCMGR_DEFAULTS: 1 CONTINUE_ON_S_FAILURE: 1 PARALLEL: ${{ fromJSON(needs.runner.outputs.config).parallel }} diff --git a/Rules.mk b/Rules.mk index 3d6f621cc87..f7e962549c8 100644 --- a/Rules.mk +++ b/Rules.mk @@ -136,8 +136,7 @@ help: @echo ' test_go_expensive - Run all go tests and compile on all platforms' @echo ' test_go_race - Run go tests with the race detector enabled' @echo ' test_go_lint - Run the `golangci-lint` vetting tool' - @echo ' test_sharness_short - Run short sharness tests' - @echo ' test_sharness_expensive - Run all sharness tests' + @echo ' test_sharness - Run sharness tests' @echo ' coverage - Collects coverage info from unit tests and sharness' @echo .PHONY: help diff --git a/appveyor.yml b/appveyor.yml index 696102ffcf6..5f2907d0079 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,8 +14,8 @@ environment: GOPATH: c:\gopath TEST_VERBOSE: 1 #TEST_NO_FUSE: 1 - #TEST_SUITE: test_sharness_expensive - #GOFLAGS: -tags nofuse + #TEST_SUITE: test_sharness + #GOFLAGS: -tags nofuse global: BASH: C:\cygwin\bin\bash matrix: @@ -23,27 +23,27 @@ environment: GOVERSION: 1.5.1 GOROOT: c:\go DOWNLOADPLATFORM: "x64" - + install: # Enable make #- SET PATH=c:\MinGW\bin;%PATH% #- copy c:\MinGW\bin\mingw32-make.exe c:\MinGW\bin\make.exe - go version - go env - + # Cygwin build script # # NOTES: # # The stdin/stdout file descriptor appears not to be valid for the Appveyor -# build which causes failures as certain functions attempt to redirect +# build which causes failures as certain functions attempt to redirect # default file handles. Ensure a dummy file descriptor is opened with 'exec'. -# +# build_script: - '%BASH% -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0 $@ diff --git a/test/sharness/Rules.mk b/test/sharness/Rules.mk index 5dd03513833..3b7708b60fb 100644 --- a/test/sharness/Rules.mk +++ b/test/sharness/Rules.mk @@ -72,16 +72,10 @@ $(d)/deps: $(SHARNESS_$(d)) $$(DEPS_$(d)) # use second expansion so coverage can test_sharness_deps: $(d)/deps .PHONY: test_sharness_deps -test_sharness_short: $(d)/aggregate -.PHONY: test_sharness_short +test_sharness: $(d)/aggregate +.PHONY: test_sharness - -test_sharness_expensive: export TEST_EXPENSIVE=1 -test_sharness_expensive: test_sharness_short -.PHONY: test_sharness_expensive - -TEST += test_sharness_expensive -TEST_SHORT += test_sharness_short +TEST += test_sharness include mk/footer.mk From a5148ef03cdc78529f2af141e087ab3d815388b3 Mon Sep 17 00:00:00 2001 From: galargh Date: Mon, 5 Dec 2022 11:44:34 +0100 Subject: [PATCH 54/60] ci: split interop suites --- .github/workflows/build.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ccf81d419e5..5ab6b269f9a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,6 +40,12 @@ jobs: ipfs-interop: needs: [prepare] runs-on: ubuntu-latest + strategy: + matrix: + suites: + - 'exchange-files' + - 'files pin circuit ipns cid-version-agnostic ipns-pubsub pubsub' + fail-fast: false defaults: run: shell: bash @@ -67,7 +73,7 @@ jobs: npm install ipfs@^0.61.0 npm install ipfs-interop@^8.0.10 working-directory: interop - - run: npx ipfs-interop -- -t node + - run: npx ipfs-interop -- -t node $(sed -e 's#[^ ]*#-f test/&.js#g' <<< '${{ matrix.suites }}') env: LIBP2P_TCP_REUSEPORT: false LIBP2P_ALLOW_WEAK_RSA_KEYS: 1 From 06dca5e657fea7caccbebf0ec9cca7e2cef7d188 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 13 Jan 2023 14:23:15 +0100 Subject: [PATCH 55/60] chore: rename prefix to ci/gh-experiment makes it look similar to circleci + less visual noise --- .github/workflows/build.yml | 2 +- .github/workflows/docker-build.yml | 2 +- .github/workflows/gobuild.yml | 2 +- .github/workflows/golint.yml | 2 +- .github/workflows/gotest.yml | 2 +- .github/workflows/runner.yml | 2 +- .github/workflows/sharness.yml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ab6b269f9a..bf0fce6d1eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: '[EXPERIMENTAL] Interop' +name: 'ci/gh-experiment: interop' on: workflow_dispatch: diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 6cab36baf52..9e07c7150e6 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -1,4 +1,4 @@ -name: '[EXPERIMENTAL] Build Docker image' +name: 'ci/gh-experiment: build docker image' on: workflow_dispatch: diff --git a/.github/workflows/gobuild.yml b/.github/workflows/gobuild.yml index d6caa832e87..edacc269bac 100644 --- a/.github/workflows/gobuild.yml +++ b/.github/workflows/gobuild.yml @@ -1,4 +1,4 @@ -name: '[EXPERIMENTAL] Go Build' +name: 'ci/gh-experiment: go build' on: workflow_dispatch: diff --git a/.github/workflows/golint.yml b/.github/workflows/golint.yml index 77b41f1cd02..9623ae4b608 100644 --- a/.github/workflows/golint.yml +++ b/.github/workflows/golint.yml @@ -1,4 +1,4 @@ -name: '[EXPERIMENTAL] Go Lint' +name: 'ci/gh-experiment: go lint' on: workflow_dispatch: diff --git a/.github/workflows/gotest.yml b/.github/workflows/gotest.yml index fbda8c090f3..2c50fd3e534 100644 --- a/.github/workflows/gotest.yml +++ b/.github/workflows/gotest.yml @@ -1,4 +1,4 @@ -name: '[EXPERIMENTAL] Go Test' +name: 'ci/gh-experiment: go test' on: workflow_dispatch: diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml index 0ef29f9cbf4..afb4d740d3f 100644 --- a/.github/workflows/runner.yml +++ b/.github/workflows/runner.yml @@ -1,4 +1,4 @@ -name: '[EXPERIMENTAL] Inspect environment' +name: 'ci/gh-experiment: choose runner' on: workflow_call: diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index ec1756979f4..d151790dc1a 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -1,4 +1,4 @@ -name: '[EXPERIMENTAL] Sharness' +name: 'ci/gh-experiment: sharness' on: workflow_dispatch: From 625eb77b7b4d2ef37c6c0a3e21ec19d0bf8d6dee Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 13 Jan 2023 15:28:23 +0100 Subject: [PATCH 56/60] chore: document how ipfs-webui tests work Unifies behavior by removing skip when upstream is broken. If this turns out to be too noisy, we can change it later. --- .circleci/main.yml | 6 +++--- .github/workflows/build.yml | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.circleci/main.yml b/.circleci/main.yml index bbc63453e8f..fdab6260d75 100644 --- a/.circleci/main.yml +++ b/.circleci/main.yml @@ -348,12 +348,12 @@ jobs: npx playwright install working_directory: ~/ipfs/kubo/ipfs-webui - run: - name: Running upstream tests (finish early if they fail) + name: Run ipfs-webui@main smoke-test to confirm the upstream repo is not broken command: | - npm test || circleci-agent step halt + npm test working_directory: ~/ipfs/kubo/ipfs-webui - run: - name: Running tests with kubo built from current commit + name: Test ipfs-webui@main against the locally built Kubo binary command: npm test working_directory: ~/ipfs/kubo/ipfs-webui environment: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf0fce6d1eb..66500092960 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -190,9 +190,11 @@ jobs: npm ci --prefer-offline --no-audit --progress=false npx playwright install working-directory: ipfs-webui - - run: npm test + - name: Run ipfs-webui@main smoke-test to confirm the upstream repo is not broken + run: npm test working-directory: ipfs-webui - - run: npm test + - name: Test ipfs-webui@main against the locally built Kubo binary + run: npm test env: IPFS_GO_EXEC: ${{ github.workspace }}/cmd/ipfs/ipfs working-directory: ipfs-webui From 65ca87781eb95dea070431c576f43649aa7bb12b Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 13 Jan 2023 16:02:39 +0100 Subject: [PATCH 57/60] chore: run ipfs-webui build only once Static assets do not depend on Kubo binary, so we cna run build once, and then run only e2e against Kubo binary to save some time. --- .circleci/main.yml | 6 +++--- .github/workflows/build.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/main.yml b/.circleci/main.yml index fdab6260d75..6406c6655a3 100644 --- a/.circleci/main.yml +++ b/.circleci/main.yml @@ -348,13 +348,13 @@ jobs: npx playwright install working_directory: ~/ipfs/kubo/ipfs-webui - run: - name: Run ipfs-webui@main smoke-test to confirm the upstream repo is not broken + name: Run ipfs-webui@main build and smoke-test to confirm the upstream repo is not broken command: | npm test working_directory: ~/ipfs/kubo/ipfs-webui - run: - name: Test ipfs-webui@main against the locally built Kubo binary - command: npm test + name: Test ipfs-webui@main E2E against the locally built Kubo binary + command: npm run test:e2e working_directory: ~/ipfs/kubo/ipfs-webui environment: IPFS_GO_EXEC: /tmp/circleci-workspace/bin/ipfs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 66500092960..d0b4194b7c1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -190,11 +190,11 @@ jobs: npm ci --prefer-offline --no-audit --progress=false npx playwright install working-directory: ipfs-webui - - name: Run ipfs-webui@main smoke-test to confirm the upstream repo is not broken + - name: Run ipfs-webui@main build and smoke-test to confirm the upstream repo is not broken run: npm test working-directory: ipfs-webui - - name: Test ipfs-webui@main against the locally built Kubo binary - run: npm test + - name: Test ipfs-webui@main E2E against the locally built Kubo binary + run: npm run test:e2e env: IPFS_GO_EXEC: ${{ github.workspace }}/cmd/ipfs/ipfs working-directory: ipfs-webui From aa871a259b4b3fa44c04f531a4bdb428268a1e63 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 13 Jan 2023 16:08:40 +0100 Subject: [PATCH 58/60] chore: make it clear how to find HTML Reports User may be confused and only see failing step with GREP. This makes it more friendly. --- .github/workflows/sharness.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index d151790dc1a..6708686d284 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -77,7 +77,7 @@ jobs: files: kubo/coverage/sharness_tests.coverprofile - name: Aggregate results run: find kubo/test/sharness/test-results -name 't*-*.sh.*.counts' | kubo/test/sharness/lib/sharness/aggregate-results.sh > kubo/test/sharness/test-results/summary.txt - - name: Check for failures in aggregate results + - name: 👉️ If this step failed, go to «Summary» (top left), open the «HTML Report», and inspect the «Failures» column. run: grep 'failed\s*0' kubo/test/sharness/test-results/summary.txt - name: Add aggregate results to the summary if: failure() || success() From 6d6e006c173274a265e28793160f8f7bdc0b5953 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 13 Jan 2023 16:57:58 +0100 Subject: [PATCH 59/60] chore: docker-build - match circleci name makes easier to compare later --- .github/workflows/docker-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 9e07c7150e6..86c50bec7f1 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -1,4 +1,4 @@ -name: 'ci/gh-experiment: build docker image' +name: 'ci/gh-experiment: docker-build' on: workflow_dispatch: From 0c11db6a96045913c3d517a195482f9b3424c440 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 13 Jan 2023 18:23:21 +0100 Subject: [PATCH 60/60] chore: show failed sharness tests in job log test/sharness/lib/sharness/aggregate-results.sh will include header with failing jobs, for example: failed test(s): t0172-content-routing-over-http.sh Printing the summary to stdout will make it possible to quickly eyeball what failed, without having to look at details in HTML Reports. --- .github/workflows/sharness.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sharness.yml b/.github/workflows/sharness.yml index 6708686d284..044e55560f7 100644 --- a/.github/workflows/sharness.yml +++ b/.github/workflows/sharness.yml @@ -77,8 +77,10 @@ jobs: files: kubo/coverage/sharness_tests.coverprofile - name: Aggregate results run: find kubo/test/sharness/test-results -name 't*-*.sh.*.counts' | kubo/test/sharness/lib/sharness/aggregate-results.sh > kubo/test/sharness/test-results/summary.txt - - name: 👉️ If this step failed, go to «Summary» (top left), open the «HTML Report», and inspect the «Failures» column. - run: grep 'failed\s*0' kubo/test/sharness/test-results/summary.txt + - name: 👉️ If this step failed, go to «Summary» (top left) → «HTML Report» → inspect the «Failures» column + run: | + cat kubo/test/sharness/test-results/summary.txt && + grep 'failed\s*0' kubo/test/sharness/test-results/summary.txt - name: Add aggregate results to the summary if: failure() || success() run: |