From 4eb9bbce716c8a6dd5e4f2aef5e73f93e6759e1b Mon Sep 17 00:00:00 2001 From: Valentin David Date: Mon, 14 Nov 2022 15:41:08 +0100 Subject: [PATCH] Run tests against snapd stable Otherwise we might end up merging things that depend on fixes of snapd that are not released. --- .github/workflows/tests-main.yml | 41 ++++++++++++ .github/workflows/tests-snapd.yml | 71 ++++++++++++++++++++ .github/workflows/tests.yaml | 105 +++++------------------------- spread.yaml | 2 +- 4 files changed, 131 insertions(+), 88 deletions(-) create mode 100644 .github/workflows/tests-main.yml create mode 100644 .github/workflows/tests-snapd.yml diff --git a/.github/workflows/tests-main.yml b/.github/workflows/tests-main.yml new file mode 100644 index 00000000..3780e579 --- /dev/null +++ b/.github/workflows/tests-main.yml @@ -0,0 +1,41 @@ +name: Tests main workflow + +on: + workflow_call: + inputs: + snapd_branch: + required: true + type: string + +jobs: + tests-main: + runs-on: self-hosted + env: + SNAP_BRANCH: ${{ inputs.snapd_branch }} + steps: + - name: Cleanup job workspace + id: cleanup-job-workspace + run: | + rm -rf "${{ github.workspace }}" + mkdir "${{ github.workspace }}" + - uses: actions/checkout@v2 + - uses: actions/download-artifact@v2 + with: + name: core-snap + path: "${{ github.workspace }}/core24.artifact" + + - name: Run x86 tests + run: | + spread google-nested:tests/spread/main/ + + - name: Run arm64 tests + run: | + spread google-nested-arm:tests/spread/main/ + + - 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 diff --git a/.github/workflows/tests-snapd.yml b/.github/workflows/tests-snapd.yml new file mode 100644 index 00000000..d19e325e --- /dev/null +++ b/.github/workflows/tests-snapd.yml @@ -0,0 +1,71 @@ +name: Tests snapd workflow + +on: + workflow_call: + inputs: + snapd_branch: + required: true + type: string + +jobs: + tests-snapd: + runs-on: ubuntu-latest + steps: + - name: Cleanup job workspace + id: cleanup-job-workspace + run: | + rm -rf "${{ github.workspace }}" + mkdir "${{ github.workspace }}" + + - uses: actions/checkout@v2 + with: + path: core-base + - uses: actions/checkout@v2 + with: + repository: 'snapcore/snapd' + path: snapd + - uses: actions/download-artifact@v2 + with: + name: core-snap + + - name: Install spread + run: curl -s https://storage.googleapis.com/snapd-spread-tests/spread/spread-amd64.tar.gz | sudo tar xzv -C /usr/bin + + - name: Build image + working-directory: '${{ github.workspace }}' + run: | + PROJECT_PATH=$PWD/core-base + # For os.query and others + PATH=$PATH:$PROJECT_PATH/tests/lib/external/snapd-testing-tools/tools/ + . "core-base/tests/lib/prepare-utils.sh" + + echo "************* INSTALLING DEPS *************" + install_base_deps + + echo "************* DOWNLOADING SNAPS *************" + download_core24_snaps ${{ inputs.snapd_branch }} + + echo "************* WRITING CLOUD-INIT CONFIG *************" + prepare_base_cloudinit + + echo "************* BUILDING CORE24 IMAGE *************" + uc_snap="$(get_core_snap_name)" + mv core24.artifact "$uc_snap" + build_core24_image + + echo "************* STARTING CORE24 VM *************" + start_snapd_core_vm '${{ github.workspace }}' + + cd snapd + + # add any test suites that should be tested here + SPREAD_EXTERNAL_ADDRESS=localhost:8022 spread external:ubuntu-core-24-64:tests/smoke/ + + - 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 + diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 4b2a5e26..43df7fd4 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -46,95 +46,26 @@ jobs: spread -discard -reuse-pid="$(echo "$r" | grep -o -E '[0-9]+')" done - tests-main: - runs-on: self-hosted + tests-main-stable: needs: build - steps: - - name: Cleanup job workspace - id: cleanup-job-workspace - run: | - rm -rf "${{ github.workspace }}" - mkdir "${{ github.workspace }}" - - uses: actions/checkout@v2 - - uses: actions/download-artifact@v2 - with: - name: core-snap - path: "${{ github.workspace }}/core24.artifact" - - - name: Run x86 tests - run: | - spread google-nested:tests/spread/main/ + uses: ./.github/workflows/tests-main.yml + with: + snapd_branch: stable - - name: Run arm64 tests - run: | - spread-arm google-nested-arm:tests/spread/main/ - - - 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 - tests-snapd: - runs-on: ubuntu-latest + tests-main-edge: needs: build - steps: - - name: Cleanup job workspace - id: cleanup-job-workspace - run: | - rm -rf "${{ github.workspace }}" - mkdir "${{ github.workspace }}" - - - uses: actions/checkout@v2 - with: - path: core-base - - uses: actions/checkout@v2 - with: - repository: 'snapcore/snapd' - path: snapd - - uses: actions/download-artifact@v2 - with: - name: core-snap - - - name: Install spread - run: curl -s https://storage.googleapis.com/snapd-spread-tests/spread/spread-amd64.tar.gz | sudo tar xzv -C /usr/bin - - - name: Build image - working-directory: '${{ github.workspace }}' - run: | - PROJECT_PATH=$PWD/core-base - # For os.query and others - PATH=$PATH:$PROJECT_PATH/tests/lib/external/snapd-testing-tools/tools/ - . "core-base/tests/lib/prepare-utils.sh" - - echo "************* INSTALLING DEPS *************" - install_base_deps - - echo "************* DOWNLOADING SNAPS *************" - download_core24_snaps 'edge' - - echo "************* WRITING CLOUD-INIT CONFIG *************" - prepare_base_cloudinit + uses: ./.github/workflows/tests-main.yml + with: + snapd_branch: edge - echo "************* BUILDING CORE24 IMAGE *************" - uc_snap="$(get_core_snap_name)" - mv core24.artifact "$uc_snap" - build_base_image - - echo "************* STARTING CORE24 VM *************" - start_snapd_core_vm '${{ github.workspace }}' - - cd snapd - - # add any test suites that should be tested here - SPREAD_EXTERNAL_ADDRESS=localhost:8022 spread external:ubuntu-core-24-64:tests/smoke/ - - - 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 + tests-snapd-stable: + needs: build + uses: ./.github/workflows/tests-snapd.yml + with: + snapd_branch: stable + tests-snapd-edge: + needs: build + uses: ./.github/workflows/tests-snapd.yml + with: + snapd_branch: edge diff --git a/spread.yaml b/spread.yaml index 74b0e746..61c26e26 100644 --- a/spread.yaml +++ b/spread.yaml @@ -5,7 +5,7 @@ environment: PROJECT_PATH: $SETUPDIR PATH: $PATH:$PROJECT_PATH/tests/bin:$PROJECT_PATH/tests/lib/external/snapd-testing-tools/tools/ TESTSLIB: $PROJECT_PATH/tests/lib - SNAP_BRANCH: "edge" # stable/edge/beta + SNAP_BRANCH: '$(HOST: echo "${SNAP_BRANCH:-stable}")' UC_VERSION: 24 # TODO: are these vars needed still? LANG: "C.UTF-8"