-
Notifications
You must be signed in to change notification settings - Fork 3
109 lines (105 loc) · 3.16 KB
/
ci.yaml
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
name: ci
on:
push:
pull_request:
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- run: pip install black
- run: black --check --diff .
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- run: pip install pylama setuptools
- run: pylama packethardware setup.py
cli-test:
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
os-version:
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-24.04
- ubuntu-latest
exclude:
- os-version: ubuntu-24.04
python-version: "3.7"
- os-version: ubuntu-24.04
python-version: "3.8"
runs-on: ${{matrix.os-version}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "${{matrix.python-version}}"
- name: Test on Python ${{matrix.python-version}}, ${{matrix.os-version}}
run: |
pip install .
packet-hardware --help
# apt update to use same versions as OSIE
sudo apt-get update
sudo apt-get install ipmitool smartmontools jq
packet-hardware inventory -d -u localhost -c cache.json
cat cache.json
# Verify there is at least one ProcessorComponent
jq -e '.[] | select(.component_type == "ProcessorComponent")' cache.json
# Verify there is at least one DiskComponent
jq -e '.[] | select(.component_type == "DiskComponent")' cache.json
build-and-publish-docker-image:
name: build image and possibly push image to quay.io
runs-on: ubuntu-latest
needs:
- cli-test
- format
- lint
steps:
- uses: actions/checkout@v4
with:
lfs: 'true'
- uses: docker/setup-buildx-action@v3
id: buildx
- uses: docker/metadata-action@v5
id: meta
with:
images: quay.io/packet/packet-hardware
tags: |
type=ref,event=tag
type=sha
type=ref,event=branch
- uses: docker/login-action@v3
if: github.event_name == 'create' && github.event.ref_type == 'tag'
with:
registry: quay.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-cache
restore-keys: |
${{ runner.os }}-cache
- uses: docker/build-push-action@v6
with:
platforms: linux/amd64
push: ${{ github.event_name == 'create' && github.event.ref_type == 'tag' }}
tags: ${{ steps.meta.outputs.tags }}
context: '.'
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
builder: ${{ steps.buildx.outputs.name }}