From e937b062a1fa8b3597fcefe3514cc81c59952b8e Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Tue, 5 Jan 2021 15:56:42 -0500 Subject: [PATCH 01/31] news fragment --- newsfragments/3385.minor | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 newsfragments/3385.minor diff --git a/newsfragments/3385.minor b/newsfragments/3385.minor new file mode 100644 index 000000000..e69de29bb From 13bcd8170baf586b9b6a59273b6e924f312a6f0d Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Tue, 5 Jan 2021 15:57:10 -0500 Subject: [PATCH 02/31] Turn on Coveralls on GitHub actions --- .github/workflows/ci.yml | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd5049104..d401a1f24 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,11 +59,41 @@ jobs: name: eliot.log path: eliot.log - - name: Upload coverage report - uses: codecov/codecov-action@v1 + # Upload this job's coverage data to Coveralls. + - name: "Report Coverage to Coveralls" + uses: "coverallsapp/github-action@v1.1.2" with: - token: abf679b6-e2e6-4b33-b7b5-6cfbd41ee691 - file: coverage.xml + github-token: "${{ secrets.github_token }}" + # Every source of coverage reports needs a unique "flag name". + # Construct one by smashing a few variables from the matrix together + # here. + flag-name: "run-${{ matrix.os }}-${{ matrix.python-version }}" + # Mark the data as just one piece of many because we have more than + # one instance of this job (Windows, macOS) which collects and + # reports coverage. This is necessary to cause Coveralls to merge + # multiple coverage results into a single report. + parallel: true + + # Tell Coveralls that we're done reporting coverage data. Since we're using + # the "parallel" mode where more than one coverage data file is merged into + # a single report, we have to tell Coveralls when we've uploaded all of the + # data files. This does it. We make sure it runs last by making it depend + # on *all* of the coverage-collecting jobs. + finish-coverage-report: + # There happens to just be one coverage-collecting job at the moment. If + # the coverage reports are broken and someone added more + # coverage-collecting jobs to this workflow but didn't update this, that's + # why. + needs: + - "coverage" + runs-on: "ubuntu-latest" + steps: + - name: "Finish Coveralls Reporting" + uses: "coverallsapp/github-action@v1.1.2" + with: + github-token: "${{ secrets.github_token }}" + # Here's the magic that tells Coveralls we're done. + parallel-finished: true integration: runs-on: ${{ matrix.os }} From b4128a8d10eac897794b517e867e34c11e4c551c Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Tue, 5 Jan 2021 15:58:21 -0500 Subject: [PATCH 03/31] Stop collecting coverage on CircleCI --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index afa3fafa1..8a1452714 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -210,7 +210,7 @@ jobs: # filenames and argv). LANG: "en_US.UTF-8" # Select a tox environment to run for this job. - TAHOE_LAFS_TOX_ENVIRONMENT: "py27-coverage" + TAHOE_LAFS_TOX_ENVIRONMENT: "py27" # Additional arguments to pass to tox. TAHOE_LAFS_TOX_ARGS: "" # The path in which test artifacts will be placed. @@ -220,7 +220,7 @@ jobs: WHEELHOUSE_PATH: &WHEELHOUSE_PATH "/tmp/wheelhouse" PIP_FIND_LINKS: "file:///tmp/wheelhouse" # Upload the coverage report. - UPLOAD_COVERAGE: "yes" + UPLOAD_COVERAGE: "" # pip cannot install packages if the working directory is not readable. # We want to run a lot of steps as nobody instead of as root. @@ -373,7 +373,7 @@ jobs: # this reporter on Python 3. So drop that and just specify the # reporter. TAHOE_LAFS_TRIAL_ARGS: "--reporter=subunitv2-file" - TAHOE_LAFS_TOX_ENVIRONMENT: "py36-coverage" + TAHOE_LAFS_TOX_ENVIRONMENT: "py36" ubuntu-20-04: From ca8f7d73f2ab29a0236432aaa024b94bf8768fe4 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Tue, 5 Jan 2021 15:59:03 -0500 Subject: [PATCH 04/31] Stop using codecov --- .codecov.yml | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml deleted file mode 100644 index 166190c5e..000000000 --- a/.codecov.yml +++ /dev/null @@ -1,48 +0,0 @@ -# Override defaults for codecov.io checks. -# -# Documentation is at https://docs.codecov.io/docs/codecov-yaml; -# reference is at https://docs.codecov.io/docs/codecovyml-reference. -# -# To validate this file, use: -# -# curl --data-binary @.codecov.yml https://codecov.io/validate -# -# Codecov's defaults seem to leave red marks in GitHub CI checks in a -# rather arbitrary manner, probably because of non-determinism in -# coverage (see https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2891) -# and maybe because computers are bad with floating point numbers. - -# Allow coverage percentage a precision of zero decimals, and round to -# the nearest number (for example, 89.957 to to 90; 89.497 to 89%). -# Coverage above 90% is good, below 80% is bad. -coverage: - round: nearest - range: 80..90 - precision: 0 - - # Aim for a target test coverage of 90% in codecov/project check (do - # not allow project coverage to drop below that), and allow - # codecov/patch a threshold of 1% (allow coverage in changes to drop - # by that much, and no less). That should be good enough for us. - status: - project: - default: - target: 90% - threshold: 1% - patch: - default: - threshold: 1% - - -codecov: - # This is a public repository so supposedly we don't "need" to use an upload - # token. However, using one makes sure that CI jobs running against forked - # repositories have coverage uploaded to the right place in codecov so - # their reports aren't incomplete. - token: "abf679b6-e2e6-4b33-b7b5-6cfbd41ee691" - - notify: - # The reference documentation suggests that this is the default setting: - # https://docs.codecov.io/docs/codecovyml-reference#codecovnotifywait_for_ci - # However observation suggests otherwise. - wait_for_ci: true From 3fb412eda1c71db389c224b2f395cf57c5974500 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Tue, 5 Jan 2021 16:20:41 -0500 Subject: [PATCH 05/31] Perhaps this is the correct github-token to use. The coveralls docs might be wrong. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d401a1f24..3cc59124d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: - name: "Report Coverage to Coveralls" uses: "coverallsapp/github-action@v1.1.2" with: - github-token: "${{ secrets.github_token }}" + github-token: "${{ secrets.GITHUB_TOKEN }}" # Every source of coverage reports needs a unique "flag name". # Construct one by smashing a few variables from the matrix together # here. @@ -91,7 +91,7 @@ jobs: - name: "Finish Coveralls Reporting" uses: "coverallsapp/github-action@v1.1.2" with: - github-token: "${{ secrets.github_token }}" + github-token: "${{ secrets.GITHUB_TOKEN }}" # Here's the magic that tells Coveralls we're done. parallel-finished: true From bebcca39f62c872107c27ae637bef9ed6c19ecaa Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Tue, 5 Jan 2021 20:09:46 -0500 Subject: [PATCH 06/31] Switch to coveralls-python, maybe it works better --- .github/workflows/ci.yml | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cc59124d..ec640fa88 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,18 +61,23 @@ jobs: # Upload this job's coverage data to Coveralls. - name: "Report Coverage to Coveralls" - uses: "coverallsapp/github-action@v1.1.2" - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" + run: | + pip install coveralls + python -m coveralls + env: + # Some magic value required for some magic reason. + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + # Help coveralls identify our project. + COVERALLS_REPO_TOKEN: "JPf16rLB7T2yjgATIxFzTsEgMdN1UNq6o" # Every source of coverage reports needs a unique "flag name". # Construct one by smashing a few variables from the matrix together # here. - flag-name: "run-${{ matrix.os }}-${{ matrix.python-version }}" + COVERALLS_FLAG_NAME: "run-${{ matrix.os }}-${{ matrix.python-version }}" # Mark the data as just one piece of many because we have more than # one instance of this job (Windows, macOS) which collects and # reports coverage. This is necessary to cause Coveralls to merge # multiple coverage results into a single report. - parallel: true + COVERALLS_PARALLEL: true # Tell Coveralls that we're done reporting coverage data. Since we're using # the "parallel" mode where more than one coverage data file is merged into @@ -89,11 +94,14 @@ jobs: runs-on: "ubuntu-latest" steps: - name: "Finish Coveralls Reporting" - uses: "coverallsapp/github-action@v1.1.2" - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - # Here's the magic that tells Coveralls we're done. - parallel-finished: true + run: | + pip install coveralls + python -m coveralls --finish + env: + # Some magic value required for some magic reason. + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + # Help coveralls identify our project. + COVERALLS_REPO_TOKEN: "JPf16rLB7T2yjgATIxFzTsEgMdN1UNq6o" integration: runs-on: ${{ matrix.os }} From 9a8a61b74042a8870e83e4700a177627e02a528a Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Tue, 5 Jan 2021 20:31:32 -0500 Subject: [PATCH 07/31] Further tweaks to help the last step --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec640fa88..b89654c0d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,10 +92,14 @@ jobs: needs: - "coverage" runs-on: "ubuntu-latest" + # Get a Python 3 environment because only the Python 3 release of + # coveralls-python has the `--finish` flag... + container: "python:3-slim" steps: - name: "Finish Coveralls Reporting" run: | - pip install coveralls + # Also install wheel otherwise `docopt` may fail to build + pip install wheel coveralls python -m coveralls --finish env: # Some magic value required for some magic reason. From f3aca51e35cbc04571f76347df64d2feafd80718 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Tue, 5 Jan 2021 20:52:02 -0500 Subject: [PATCH 08/31] run in debug mode to collect info for bug report --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b89654c0d..810b607af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,7 +100,7 @@ jobs: run: | # Also install wheel otherwise `docopt` may fail to build pip install wheel coveralls - python -m coveralls --finish + python -m coveralls debug --finish env: # Some magic value required for some magic reason. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" From 4b65751f5165b2c10febfee9848774a2b8aa591a Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 09:00:16 -0500 Subject: [PATCH 09/31] Debug the earlier submissions to see what build_num they're providing --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 810b607af..1d244b4ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: - name: "Report Coverage to Coveralls" run: | pip install coveralls - python -m coveralls + python -m coveralls debug env: # Some magic value required for some magic reason. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" From adf3518fc1d768de9f6aec58e9fe8ddf52f80947 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 14:32:48 -0500 Subject: [PATCH 10/31] Okay I guess that served its purpose --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d244b4ce..810b607af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: - name: "Report Coverage to Coveralls" run: | pip install coveralls - python -m coveralls debug + python -m coveralls env: # Some magic value required for some magic reason. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" From f24cc5da0c0ac7b631335de9dbb3634b6d48d402 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 14:33:00 -0500 Subject: [PATCH 11/31] The angrier I am the more words I write --- .github/workflows/ci.yml | 77 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 71 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 810b607af..74454de6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,15 +92,80 @@ jobs: needs: - "coverage" runs-on: "ubuntu-latest" - # Get a Python 3 environment because only the Python 3 release of - # coveralls-python has the `--finish` flag... - container: "python:3-slim" + # Get a runtime environment with curl so we can use it to send the HTTP + # request. + container: "curlimages/curl:7.74.0" steps: - name: "Finish Coveralls Reporting" run: | - # Also install wheel otherwise `docopt` may fail to build - pip install wheel coveralls - python -m coveralls debug --finish + # coveralls-python does have a `--finish` option but it doesn't seem + # to work, at least for us. + # https://github.com/coveralls-clients/coveralls-python/issues/248 + # + # But all it does is this simple POST so we can just send it + # ourselves. The only hard part is guessing what the POST + # parameters mean. + # + # Since the build is done I'm going to guess that "done" is a fine + # value for status. + # + # That leaves "build_num". The coveralls documentation gives some + # hints about it. It suggests using $CIRCLE_WORKFLOW_ID if your job + # is on CircleCI. CircleCI documentation says this about + # CIRCLE_WORKFLOW_ID: + # + # A unique identifier for the workflow instance of the current + # job. This identifier is the same for every job in a given + # workflow instance. + # + # (from https://circleci.com/docs/2.0/env-vars/) + # + # A CircleCI workflow is roughly "the group of jobs run for a + # particular commit". There are exceptions to this but maybe we can + # ignore them. + # + # The only over hints we get from Coveralls about "build_num" are: + # + # * An example value of `1234` + # + # * Another example value of `$BUILD_NUMBER` where BUILD_NUMBER is + # not defined anywhere. + # + # Starting from the CircleCI workflow example, then, and looking at + # the environment variables GitHub Actions offers + # (https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables) there are two of interest: + # + # * GITHUB_RUN_ID - A unique number for each run within a + # repository. This number does not change if you re-run the + # workflow run. + # + # * GITHUB_RUN_NUMBER - A unique number for each run of a particular + # workflow in a repository. This number begins at 1 for the + # workflow's first run, and increments with each new run. This + # number does not change if you re-run the workflow run. + # + # These seem to offer approximately the same value and only differ + # on whether they will be unique for the project as a whole or just + # for this particular workflow ("ci", as defined by this file). + # + # Unfortunately neither of them changes if a workflow is re-run. + # This differs from the behavior of CircleCI's CIRCLE_WORKFLOW_ID + # where a new value is assigned if a workflow is re-run. + # + # The consequence of this would seem to be that multiple runs of a + # GitHub Actions workflow will have their coverage reported to the + # same job. And since we eventually "finish" a job, later runs + # would be discarded (I suppose). + # + # There doesn't seem to be a way to do any better, though. + # + # However, we have the further constraint that our build_num must + # agree with whatever python-coveralls has selected. An inspection + # of the python-coveralls source reveals (perhaps unsurprisingly) + # its authors have selected GITHUB_RUN_ID. + # + # Thus, we select the same. + curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]=GITHUB_RUN_ID&payload[status]=done" env: # Some magic value required for some magic reason. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" From 8e8a7d82c642b91008d61ab9496465fb384d94ff Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 14:33:31 -0500 Subject: [PATCH 12/31] it was one or the other. turns out it was the other. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74454de6c..f15610333 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -160,8 +160,8 @@ jobs: # There doesn't seem to be a way to do any better, though. # # However, we have the further constraint that our build_num must - # agree with whatever python-coveralls has selected. An inspection - # of the python-coveralls source reveals (perhaps unsurprisingly) + # agree with whatever coveralls-python has selected. An inspection + # of the coveralls-python source reveals (perhaps unsurprisingly) # its authors have selected GITHUB_RUN_ID. # # Thus, we select the same. From 4d2782c1787838416df0963230aefde3371af631 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 14:57:31 -0500 Subject: [PATCH 13/31] Hahaha. Resolve the variable, don't just include its name. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f15610333..ff4a89ecd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -165,7 +165,7 @@ jobs: # its authors have selected GITHUB_RUN_ID. # # Thus, we select the same. - curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]=GITHUB_RUN_ID&payload[status]=done" + curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]=$GITHUB_RUN_ID&payload[status]=done" env: # Some magic value required for some magic reason. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" From 24a531474df7e3af3c21d37a287853832326bc7d Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 15:38:12 -0500 Subject: [PATCH 14/31] So much for my ability to read and understand a Python program coveralls complained: {"error":"No build matching CI build number 467026020 found"} So try constructing a build_num that looks like the value we observed from `coveralls` output when it was submitting coverage data. --- .github/workflows/ci.yml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff4a89ecd..e9de9ba86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,9 +92,6 @@ jobs: needs: - "coverage" runs-on: "ubuntu-latest" - # Get a runtime environment with curl so we can use it to send the HTTP - # request. - container: "curlimages/curl:7.74.0" steps: - name: "Finish Coveralls Reporting" run: | @@ -161,11 +158,25 @@ jobs: # # However, we have the further constraint that our build_num must # agree with whatever coveralls-python has selected. An inspection - # of the coveralls-python source reveals (perhaps unsurprisingly) - # its authors have selected GITHUB_RUN_ID. + # of the coveralls-python source suggests that GITHUB_RUN_ID is + # used. However, observation of the coveralls.io web interface + # suggests the value instead is something more like: + # + # $(git rev-parse refs/remotes/pull//merge)-PR- # # Thus, we select the same. - curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]=$GITHUB_RUN_ID&payload[status]=done" + # + # GITHUB_REF is a string like the rev being parsed above. We + # extract the PR number from it. + PR=$(echo $GITHUB_REF | cut -d / -f 4) + REV=$(git rev-parse $GITHUB_REF) + BUILD_NUM=$REV-PR-$PR + REPO_NAME=$GITHUB_REPOSITORY + curl \ + -k \ + https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN \ + -d \ + "payload[build_num]=$BUILD_NUM&payload[status]=done&payload[repo_name]=$REPO_NAME" env: # Some magic value required for some magic reason. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" From 52c42b5118100982ae777c82607de4e51c588631 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 15:48:20 -0500 Subject: [PATCH 15/31] dump this info, who knows how many more rounds this will take --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9de9ba86..2b213493e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: - name: "Report Coverage to Coveralls" run: | pip install coveralls - python -m coveralls + python -m coveralls --verbose env: # Some magic value required for some magic reason. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" From fa863c94782f4011ab8d2c74051a6f0e3d3141d5 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 15:48:31 -0500 Subject: [PATCH 16/31] speed up the test cycle --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index c61331885..a1b988b91 100644 --- a/tox.ini +++ b/tox.ini @@ -50,7 +50,7 @@ extras = test setenv = # Define TEST_SUITE in the environment as an aid to constructing the # correct test command below. - !py36: TEST_SUITE = allmydata + !py36: TEST_SUITE = allmydata.test.test_abbreviate py36: TEST_SUITE = allmydata.test.python3_tests commands = From fac12210cb76e5cc3600ed6016ce960eab42095c Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 15:58:48 -0500 Subject: [PATCH 17/31] Can't do that Git stuff without a checkout Maybe *that* is why `coveralls --finish` fails? --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b213493e..243d865e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,6 +93,9 @@ jobs: - "coverage" runs-on: "ubuntu-latest" steps: + - name: "Check out Tahoe-LAFS sources" + uses: "actions/checkout@v2" + - name: "Finish Coveralls Reporting" run: | # coveralls-python does have a `--finish` option but it doesn't seem From 89c54af01db145996d680b8ade82370e3564c7b1 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 16:05:35 -0500 Subject: [PATCH 18/31] Guess we need the rest of the repo too, surprise. --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 243d865e4..473cc7d53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,6 +96,10 @@ jobs: - name: "Check out Tahoe-LAFS sources" uses: "actions/checkout@v2" + - name: "Fetch all history for all tags and branches" + run: | + git fetch --prune --unshallow + - name: "Finish Coveralls Reporting" run: | # coveralls-python does have a `--finish` option but it doesn't seem From d515887ba1b1b0a6af9efb575883ba9e46f12201 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 16:15:02 -0500 Subject: [PATCH 19/31] This is probably faster and may actually work `git fetch --prune --unshallow` doesn't seem to get refs/remotes/pull//merge but that's okay because HEAD is already set to that --- .github/workflows/ci.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 473cc7d53..633dd85e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,10 +96,6 @@ jobs: - name: "Check out Tahoe-LAFS sources" uses: "actions/checkout@v2" - - name: "Fetch all history for all tags and branches" - run: | - git fetch --prune --unshallow - - name: "Finish Coveralls Reporting" run: | # coveralls-python does have a `--finish` option but it doesn't seem @@ -175,8 +171,11 @@ jobs: # # GITHUB_REF is a string like the rev being parsed above. We # extract the PR number from it. + # + # actions/checkout@v2 makes HEAD the same as refs/remotes/pull//merge so we can just rev-parse that. PR=$(echo $GITHUB_REF | cut -d / -f 4) - REV=$(git rev-parse $GITHUB_REF) + REV=$(git rev-parse HEAD) BUILD_NUM=$REV-PR-$PR REPO_NAME=$GITHUB_REPOSITORY curl \ From 59e385c00f5a85247959e922f20f20438163798f Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 16:24:53 -0500 Subject: [PATCH 20/31] apparently it doesn't have `remotes` in there --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 633dd85e3..7b46acbf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -165,16 +165,16 @@ jobs: # used. However, observation of the coveralls.io web interface # suggests the value instead is something more like: # - # $(git rev-parse refs/remotes/pull//merge)-PR- + # $(git rev-parse refs/pull//merge)-PR- # # Thus, we select the same. # # GITHUB_REF is a string like the rev being parsed above. We # extract the PR number from it. # - # actions/checkout@v2 makes HEAD the same as refs/remotes/pull//merge so we can just rev-parse that. - PR=$(echo $GITHUB_REF | cut -d / -f 4) + PR=$(echo $GITHUB_REF | cut -d / -f 3) REV=$(git rev-parse HEAD) BUILD_NUM=$REV-PR-$PR REPO_NAME=$GITHUB_REPOSITORY From e3a6f43dc9cf51b9c917d8c585735806b839bc73 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 16:43:11 -0500 Subject: [PATCH 21/31] less shell wankery --- .github/workflows/ci.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b46acbf3..0451c3bd1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -168,16 +168,19 @@ jobs: # $(git rev-parse refs/pull//merge)-PR- # # Thus, we select the same. - # - # GITHUB_REF is a string like the rev being parsed above. We - # extract the PR number from it. - # - # actions/checkout@v2 makes HEAD the same as refs/pull//merge so we can just rev-parse that. - PR=$(echo $GITHUB_REF | cut -d / -f 3) + + # refs/pull//merge was justed checked out by so we can just + # rev-parse HEAD to find the revision. REV=$(git rev-parse HEAD) + + # We can get the PR number from the "context". + # https://github.community/t/github-ref-is-inconsistent/17728/3 + # https://docs.github.com/en/free-pro-team@latest/articles/events-that-trigger-workflows + PR=${{ github.event.number }} + BUILD_NUM=$REV-PR-$PR REPO_NAME=$GITHUB_REPOSITORY + curl \ -k \ https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN \ From 3855fe0a6d983123dc085eb7d705ca25ce9b8c88 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 16:43:36 -0500 Subject: [PATCH 22/31] reinstate full test suite --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index a1b988b91..c61331885 100644 --- a/tox.ini +++ b/tox.ini @@ -50,7 +50,7 @@ extras = test setenv = # Define TEST_SUITE in the environment as an aid to constructing the # correct test command below. - !py36: TEST_SUITE = allmydata.test.test_abbreviate + !py36: TEST_SUITE = allmydata py36: TEST_SUITE = allmydata.test.python3_tests commands = From 35614d13828427ad65f3ae9686241f75e7bbb423 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 17:46:40 -0500 Subject: [PATCH 23/31] Remove the codecov badge --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 98150ed27..f12a41945 100644 --- a/README.rst +++ b/README.rst @@ -6,7 +6,7 @@ Free and Open decentralized data store `Tahoe-LAFS `__ (Tahoe Least-Authority File Store) is the first free software / open-source storage technology that distributes your data across multiple servers. Even if some servers fail or are taken over by an attacker, the entire file store continues to function correctly, preserving your privacy and security. -|Contributor Covenant| |readthedocs| |travis| |circleci| |codecov| +|Contributor Covenant| |readthedocs| |travis| |circleci| Table of contents From e9a7838d882a96128ec64ea7b93eecce4aa93b54 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 17:46:50 -0500 Subject: [PATCH 24/31] Remove the codecov anchor --- README.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.rst b/README.rst index f12a41945..ef094456c 100644 --- a/README.rst +++ b/README.rst @@ -125,9 +125,6 @@ See `TGPPL.PDF `__ for why the TGPPL ex .. |circleci| image:: https://circleci.com/gh/tahoe-lafs/tahoe-lafs.svg?style=svg :target: https://circleci.com/gh/tahoe-lafs/tahoe-lafs -.. |codecov| image:: https://codecov.io/github/tahoe-lafs/tahoe-lafs/coverage.svg?branch=master - :alt: test coverage percentage - :target: https://codecov.io/github/tahoe-lafs/tahoe-lafs?branch=master .. |Contributor Covenant| image:: https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg :alt: code of conduct From b06730b9afb6a67465ace0515ac3c4d5bceb7864 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 17:46:58 -0500 Subject: [PATCH 25/31] Add the coveralls.io badge --- README.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index ef094456c..b1f6d2563 100644 --- a/README.rst +++ b/README.rst @@ -6,7 +6,7 @@ Free and Open decentralized data store `Tahoe-LAFS `__ (Tahoe Least-Authority File Store) is the first free software / open-source storage technology that distributes your data across multiple servers. Even if some servers fail or are taken over by an attacker, the entire file store continues to function correctly, preserving your privacy and security. -|Contributor Covenant| |readthedocs| |travis| |circleci| +|Contributor Covenant| |readthedocs| |travis| |circleci| |coveralls| Table of contents @@ -125,6 +125,9 @@ See `TGPPL.PDF `__ for why the TGPPL ex .. |circleci| image:: https://circleci.com/gh/tahoe-lafs/tahoe-lafs.svg?style=svg :target: https://circleci.com/gh/tahoe-lafs/tahoe-lafs +.. |coveralls| image:: https://coveralls.io/repos/github/tahoe-lafs/tahoe-lafs/badge.svg + :alt: code coverage + :target: https://coveralls.io/github/tahoe-lafs/tahoe-lafs .. |Contributor Covenant| image:: https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg :alt: code of conduct From f5ba293f79de8672ca1e625da1ee942b79a2ef0b Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 20:27:17 -0500 Subject: [PATCH 26/31] Ideally this is no longer necessary --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0451c3bd1..6d21cd247 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: - name: "Report Coverage to Coveralls" run: | pip install coveralls - python -m coveralls --verbose + python -m coveralls env: # Some magic value required for some magic reason. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" From e382ef8a893b1984d3f1fc1033f36b92fb55da4a Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 20:27:41 -0500 Subject: [PATCH 27/31] Clean up the explanation, link to some more/better stuff --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d21cd247..2aaf2f6c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -162,20 +162,36 @@ jobs: # However, we have the further constraint that our build_num must # agree with whatever coveralls-python has selected. An inspection # of the coveralls-python source suggests that GITHUB_RUN_ID is - # used. However, observation of the coveralls.io web interface - # suggests the value instead is something more like: + # used: # - # $(git rev-parse refs/pull//merge)-PR- + # * https://github.com/coveralls-clients/coveralls-python/blob/a9b36299ce9ba3bb6858700781881029d82e545d/coveralls/api.py#L105-L109 + # * https://github.com/coveralls-clients/coveralls-python/blob/a9b36299ce9ba3bb6858700781881029d82e545d/coveralls/api.py#L54-L59 # - # Thus, we select the same. + # However, observation of the coveralls.io web interface, logs from + # the coveralls command in action, and experimentation suggests the + # value instead is something more like: + # + # -PR- + # + # For PRs it is the merge commit (`refs/pull//merge`). For + # branches, the tip. - # refs/pull//merge was justed checked out by so we can just - # rev-parse HEAD to find the revision. + # For pull requests, refs/pull//merge was just checked out + # by so HEAD will refer to the right revision. For branches, HEAD + # is also the tip of the branch. REV=$(git rev-parse HEAD) # We can get the PR number from the "context". - # https://github.community/t/github-ref-is-inconsistent/17728/3 - # https://docs.github.com/en/free-pro-team@latest/articles/events-that-trigger-workflows + # + # https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events/webhook-events-and-payloads#pull_request + # + # (via ). + # + # If this is a pull request, `github.event` is a `pull_request` + # structure which has `number` right in it. + # + # If this is a push, `github.event` is a `push` instead and ... XXX ??? + PR=${{ github.event.number }} BUILD_NUM=$REV-PR-$PR From 3b8df95e3e19d4b3aaa30799ff6e630fb10fae7f Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 6 Jan 2021 20:52:12 -0500 Subject: [PATCH 28/31] Try constructing build_num differently for push --- .github/workflows/ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2aaf2f6c0..701b6815c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -190,11 +190,16 @@ jobs: # If this is a pull request, `github.event` is a `pull_request` # structure which has `number` right in it. # - # If this is a push, `github.event` is a `push` instead and ... XXX ??? + # If this is a push, `github.event` is a `push` instead but we only + # need the revision to construct the build_num. PR=${{ github.event.number }} - BUILD_NUM=$REV-PR-$PR + if [ "${PR}" = "" ]; then + BUILD_NUM=$REV + else + BUILD_NUM=$REV-PR-$PR + fi REPO_NAME=$GITHUB_REPOSITORY curl \ From 709823e5629140299d2f1fb191dbdfdbd3583dd7 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Thu, 7 Jan 2021 18:24:57 -0500 Subject: [PATCH 29/31] most of those words proved irrelevant --- .github/workflows/ci.yml | 66 ++++------------------------------------ 1 file changed, 6 insertions(+), 60 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 701b6815c..5c7b21151 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,7 +104,7 @@ jobs: # # But all it does is this simple POST so we can just send it # ourselves. The only hard part is guessing what the POST - # parameters mean. + # parameters mean. And I've done that for you already. # # Since the build is done I'm going to guess that "done" is a fine # value for status. @@ -114,67 +114,13 @@ jobs: # is on CircleCI. CircleCI documentation says this about # CIRCLE_WORKFLOW_ID: # - # A unique identifier for the workflow instance of the current - # job. This identifier is the same for every job in a given - # workflow instance. + # Observation of the coveralls.io web interface, logs from the + # coveralls command in action, and experimentation suggests the + # value for PRs is something more like: # - # (from https://circleci.com/docs/2.0/env-vars/) + # -PR- # - # A CircleCI workflow is roughly "the group of jobs run for a - # particular commit". There are exceptions to this but maybe we can - # ignore them. - # - # The only over hints we get from Coveralls about "build_num" are: - # - # * An example value of `1234` - # - # * Another example value of `$BUILD_NUMBER` where BUILD_NUMBER is - # not defined anywhere. - # - # Starting from the CircleCI workflow example, then, and looking at - # the environment variables GitHub Actions offers - # (https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables) there are two of interest: - # - # * GITHUB_RUN_ID - A unique number for each run within a - # repository. This number does not change if you re-run the - # workflow run. - # - # * GITHUB_RUN_NUMBER - A unique number for each run of a particular - # workflow in a repository. This number begins at 1 for the - # workflow's first run, and increments with each new run. This - # number does not change if you re-run the workflow run. - # - # These seem to offer approximately the same value and only differ - # on whether they will be unique for the project as a whole or just - # for this particular workflow ("ci", as defined by this file). - # - # Unfortunately neither of them changes if a workflow is re-run. - # This differs from the behavior of CircleCI's CIRCLE_WORKFLOW_ID - # where a new value is assigned if a workflow is re-run. - # - # The consequence of this would seem to be that multiple runs of a - # GitHub Actions workflow will have their coverage reported to the - # same job. And since we eventually "finish" a job, later runs - # would be discarded (I suppose). - # - # There doesn't seem to be a way to do any better, though. - # - # However, we have the further constraint that our build_num must - # agree with whatever coveralls-python has selected. An inspection - # of the coveralls-python source suggests that GITHUB_RUN_ID is - # used: - # - # * https://github.com/coveralls-clients/coveralls-python/blob/a9b36299ce9ba3bb6858700781881029d82e545d/coveralls/api.py#L105-L109 - # * https://github.com/coveralls-clients/coveralls-python/blob/a9b36299ce9ba3bb6858700781881029d82e545d/coveralls/api.py#L54-L59 - # - # However, observation of the coveralls.io web interface, logs from - # the coveralls command in action, and experimentation suggests the - # value instead is something more like: - # - # -PR- - # - # For PRs it is the merge commit (`refs/pull//merge`). For - # branches, the tip. + # For branches, it's just the git branch tip hash. # For pull requests, refs/pull//merge was just checked out # by so HEAD will refer to the right revision. For branches, HEAD From 5614c4c3f4a80699dc3700f72068b5d3a6464ed3 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Fri, 8 Jan 2021 08:27:00 -0500 Subject: [PATCH 30/31] improve this comment marginally just looking for an excuse to trigger another build and see if inviting "coveralls" to be a collaborator on LeastAuthority/tahoe-lafs fixes the status reporting issue. --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c7b21151..f690d11ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,9 @@ jobs: # Mark the data as just one piece of many because we have more than # one instance of this job (Windows, macOS) which collects and # reports coverage. This is necessary to cause Coveralls to merge - # multiple coverage results into a single report. + # multiple coverage results into a single report. Note the merge + # only happens when we "finish" a particular build, as identified by + # its "build_num" (aka "service_number"). COVERALLS_PARALLEL: true # Tell Coveralls that we're done reporting coverage data. Since we're using From e72c93a9826f7950cedfcdffaf2c631cd7b0a7b6 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Fri, 8 Jan 2021 08:52:38 -0500 Subject: [PATCH 31/31] explain why we're not using the github action here --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f690d11ea..4f63ed19a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,10 @@ jobs: name: eliot.log path: eliot.log - # Upload this job's coverage data to Coveralls. + # Upload this job's coverage data to Coveralls. While there is a GitHub + # Action for this, as of Jan 2021 it does not support Python coverage + # files - only lcov files. Therefore, we use coveralls-python, the + # coveralls.io-supplied Python reporter, for this. - name: "Report Coverage to Coveralls" run: | pip install coveralls