release/nanocl: 0.16.1-nightly #5183
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: | |
branches: ["nightly"] | |
pull_request: | |
branches: ["nightly"] | |
workflow_dispatch: {} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/nightly' }} | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
ubuntu_test: | |
strategy: | |
fail-fast: true | |
runs-on: ubuntu-latest | |
steps: | |
# Clone project | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
# Install buildx | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
# Set buildx cache | |
- name: Cache register | |
uses: actions/cache@v4 | |
with: | |
path: ~/buildx-cache | |
key: buildx-cache | |
# Install cargo make | |
- uses: davidB/rust-cargo-make@v1 | |
# Debug ci with ngrok and ssh | |
# - name: Download ngrok | |
# run: curl -sO https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz | |
# shell: bash | |
# - name: Unzip ngrok | |
# run: tar -xf ngrok-v3-stable-linux-amd64.tgz | |
# shell: bash | |
# - name: Add ~/.ssh directory | |
# run: mkdir -p ~/.ssh | |
# shell: bash | |
# - name: Add SSH public key to authorized_keys | |
# run: echo "${{ secrets.WORKFLOW_SSH_PUB_KEY }}" >> ~/.ssh/authorized_keys | |
# shell: bash | |
# - name: Fix home directory permissions | |
# run: chmod 755 ~ | |
# shell: bash | |
# - run: chmod 600 ~/.ssh/authorized_keys | |
# shell: bash | |
# - name: Set ngrok auth token | |
# run: ./ngrok authtoken ${{ secrets.NGROK_TOKEN }} | |
# shell: bash | |
# - name: Debug message | |
# run: echo "Starting ngrok tunnel..." | |
# shell: bash | |
# - name: Setup ngrok tunnel | |
# run: timeout 1h ./ngrok tcp 22 & | |
# shell: bash | |
# Cache Rust | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ hashFiles('./Cargo.lock') }} | |
# Prepare CI with images containers and permissions | |
- name: Prepare CI | |
run: | | |
wget https://cloud-images.ubuntu.com/minimal/releases/noble/release/ubuntu-24.04-minimal-cloudimg-amd64.img | |
mv ubuntu-24.04-minimal-cloudimg-amd64.img tests/ubuntu-24.04-minimal-cloudimg-amd64.img | |
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 sh -c "echo '\n127.0.0.1 store.nanocl.internal\n127.0.0.1 nanocl.internal' >> /etc/hosts" | |
docker pull cockroachdb/cockroach:v24.2.4 | |
docker pull ghcr.io/next-hat/metrsd:0.5.4 | |
docker pull ghcr.io/next-hat/nanocl-dev:dev | |
docker pull ghcr.io/next-hat/nanocl-qemu:8.0.2.0 | |
docker pull ghcr.io/next-hat/nanocl-get-started:latest | |
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 . | |
docker compose -f ./tests/docker-compose.yaml up -d | |
sleep 4 | |
sh scripts/prepare_test_ci.sh | |
sleep 4 | |
docker ps -a | |
sudo chmod -R 777 $HOME/.cargo/registry | |
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 covgenci | |
# Upload it to codecov | |
- name: Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV }} | |
files: ./lcov.info | |
flags: unittests # optional | |
# Fix permissions to upload artifacts | |
- name: Fix perms | |
run: | | |
sudo chmod -R 777 target | |
sudo chmod -R 777 $HOME/.cargo/registry |