mirror of
https://github.com/stapelberg/router7.git
synced 2025-09-26 19:11:16 +08:00
GitHub Actions: run tests in nix-shell, not Docker
This commit is contained in:
11
.github/workflows/go.yml
vendored
11
.github/workflows/go.yml
vendored
@@ -41,10 +41,9 @@ jobs:
|
||||
with:
|
||||
go-version: 'stable'
|
||||
|
||||
- name: Build Docker container with the tools our tests require
|
||||
run: |
|
||||
docker build --pull --no-cache --rm -t=router7 -f travis/Dockerfile .
|
||||
- uses: cachix/install-nix-action@v31
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-25.05
|
||||
|
||||
- name: Run tests in Docker container
|
||||
run: |
|
||||
exit=0; for pkg in $(go list ./integration/...); do go test -c $pkg && docker run --privileged --net=host -v $PWD:/usr/src:ro router7 /bin/sh -c "./$(basename $pkg).test -test.v" || exit=1; done; [ $exit = 0 ]
|
||||
- name: Run tests in nix-shell
|
||||
run: nix-shell --command 'make test'
|
||||
|
11
shell.nix
Normal file
11
shell.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
pkgs ? import <nixpkgs> { },
|
||||
}:
|
||||
pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
dnsmasq
|
||||
dig
|
||||
ndisc6
|
||||
nftables
|
||||
];
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
# vim:ft=Dockerfile
|
||||
FROM debian:sid
|
||||
|
||||
RUN echo force-unsafe-io > /etc/dpkg/dpkg.cfg.d/docker-apt-speedup
|
||||
# Paper over occasional network flakiness of some mirrors.
|
||||
RUN echo 'APT::Acquire::Retries "5";' > /etc/apt/apt.conf.d/80retry
|
||||
|
||||
# NOTE: I tried exclusively using gce_debian_mirror.storage.googleapis.com
|
||||
# instead of httpredir.debian.org, but the results (Fetched 123 MB in 36s (3357
|
||||
# kB/s)) are not any better than httpredir.debian.org (Fetched 123 MB in 34s
|
||||
# (3608 kB/s)). Hence, let’s stick with httpredir.debian.org (default) for now.
|
||||
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
dnsmasq ndisc6 nftables bind9-dnsutils strace wireguard iproute2 && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /usr/src
|
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
loopdev=$(sudo losetup -Pf --show /tmp/router7-qemu/disk.img)
|
||||
sudo mkfs.ext4 -m 1 "${loopdev}p4"
|
||||
sudo mount "${loopdev}p4" /mnt
|
||||
# TODO: make github.com/gokrazy/serial-busybox work with GOARCH=amd64
|
||||
sudo cp ~/src/busybox-1.22.0-amd64/busybox /mnt/sh || true
|
||||
cat <<'EOT' | sudo tee /mnt/interfaces.json
|
||||
{
|
||||
"interfaces": [
|
||||
{
|
||||
"hardware_addr": "52:55:00:d1:55:03",
|
||||
"name": "uplink0"
|
||||
},
|
||||
{
|
||||
"hardware_addr": "52:55:00:d1:55:04",
|
||||
"name": "lan0",
|
||||
"addr": "10.254.0.1/24"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOT
|
||||
sudo umount /mnt
|
||||
sudo losetup -d "${loopdev}"
|
Reference in New Issue
Block a user