Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: run the Spread tests with the LXD backend #317

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .github/workflows/spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ on:

jobs:
spread-tests:
name: Run Spread tests
runs-on: ubuntu-latest
strategy:
matrix:
runner:
- name: X64
runs-on: ubuntu-latest
- name: ARM64
runs-on: [noble, ARM64, large]
rebornplusplus marked this conversation as resolved.
Show resolved Hide resolved
name: Run Spread tests | ${{ matrix.runner.name }}
runs-on: ${{ matrix.runner.runs-on }}
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -38,13 +45,16 @@ jobs:
with:
go-version: '>=1.17.0'

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Install LXD
uses: canonical/[email protected]
with:
channel: 5.21/stable
rebornplusplus marked this conversation as resolved.
Show resolved Hide resolved

- name: Prepare Spread suites
id: spread-suites
env:
integration-tests: "tests/spread/integration"
backend: "lxd"
run: |
set -ex
spread_tasks=""
Expand All @@ -54,7 +64,7 @@ jobs:
pkg_tests="${{ env.integration-tests }}/${pkg_name}"
if [ -f "${pkg_tests}/task.yaml" ] && [[ $spread_tasks != *"${pkg_tests}"* ]]
then
spread_tasks="${spread_tasks} ${pkg_tests}"
spread_tasks="${spread_tasks} ${{ env.backend }}:${pkg_tests}"
fi
done

Expand Down
41 changes: 24 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,24 +281,31 @@ existing examples, providing at least the `summary` and `execute` fields inside
[Spread docs](https://github.com/snapcore/spread)),
1. in `test/spread/lib/` you'll also find a set of helper functions that you
can call from within your `task.yaml` execution script,
1. once your test is ready, ensure you have the necessary requirements to run it
locally:
- Docker: you can install it via the [Snap Store](https://snapcraft.io/docker) or
by following the [official instructions](https://docs.docker.com/engine/install/)
- Spread: we recommend installing it from source (with
`go install github.com/snapcore/spread/cmd/spread@latest`), but there's
also a [Spread snap](https://snapcraft.io/spread)
- QEMU: if testing for multiple architectures, you'll need to install these
packages: `sudo apt-get install qemu binfmt-support qemu-user-static`
1. once your test is ready, ensure you have Spread installed (we recommend installing it from source with
`go install github.com/snapcore/spread/cmd/spread@latest`, but there's also a
[Spread snap](https://snapcraft.io/spread)) and also ensure you install the
necessary requirements to run the tests locally:
- with Docker:
- Docker: you can install it via the [Snap Store](https://snapcraft.io/docker) or
by following the [official instructions](https://docs.docker.com/engine/install/)
- QEMU: if testing for multiple architectures, you'll need to install these
packages: `sudo apt-get install qemu binfmt-support qemu-user-static`

or
- with LXD:
- LXD: [install and configure LXD](https://canonical.com/lxd/install),
1. from the repository's root directory, you can now run
`spread tests/spread/integration/<pkg>` for running the tests for your package
`<pkg>` slices, on all architectures. Additionally, you can also:
- run `spread` for orchestrating **all** the tests (not just yours), for all
architectures, or
- run `spread docker:ubuntu-22.04-amd64` for orchestrating **all** the tests
(not just yours) for amd64 only, or
- run `spread docker:ubuntu-22.04-arm64v8:tests/spread/integration/<pkg>`
for running only the tests for your package `<pkg>` slices, on arm64.

```bash
spread lxd:tests/spread/integration/<pkgA> lxd:tests/spread/integration/<pkgB> ...
```

for running the tests for your slices. Additionally, you can also:
- replace `lxd` with `docker` to run the tests on all supported
architectures (NOTE: the `docker` backend might be unable to run tests that
perform privileged operations);
- run `spread docker:ubuntu-22.04-amd64` for orchestrating **all** the tests
(not just yours) with Docker, for amd64 only.

#### 8. Open the PR(s)

Expand Down
Loading