-
Notifications
You must be signed in to change notification settings - Fork 39
147 lines (136 loc) · 3.97 KB
/
test.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: test
on:
pull_request:
push:
branches:
- main
env:
PYTHON_VERSION: "3.12"
STERN_VERSION: "1.30.0"
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: eifinger/setup-uv@v1
- run: uvx ruff check .
ruff-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v2
with:
version: "latest"
enable-cache: true
- run: uvx ruff format . --check
build-image:
needs: [ruff, ruff-format]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and export
uses: docker/build-push-action@v5
with:
file: resources/images/commander/Dockerfile
context: .
tags: bitcoindevproject/warnet-commander:latest
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=docker,dest=/tmp/commander.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: commander
path: /tmp/commander.tar
test:
needs: [build-image]
runs-on: ubuntu-latest
strategy:
matrix:
test:
- conf_test.py
- dag_connection_test.py
- logging_test.py
- rpc_test.py
- services_test.py
- signet_test.py
- scenarios_test.py
steps:
- uses: actions/checkout@v4
- uses: azure/[email protected]
- name: start minikube
uses: medyagh/setup-minikube@latest
id: minikube
with:
cpus: max
memory: 4000m
- name: Start minikube's loadbalancer tunnel
run: minikube tunnel &> /dev/null &
- name: Download commander artifact
uses: actions/download-artifact@v4
with:
name: commander
path: /tmp
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v2
with:
version: "latest"
enable-cache: true
- name: Install Python
run: uv python install $PYTHON_VERSION
- name: Install project
run: uv sync --all-extras --dev
- name: Install commander image
run: |
echo loading commander image into minikube docker
eval $(minikube -p minikube docker-env)
docker load --input /tmp/commander.tar
docker image ls -a
- name: Run tests
run: |
source .venv/bin/activate
./test/${{matrix.test}}
- name: Collect Kubernetes logs
if: always()
run: |
echo "Installing stern..."
curl -Lo stern.tar.gz https://github.com/stern/stern/releases/download/v${STERN_VERSION}/stern_${STERN_VERSION}_linux_amd64.tar.gz
tar zxvf stern.tar.gz
chmod +x stern
sudo mv stern /usr/local/bin/
# Run script
curl -O https://raw.githubusercontent.com/bitcoin-dev-project/warnet/main/resources/scripts/k8s-log-collector.sh
chmod +x k8s-log-collector.sh
./k8s-log-collector.sh default
- name: Upload log artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: kubernetes-logs-${{ matrix.test }}
path: ./k8s-logs
retention-days: 5
test-without-mk:
runs-on: ubuntu-latest
strategy:
matrix:
test:
- graph_test.py
steps:
- uses: actions/checkout@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v2
with:
version: "latest"
enable-cache: true
- name: Install Python
run: uv python install $PYTHON_VERSION
- name: Install project
run: uv sync --all-extras --dev
- name: Run tests
run: |
source .venv/bin/activate
./test/${{matrix.test}}