From ab9589e323939c6025a9637c5bb2bfca1ac21ff4 Mon Sep 17 00:00:00 2001 From: Callahan Kovacs Date: Fri, 27 Sep 2024 08:50:25 -0500 Subject: [PATCH 1/2] debugging Signed-off-by: Callahan Kovacs --- .github/workflows/cla-check.yaml | 9 --- .github/workflows/publish.yaml | 62 --------------- .github/workflows/spread-scheduled.yaml | 80 -------------------- .github/workflows/spread.yml | 42 ---------- .github/workflows/tics.yaml | 47 ------------ .github/workflows/tox.yaml | 78 ------------------- tests/spread/store/validation-sets/editor.sh | 2 + tests/spread/store/validation-sets/task.yaml | 2 + 8 files changed, 4 insertions(+), 318 deletions(-) delete mode 100644 .github/workflows/cla-check.yaml delete mode 100644 .github/workflows/publish.yaml delete mode 100644 .github/workflows/spread-scheduled.yaml delete mode 100644 .github/workflows/tics.yaml delete mode 100644 .github/workflows/tox.yaml diff --git a/.github/workflows/cla-check.yaml b/.github/workflows/cla-check.yaml deleted file mode 100644 index cdb271af63..0000000000 --- a/.github/workflows/cla-check.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: cla-check -on: [pull_request] - -jobs: - cla-check: - runs-on: ubuntu-latest - steps: - - name: Check if CLA signed - uses: canonical/has-signed-canonical-cla@v1 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index 256bc582db..0000000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,62 +0,0 @@ -name: CI - -on: - pull_request: - push: - branches: - - "feature/**" - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - name: Decision to Publish - id: decisions - run: | - # Secrets cannot be used in conditionals, so this is our dance: - # https://github.com/actions/runner/issues/520 - if [[ -n "${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}" ]]; then - echo PUBLISH=true >> $GITHUB_OUTPUT - else - echo PUBLISH= >> $GITHUB_OUTPUT - fi - - - if: steps.decisions.outputs.PUBLISH == 'true' - name: Checkout Snapcraft - uses: actions/checkout@v4 - with: - # Fetch all of history so Snapcraft can determine its own version from git. - fetch-depth: 0 - - - if: steps.decisions.outputs.PUBLISH == 'true' - uses: canonical/action-build@v1 - name: Build Snapcraft Snap - id: build - with: - snapcraft-channel: latest/candidate - - - if: steps.decisions.outputs.PUBLISH == 'true' - name: Verify Snapcraft Snap - run: | - # Make sure it is installable. - sudo snap install --dangerous --classic ${{ steps.build.outputs.snap }} - - - name: Get branch name - id: vars - run: | - if [[ "${{ github.event_name }}" == "pull_request" ]] - then - echo "branch=pr-${{ github.event.number }}" >> "$GITHUB_OUTPUT" - else - branch=$(echo ${GITHUB_REF#refs/*/} | sed -e 's|feature/\(.*\)|\1|') - echo "branch=$branch" >> "$GITHUB_OUTPUT" - fi - - - name: Publish feature branch to edge/${{ steps.vars.outputs.branch }} - if: steps.decisions.outputs.PUBLISH == 'true' - uses: canonical/action-publish@v1 - env: - SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} - with: - snap: ${{ steps.build.outputs.snap }} - release: edge/${{ steps.vars.outputs.branch }} diff --git a/.github/workflows/spread-scheduled.yaml b/.github/workflows/spread-scheduled.yaml deleted file mode 100644 index ce99ecf9b5..0000000000 --- a/.github/workflows/spread-scheduled.yaml +++ /dev/null @@ -1,80 +0,0 @@ -name: Scheduled spread tests -on: - schedule: - # At 03:00 on Wednesday and Sunday. - - cron: "0 3 * * WED,SUN" - workflow_dispatch: - -jobs: - snap-build: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Build snap - uses: canonical/action-build@v1 - id: snapcraft - - name: Upload snap artifact - uses: actions/upload-artifact@v4 - with: - name: snap - path: ${{ steps.snapcraft.outputs.snap }} - - name: Verify snapcraft snap - run: | - sudo snap install --dangerous --classic ${{ steps.snapcraft.outputs.snap }} - - kernel-plugins: - runs-on: [spread-installed] - needs: [snap-build] - strategy: - fail-fast: false - matrix: - type: [craft-parts, v2] - steps: - - name: Cleanup job workspace - run: | - rm -rf "${{ github.workspace }}" - mkdir "${{ github.workspace }}" - - name: Checkout snapcraft - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: true - - name: Download snap artifact - uses: actions/download-artifact@v4 - with: - name: snap - path: tests - - name: Kernel plugin test - run: | - spread google:ubuntu-22.04-64:tests/spread/plugins/${{ matrix.type }}/kernel - - remote-build: - runs-on: [spread-installed] - needs: [snap-build] - steps: - - name: Cleanup job workspace - run: | - rm -rf "${{ github.workspace }}" - mkdir "${{ github.workspace }}" - - name: Checkout snapcraft - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: true - - name: Download snap artifact - uses: actions/download-artifact@v4 - with: - name: snap - path: tests - - name: remote-build test - env: - LAUNCHPAD_TOKEN: "${{ secrets.LAUNCHPAD_TOKEN }}" - run: | - spread google:ubuntu-20.04-64:tests/spread/core20/remote-build-legacy \ - google:ubuntu-22.04-64:tests/spread/core22/remote-build-legacy \ - google:ubuntu-22.04-64:tests/spread/core22/remote-build \ - google:ubuntu-24.04-64:tests/spread/core24/remote-build \ - google:fedora-39-64:tests/spread/core24/remote-build:no_platforms diff --git a/.github/workflows/spread.yml b/.github/workflows/spread.yml index 9f55db8b71..ef38dc13f2 100644 --- a/.github/workflows/spread.yml +++ b/.github/workflows/spread.yml @@ -26,48 +26,6 @@ jobs: run: | sudo snap install --dangerous --classic ${{ steps.build-snapcraft.outputs.snap }} - integration-spread-tests: - runs-on: [spread-installed] - needs: build - strategy: - # FIXME: enable fail-fast mode once spread can cancel an executing job. - # Disable fail-fast mode as it doesn't function with spread. It seems - # that cancelling tasks requires short, interruptible actions and - # interrupting spread, notably, does not work today. As such disable - # fail-fast while we tackle that problem upstream. - fail-fast: false - matrix: - spread-jobs: - - google:ubuntu-20.04-64 - - google:ubuntu-22.04-64 - - google:ubuntu-24.04-64 - - steps: - - name: Checkout snapcraft - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: true - - - name: Download snapcraft snap - uses: actions/download-artifact@v4 - with: - name: snap - path: tests - - - name: Run spread - env: - SPREAD_GOOGLE_KEY: ${{ secrets.SPREAD_GOOGLE_KEY }} - UA_TOKEN: ${{ secrets.UA_TOKEN }} - run: spread ${{ matrix.spread-jobs }} - - - name: Discard spread workers - if: always() - run: | - shopt -s nullglob - for r in .spread-reuse.*.yaml; do - spread -discard -reuse-pid="$(echo "$r" | grep -o -E '[0-9]+')" - done integration-spread-tests-store: runs-on: [spread-installed] diff --git a/.github/workflows/tics.yaml b/.github/workflows/tics.yaml deleted file mode 100644 index b3bd736492..0000000000 --- a/.github/workflows/tics.yaml +++ /dev/null @@ -1,47 +0,0 @@ -name: TICS - -on: - push: - branches: - - main - # to easy test changes to the workflow - - tiobe - -jobs: - CI: - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install dependencies - run: | - echo "::group::apt-get update" - sudo apt-get update - echo "::endgroup::" - echo "::group::apt-get install..." - sudo apt-get install -y python3 python3-dev libapt-pkg-dev libyaml-dev xdelta3 patchelf - echo "::endgroup::" - echo "::group::pip install" - python -m pip install 'tox<5.0' tox-gh - echo "::endgroup::" - - - name: Setup Tox environment - run: tox --workdir /tmp/tox run-parallel --parallel auto --parallel-no-spinner --parallel-live --colored yes -e test-all-py310 --notest - - - name: Test with tox - run: tox --workdir /tmp/tox run --skip-pkg-install --result-json results/tox-py310.json --colored yes -e test-all-py310 - - - name: Run TICS analysis - uses: tiobe/tics-github-action@v3 - env: - PATH: "/tmp/tox/test-all-py310/bin:/snap/bin:/home/runner/.local/bin:/home/runner/.cargo/bin:/bin:/usr/bin:/usr/local/bin:" - with: - mode: qserver - project: snapcraft - viewerUrl: https://canonical.tiobe.com/tiobeweb/TICS/api/cfg?name=default - branchdir: ${{ github.workspace }} - ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }} - installTics: true diff --git a/.github/workflows/tox.yaml b/.github/workflows/tox.yaml deleted file mode 100644 index abfdf47baa..0000000000 --- a/.github/workflows/tox.yaml +++ /dev/null @@ -1,78 +0,0 @@ -name: Tox -on: - push: - branches: - - "main" - - "snapcraft/7.0" - - "release/*" - - "hotfix/*" - pull_request: - -jobs: - linters: - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Install dependencies - run: | - echo "::group::Begin snap install" - echo "Installing snaps in the background while running apt and pip..." - sudo snap install --no-wait --classic pyright --revision 735 # version 1.1.344 - sudo snap install --no-wait shellcheck ruff - echo "::endgroup::" - echo "::group::apt-get update" - sudo apt-get update - echo "::endgroup::" - echo "::group::apt-get install..." - sudo apt-get install --yes python3 python3-dev libapt-pkg-dev libyaml-dev xdelta3 - echo "::endgroup::" - echo "::group::pip install" - python -m pip install 'tox<5.0' tox-gh - echo "::endgroup::" - echo "::group::Create virtual environments for linting processes." - tox run --colored yes -m lint build-docs --notest - echo "::endgroup::" - echo "::group::Build docs." - tox run --colored yes -e build-docs - echo "::endgroup::" - echo "::group::Wait for snap to complete" - snap watch --last=install - echo "::endgroup::" - - name: Run Linters - run: tox run --colored yes --skip-pkg-install -m lint - tests: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Install dependencies - run: | - echo "::group::apt-get update" - sudo apt-get update - echo "::endgroup::" - echo "::group::apt-get install..." - sudo apt-get install -y python3 python3-dev libapt-pkg-dev libyaml-dev xdelta3 - echo "::endgroup::" - echo "::group::pip install" - python -m pip install 'tox<5.0' tox-gh - echo "::endgroup::" - mkdir -p results - - name: Setup Tox environments - run: tox run-parallel --parallel auto --parallel-no-spinner --parallel-live --colored yes -e test-py310,test-legacy-py310 --notest - - name: Test with tox - run: tox run --skip-pkg-install --result-json results/tox-ubuntu-22.04.json --colored yes -e test-py310,test-legacy-py310 - - name: Upload code coverage - uses: codecov/codecov-action@v4 - with: - directory: ./results/ - files: coverage*.xml - - name: Upload test results - if: success() || failure() - uses: actions/upload-artifact@v4 - with: - name: test-results-ubuntu-22.04 - path: results/ diff --git a/tests/spread/store/validation-sets/editor.sh b/tests/spread/store/validation-sets/editor.sh index a38c96be47..7fb49a5c8b 100755 --- a/tests/spread/store/validation-sets/editor.sh +++ b/tests/spread/store/validation-sets/editor.sh @@ -2,6 +2,8 @@ validation_set_file="$1" +cat "$validation_set_file" + # flip-flop between two valid revisions of `test-snapcraft-assertions` in the staging store: 1 and 2 if grep -q "^ revision:.*1" "$validation_set_file"; then (( revision=2 )) diff --git a/tests/spread/store/validation-sets/task.yaml b/tests/spread/store/validation-sets/task.yaml index 277ee9d8e1..b477d9dc65 100644 --- a/tests/spread/store/validation-sets/task.yaml +++ b/tests/spread/store/validation-sets/task.yaml @@ -35,6 +35,8 @@ execute: | snapcraft list-validation-sets | MATCH testset + exit 1 + restore: | rm -rf "$HOME/.snap/gnupg" From aff2acc74723659560060634f9a6258283736ef6 Mon Sep 17 00:00:00 2001 From: Callahan Kovacs Date: Fri, 27 Sep 2024 09:12:09 -0500 Subject: [PATCH 2/2] debugging Signed-off-by: Callahan Kovacs --- tests/spread/store/validation-sets/editor.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/spread/store/validation-sets/editor.sh b/tests/spread/store/validation-sets/editor.sh index 7fb49a5c8b..08b18eaad9 100755 --- a/tests/spread/store/validation-sets/editor.sh +++ b/tests/spread/store/validation-sets/editor.sh @@ -4,11 +4,14 @@ validation_set_file="$1" cat "$validation_set_file" -# flip-flop between two valid revisions of `test-snapcraft-assertions` in the staging store: 1 and 2 -if grep -q "^ revision:.*1" "$validation_set_file"; then - (( revision=2 )) -else - (( revision=1 )) -fi - -sed -i "s/ revision:.*/ revision: $revision/g" "$validation_set_file" +cat << EOF > $validation_set_file +account-id: pv8nW1ZaULF7xXAkE3tiU3TdlOnYlGUr +name: testset +sequence: 1 +# The revision for this validation set +# revision: 61 +snaps: +- id: JtwEnisYi8Mmk51vNLZPSOwSOFLwGdhs + name: hello-world + presence: required +EOF