-
Notifications
You must be signed in to change notification settings - Fork 31
81 lines (79 loc) · 3.04 KB
/
k8s-ci.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: K8s CI
on:
workflow_call:
jobs:
k8s-ci:
runs-on: ubuntu-latest-16-cores
steps:
- name: Bind mount /dev/sda1 to /nix
run: |
sudo mkdir -p /nix
sudo mount --bind /mnt /nix
lsblk
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: DeterminateSystems/nix-installer-action@v11
with:
kvm: true
- uses: DeterminateSystems/magic-nix-cache-action@v6
- name: Setup Nix Path
run: |
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
- name: Pre-populate K8s nix-shell
run: nix-shell ./scripts/k8s/shell.nix --run "echo"
- name: Pre-populate helm nix-shell
run: nix-shell ./scripts/helm/shell.nix --run "echo"
- name: Pre-populate pytest nix-shell
run: nix-shell ./scripts/python/shell.nix --run "echo"
- name: BootStrap k8s cluster
run: nix-shell ./scripts/k8s/shell.nix --run "./scripts/k8s/deployer.sh start --label"
- name: Prepare v-next images and binary
run: nix-shell ./scripts/python/shell.nix --run "./scripts/python/upgrade-test-helper.sh --build --chart-tag --chart ./chart"
- name: Load images to kind cluster
run: nix-shell ./scripts/python/shell.nix --run "./scripts/python/upgrade-test-helper.sh --load"
- name: Run pytest
run: |
export REUSE_CLUSTER=1
export CHART_VNEXT_SKIP=1
export CLEAN=0
nix-shell ./scripts/python/shell.nix --run "./scripts/python/test.sh"
- name: Collect logs
if: ${{ failure() }}
run: |
nix-shell ./scripts/k8s/shell.nix --run "kubectl get pods -A -o wide"
nix-shell ./scripts/k8s/shell.nix --run "kubectl -n mayastor logs -l openebs.io/release=mayastor --all-containers=true"
nix-shell ./scripts/k8s/shell.nix --run "kubectl -n mayastor logs -l app=upgrade --all-containers=true"
- name: Upload pytest logs
if: always()
uses: actions/upload-artifact@v4
with:
name: pytest.log
path: pytest.log
- name: Report pytest results
if: always()
uses: pmeier/pytest-results-action@main
with:
path: report.xml
summary: true
display-options: a
fail-on-empty: true
title: Test results
k8s-ci-vm:
runs-on: ubuntu-latest-16-cores
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v11
with:
kvm: true
- uses: DeterminateSystems/magic-nix-cache-action@v6
- name: Pre-populate nix-shell
run: |
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
nix-shell ./scripts/helm/shell.nix --run "echo"
- name: Test on VM
run: |
nix-shell ./scripts/helm/shell.nix --run "cd chart; helm dependency update"
nix-build ./tests/helm/test.nix --option sandbox false