-
-
Notifications
You must be signed in to change notification settings - Fork 46
81 lines (76 loc) · 2.83 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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@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 cargo make
- uses: davidB/rust-cargo-make@v1
# 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/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
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:v23.1.20
docker pull ghcr.io/next-hat/metrsd:0.5.3
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/codecov-action@v3.1.1
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