diff --git a/.github/workflows/tests-main.yaml b/.github/workflows/tests-main.yaml new file mode 100644 index 00000000..c1c9ad1e --- /dev/null +++ b/.github/workflows/tests-main.yaml @@ -0,0 +1,37 @@ +name: Tests snapd 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 }}/core22.artifact" + + - name: Run tests + run: | + spread google-nested: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..2010e9a7 --- /dev/null +++ b/.github/workflows/tests-snapd.yml @@ -0,0 +1,68 @@ +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: | + . "core-base/tests/lib/prepare-utils.sh" + + echo "************* INSTALLING DEPS *************" + install_core22_deps + + echo "************* DOWNLOADING SNAPS *************" + download_core22_snaps ${{ inputs.snapd_branch }} + + echo "************* WRITING CLOUD-INIT CONFIG *************" + prepare_core22_cloudinit + + echo "************* BUILDING CORE22 IMAGE *************" + uc_snap="$(get_core_snap_name)" + mv core22.artifact "$uc_snap" + build_core22_image + + echo "************* STARTING CORE22 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-22-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 78878789..81ab7fed 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -39,88 +39,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 }}/core22.artifact" - - - name: Run tests - run: | - spread google-nested:tests/spread/main/ + uses: ./.github/workflows/tests-main.yml + with: + snapd_branch: stable - - 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: | - . "core-base/tests/lib/prepare-utils.sh" - - echo "************* INSTALLING DEPS *************" - install_core22_deps - - echo "************* DOWNLOADING SNAPS *************" - download_core22_snaps 'edge' - - echo "************* WRITING CLOUD-INIT CONFIG *************" - prepare_core22_cloudinit + uses: ./.github/workflows/tests-main.yml + with: + snapd_branch: edge - echo "************* BUILDING CORE22 IMAGE *************" - uc_snap="$(get_core_snap_name)" - mv core22.artifact "$uc_snap" - build_core22_image - - echo "************* STARTING CORE22 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-22-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 8091fac3..498be2a0 100644 --- a/spread.yaml +++ b/spread.yaml @@ -5,11 +5,11 @@ environment: PROJECT_PATH: $SETUPDIR PATH: $PATH:$PROJECT_PATH/tests/bin TESTSLIB: $PROJECT_PATH/tests/lib - SNAP_BRANCH: "edge" # stable/edge/beta UC_VERSION: 22 # TODO: are these vars needed still? LANG: "C.UTF-8" LANGUAGE: "en" + SNAP_BRANCH: '$(HOST: echo "${SNAP_BRANCH:-stable}")' backends: google-nested: @@ -115,7 +115,7 @@ suites: # no enc does not have secure boot or tpm ENABLE_TPM/noenc: false ENABLE_SECURE_BOOT/noenc: false - + prepare: | # prepare common uc image setup by repacking snaps, etc "$TESTSLIB"/prepare-uc.sh