ci: try running regression tests in a container

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
pull/182/head
Dave Tucker 3 years ago
parent 61c3675b92
commit ce93774e0a

@ -16,7 +16,6 @@ env:
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v1
@ -30,41 +29,14 @@ jobs:
test:
runs-on: ubuntu-20.04
needs: build
container:
image: ghcr.io/aya-rs/aya-test-rtf:main
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rustfmt, clippy, rust-src
override: true
target: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v1
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Set GOPATH
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
env:
GOPATH: ${{runner.workspace}}
- name: Install prereqs
run: |
go install github.com/linuxkit/rtf@latest
cargo install bpf-linker
cargo install rust-script
cargo install sccache
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -qy qemu-utils qemu-system-x86 cloud-image-utils genisoimage
- name: Run regression tests
run: |
ln -s /root/.rustup ${HOME}/.rustup
cd test
rtf -vvv run

@ -0,0 +1,46 @@
name: Aya test image
on:
schedule:
- cron: "42 2 * * 0"
push:
branches:
- 'main'
paths:
- 'images/**'
env:
REGISTRY: ghcr.io
IMAGE_NAME: aya-rs/aya-test-rtf
jobs:
rtf:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
path: ./images
file: Dockerfile.rtf
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

@ -0,0 +1,38 @@
FROM fedora:35
# Rust Nightly
RUN curl https://sh.rustup.rs -sSf | sh -s -- \
--default-toolchain nightly \
--component rustfmt \
--component clippy \
--component rust-src \
--target x86_64-unknown-linux-musl \
-y
ENV PATH "/root/.cargo/bin:$PATH"
# Pre-requisites
RUN dnf install \
--setopt=install_weak_deps=False --best -qy \
golang \
qemu-system-x86 \
cloud-utils \
genisoimage \
libbpf-devel \
clang \
openssl-devel \
musl-libc \
git && dnf clean all \
&& rm -rf /var/cache/yum
RUN cargo install \
bpf-linker \
rust-script \
sccache
RUN go install github.com/linuxkit/rtf@latest
ENV PATH "/root/go/bin:$PATH"
ENV RUSTC_WRAPPER "sccache"
ENTRYPOINT ["rtf"]
CMD ["-vvv", "run"]

@ -7,13 +7,19 @@ common usage behaviours work on real Linux distros
This assumes you have a working Rust and Go toolchain on the host machine
1. `rustup toolcahin add x86_64-unknown-linux-musl`
1. `rustup toolchain add x86_64-unknown-linux-musl`
1. Install [`rtf`](https://github.com/linuxkit/rtf): `go install github.com/linuxkit/rtf@latest`
1. Install rust-script: `cargo install rust-script`
1. Install `qemu` and `cloud-init-utils` package - or any package that provides `cloud-localds`
It is not required, but the tests run significantly faster if you use `sccache`
You may also use the docker image to run the tests:
```
docker run -it --rm --device /dev/kvm -v/home/dave/dev/aya-rs/aya:/src -w /src/test ghcr.io/aya-rs/aya-test-rtf:main
```
## Usage
To read more about how to use `rtf`, see the [documentation](https://github.com/linuxkit/rtf/blob/master/docs/USER_GUIDE.md)

Loading…
Cancel
Save