Skip to content

Commit

Permalink
Run tests against snapd stable
Browse files Browse the repository at this point in the history
Otherwise we might end up merging things that depend on fixes of snapd
that are not released.
  • Loading branch information
valentindavid committed Nov 15, 2022
1 parent bb8b566 commit 49100f1
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 82 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/tests-main.yaml
Original file line number Diff line number Diff line change
@@ -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
68 changes: 68 additions & 0 deletions .github/workflows/tests-snapd.yml
Original file line number Diff line number Diff line change
@@ -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
98 changes: 18 additions & 80 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 49100f1

Please sign in to comment.