Skip to content

Commit 4eb9bbc

Browse files
committed
Run tests against snapd stable
Otherwise we might end up merging things that depend on fixes of snapd that are not released.
1 parent d8a9c76 commit 4eb9bbc

4 files changed

Lines changed: 131 additions & 88 deletions

File tree

.github/workflows/tests-main.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Tests main workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
snapd_branch:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
tests-main:
12+
runs-on: self-hosted
13+
env:
14+
SNAP_BRANCH: ${{ inputs.snapd_branch }}
15+
steps:
16+
- name: Cleanup job workspace
17+
id: cleanup-job-workspace
18+
run: |
19+
rm -rf "${{ github.workspace }}"
20+
mkdir "${{ github.workspace }}"
21+
- uses: actions/checkout@v2
22+
- uses: actions/download-artifact@v2
23+
with:
24+
name: core-snap
25+
path: "${{ github.workspace }}/core24.artifact"
26+
27+
- name: Run x86 tests
28+
run: |
29+
spread google-nested:tests/spread/main/
30+
31+
- name: Run arm64 tests
32+
run: |
33+
spread google-nested-arm:tests/spread/main/
34+
35+
- name: Discard spread workers
36+
if: always()
37+
run: |
38+
shopt -s nullglob
39+
for r in .spread-reuse.*.yaml; do
40+
spread -discard -reuse-pid="$(echo "$r" | grep -o -E '[0-9]+')"
41+
done

.github/workflows/tests-snapd.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Tests snapd workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
snapd_branch:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
tests-snapd:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Cleanup job workspace
15+
id: cleanup-job-workspace
16+
run: |
17+
rm -rf "${{ github.workspace }}"
18+
mkdir "${{ github.workspace }}"
19+
20+
- uses: actions/checkout@v2
21+
with:
22+
path: core-base
23+
- uses: actions/checkout@v2
24+
with:
25+
repository: 'snapcore/snapd'
26+
path: snapd
27+
- uses: actions/download-artifact@v2
28+
with:
29+
name: core-snap
30+
31+
- name: Install spread
32+
run: curl -s https://storage.googleapis.com/snapd-spread-tests/spread/spread-amd64.tar.gz | sudo tar xzv -C /usr/bin
33+
34+
- name: Build image
35+
working-directory: '${{ github.workspace }}'
36+
run: |
37+
PROJECT_PATH=$PWD/core-base
38+
# For os.query and others
39+
PATH=$PATH:$PROJECT_PATH/tests/lib/external/snapd-testing-tools/tools/
40+
. "core-base/tests/lib/prepare-utils.sh"
41+
42+
echo "************* INSTALLING DEPS *************"
43+
install_base_deps
44+
45+
echo "************* DOWNLOADING SNAPS *************"
46+
download_core24_snaps ${{ inputs.snapd_branch }}
47+
48+
echo "************* WRITING CLOUD-INIT CONFIG *************"
49+
prepare_base_cloudinit
50+
51+
echo "************* BUILDING CORE24 IMAGE *************"
52+
uc_snap="$(get_core_snap_name)"
53+
mv core24.artifact "$uc_snap"
54+
build_core24_image
55+
56+
echo "************* STARTING CORE24 VM *************"
57+
start_snapd_core_vm '${{ github.workspace }}'
58+
59+
cd snapd
60+
61+
# add any test suites that should be tested here
62+
SPREAD_EXTERNAL_ADDRESS=localhost:8022 spread external:ubuntu-core-24-64:tests/smoke/
63+
64+
- name: Discard spread workers
65+
if: always()
66+
run: |
67+
shopt -s nullglob
68+
for r in .spread-reuse.*.yaml; do
69+
spread -discard -reuse-pid="$(echo "$r" | grep -o -E '[0-9]+')"
70+
done
71+

.github/workflows/tests.yaml

Lines changed: 18 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -46,95 +46,26 @@ jobs:
4646
spread -discard -reuse-pid="$(echo "$r" | grep -o -E '[0-9]+')"
4747
done
4848
49-
tests-main:
50-
runs-on: self-hosted
49+
tests-main-stable:
5150
needs: build
52-
steps:
53-
- name: Cleanup job workspace
54-
id: cleanup-job-workspace
55-
run: |
56-
rm -rf "${{ github.workspace }}"
57-
mkdir "${{ github.workspace }}"
58-
- uses: actions/checkout@v2
59-
- uses: actions/download-artifact@v2
60-
with:
61-
name: core-snap
62-
path: "${{ github.workspace }}/core24.artifact"
63-
64-
- name: Run x86 tests
65-
run: |
66-
spread google-nested:tests/spread/main/
51+
uses: ./.github/workflows/tests-main.yml
52+
with:
53+
snapd_branch: stable
6754

68-
- name: Run arm64 tests
69-
run: |
70-
spread-arm google-nested-arm:tests/spread/main/
71-
72-
- name: Discard spread workers
73-
if: always()
74-
run: |
75-
shopt -s nullglob
76-
for r in .spread-reuse.*.yaml; do
77-
spread -discard -reuse-pid="$(echo "$r" | grep -o -E '[0-9]+')"
78-
done
79-
tests-snapd:
80-
runs-on: ubuntu-latest
55+
tests-main-edge:
8156
needs: build
82-
steps:
83-
- name: Cleanup job workspace
84-
id: cleanup-job-workspace
85-
run: |
86-
rm -rf "${{ github.workspace }}"
87-
mkdir "${{ github.workspace }}"
88-
89-
- uses: actions/checkout@v2
90-
with:
91-
path: core-base
92-
- uses: actions/checkout@v2
93-
with:
94-
repository: 'snapcore/snapd'
95-
path: snapd
96-
- uses: actions/download-artifact@v2
97-
with:
98-
name: core-snap
99-
100-
- name: Install spread
101-
run: curl -s https://storage.googleapis.com/snapd-spread-tests/spread/spread-amd64.tar.gz | sudo tar xzv -C /usr/bin
102-
103-
- name: Build image
104-
working-directory: '${{ github.workspace }}'
105-
run: |
106-
PROJECT_PATH=$PWD/core-base
107-
# For os.query and others
108-
PATH=$PATH:$PROJECT_PATH/tests/lib/external/snapd-testing-tools/tools/
109-
. "core-base/tests/lib/prepare-utils.sh"
110-
111-
echo "************* INSTALLING DEPS *************"
112-
install_base_deps
113-
114-
echo "************* DOWNLOADING SNAPS *************"
115-
download_core24_snaps 'edge'
116-
117-
echo "************* WRITING CLOUD-INIT CONFIG *************"
118-
prepare_base_cloudinit
57+
uses: ./.github/workflows/tests-main.yml
58+
with:
59+
snapd_branch: edge
11960

120-
echo "************* BUILDING CORE24 IMAGE *************"
121-
uc_snap="$(get_core_snap_name)"
122-
mv core24.artifact "$uc_snap"
123-
build_base_image
124-
125-
echo "************* STARTING CORE24 VM *************"
126-
start_snapd_core_vm '${{ github.workspace }}'
127-
128-
cd snapd
129-
130-
# add any test suites that should be tested here
131-
SPREAD_EXTERNAL_ADDRESS=localhost:8022 spread external:ubuntu-core-24-64:tests/smoke/
132-
133-
- name: Discard spread workers
134-
if: always()
135-
run: |
136-
shopt -s nullglob
137-
for r in .spread-reuse.*.yaml; do
138-
spread -discard -reuse-pid="$(echo "$r" | grep -o -E '[0-9]+')"
139-
done
61+
tests-snapd-stable:
62+
needs: build
63+
uses: ./.github/workflows/tests-snapd.yml
64+
with:
65+
snapd_branch: stable
14066

67+
tests-snapd-edge:
68+
needs: build
69+
uses: ./.github/workflows/tests-snapd.yml
70+
with:
71+
snapd_branch: edge

spread.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ environment:
55
PROJECT_PATH: $SETUPDIR
66
PATH: $PATH:$PROJECT_PATH/tests/bin:$PROJECT_PATH/tests/lib/external/snapd-testing-tools/tools/
77
TESTSLIB: $PROJECT_PATH/tests/lib
8-
SNAP_BRANCH: "edge" # stable/edge/beta
8+
SNAP_BRANCH: '$(HOST: echo "${SNAP_BRANCH:-stable}")'
99
UC_VERSION: 24
1010
# TODO: are these vars needed still?
1111
LANG: "C.UTF-8"

0 commit comments

Comments
 (0)