release/nproxy: 1.25.0.3-stable #3569
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: [push, pull_request, workflow_dispatch] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
ubuntu_test: | |
strategy: | |
fail-fast: true | |
runs-on: ubuntu-latest | |
steps: | |
# Clone project | |
- uses: actions/checkout@v3 | |
# Install buildx | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
# Set buildx cache | |
- name: Cache register | |
uses: actions/cache@v3 | |
with: | |
path: ~/buildx-cache | |
key: buildx-cache | |
# Install rust | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: llvm-tools-preview | |
# Cache Rust | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ hashFiles('./Cargo.lock') }} | |
# Install cargo make | |
- uses: davidB/rust-cargo-make@v1 | |
# Install llvm-cov | |
- uses: taiki-e/install-action@cargo-llvm-cov | |
# Install nextest | |
- uses: taiki-e/install-action@nextest | |
# Prepare CI with images containers and permissions | |
- name: Prepare CI | |
run: | | |
sudo apt install -y qemu-kvm qemu-utils | |
wget https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img | |
mv ubuntu-22.04-minimal-cloudimg-amd64.img tests/ubuntu-22.04-minimal-cloudimg-amd64.img | |
sudo groupadd nanocl | |
sudo usermod -aG nanocl "$USER" | |
sudo mkdir -p /run/nanocl | |
sudo chown $USER:nanocl -R /run/nanocl | |
mkdir -p $HOME/.nanocl_dev/state/vms/images | |
mkdir -p $HOME/.nanocl_dev/state/proxy/sites-enabled | |
mkdir -p $HOME/.nanocl_dev/state/proxy/sites-available | |
sudo chown $USER:nanocl -R $HOME/.nanocl_dev | |
sudo sh -c "echo '\n127.0.0.1 store.nanocl.internal\n127.0.0.1 nanocl.internal' >> /etc/hosts" | |
docker pull cockroachdb/cockroach:v23.1.12 | |
docker pull ghcr.io/next-hat/metrsd:0.3.2 | |
docker pull ghcr.io/next-hat/nanocl-get-started:latest | |
docker pull ghcr.io/next-hat/nanocl-qemu:8.0.2.0 | |
docker buildx build --load --cache-from type=local,src=~/buildx-cache --cache-to type=local,dest=~/buildx-cache -t ndns:dev -f ./bin/ndns/Dockerfile . | |
docker buildx build --load --cache-from type=local,src=~/buildx-cache --cache-to type=local,dest=~/buildx-cache -t nproxy:dev -f ./bin/nproxy/Dockerfile . | |
cargo build --no-default-features --features test --bin ncproxy | |
cargo build --no-default-features --features test --bin nanocld | |
docker compose -f ./tests/docker-compose.yaml up -d | |
sleep 4 | |
sudo chown $USER:nanocl -R /run/nanocl | |
sudo chown $USER:nanocl -R $HOME/.nanocl_dev | |
cargo run --no-default-features --features test --bin nanocld -- --hosts tcp://0.0.0.0:8585 --state-dir $HOME/.nanocl_dev/state & | |
cargo run --no-default-features --features test --bin ncproxy -- --conf-dir /tmp & | |
sleep 4 | |
docker ps -a | |
sudo chown -R $USER:nanocl /run/nanocl | |
ls -la $HOME/.nanocl_dev/state | |
ls -la $HOME/.nanocl_dev/state/proxy | |
ls -la /run/nanocl | |
# Run coverage | |
- name: Run tests | |
run: cargo make covgen | |
# Upload it to codecov | |
- name: Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV }} | |
files: ./lcov.info | |
flags: unittests # optional |