add enum4linux, misc other stuff (#34) #25
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: Build | |
on: | |
release: | |
types: [published] | |
push: | |
branches: | |
- 'main' | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
pull_request: | |
branches: | |
- 'main' | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Lint with Ruff | |
run: | | |
pip install ruff | |
ruff check --output-format=github . | |
continue-on-error: true | |
- name: test | |
run: | | |
pip install -r requirements.txt | |
pip install -r dev_requirements.txt | |
PYTHONPATH=$(pwd) pytest tests --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov=shadycompass --cov-branch --cov-report=xml:coverage-${{ matrix.python-version }}.xml --cov-report=html:htmlcov/${{ matrix.python-version }} --cov-report=term-missing | |
- name: Upload pytest test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-results-${{ matrix.python-version }} | |
path: | | |
junit/test-results-${{ matrix.python-version }}.xml | |
coverage-${{ matrix.python-version }}.xml | |
htmlcov/${{ matrix.python-version }} | |
# Use always() to always run this step to publish test results when there are test failures | |
if: ${{ always() }} | |
build-and-push-image: | |
runs-on: ubuntu-22.04 | |
needs: [test] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
env: | |
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
annotations: ${{ steps.meta.outputs.annotations }} | |
labels: ${{ steps.meta.outputs.labels }} |