Skip to content

Use standard GHA runners #324

Use standard GHA runners

Use standard GHA runners #324

Workflow file for this run

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.11"
- 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.11"
- run: pip install pylama
- run: pylama packethardware setup.py
cli-test:
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
os-version:
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-24.04
- ubuntu-latest
runs-on: ${{matrix.os-version}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "${{matrix.python-version}}"
- name: Basic cli test on Python ${{matrix.python-version}}
run: |
pip install .
packet-hardware --help
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@v5
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 }}