Verify that there is at least one disk component #316
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- "3.7" | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
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 }} |