Skip to content

Merge pull request #1 from Sauci/dependabot/github_actions/dot-github… #67

Merge pull request #1 from Sauci/dependabot/github_actions/dot-github…

Merge pull request #1 from Sauci/dependabot/github_actions/dot-github… #67

Workflow file for this run

name: pyelf CI
on: [ push ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{github.repository}}
jobs:
build-and-push-image:
name: Build and push image
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{env.REGISTRY}}
username: ${{secrets.PKG_REGISTRY_USERNAME}}
password: ${{secrets.PKG_REGISTRY_RW_TOKEN}}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{steps.meta.outputs.tags}}
labels: ${{steps.meta.outputs.labels}}
build-binaries:
name: Build binaries
needs: build-and-push-image
runs-on: ubuntu-20.04
container:
image: ghcr.io/sauci/pyelf:develop
credentials:
username: ${{secrets.PKG_REGISTRY_USERNAME}}
password: ${{secrets.PKG_REGISTRY_RW_TOKEN}}
volumes:
- ${{github.workspace}}:/usr/project/pyelf
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Build binaries
run: cd tests && ./build.sh
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: test_inputs
path: |
tests/*.elf
tests/*.bin
run-tests:
name: Run tests
needs: build-binaries
runs-on: ubuntu-20.04
container:
image: ghcr.io/sauci/pyelf:develop
credentials:
username: ${{secrets.PKG_REGISTRY_USERNAME}}
password: ${{secrets.PKG_REGISTRY_RW_TOKEN}}
volumes:
- ${{github.workspace}}:/usr/project/pyelf
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/[email protected]
with:
name: test_inputs
path: tests
- name: Run pytest tests
run: python3 -m pytest $(pwd) -v --cov src/pyelf --cov-report=xml --verbose --cov-fail-under 80
- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: coverage.xml
build-distribution:
name: Build distribution
needs: build-and-push-image
runs-on: ubuntu-20.04
container:
image: ghcr.io/sauci/pyelf:develop
credentials:
username: ${{secrets.PKG_REGISTRY_USERNAME}}
password: ${{secrets.PKG_REGISTRY_RW_TOKEN}}
volumes:
- ${{github.workspace}}:/usr/project/pyelf
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Build dist
run: python3 -m build
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: dist
path: dist
publish-package:
name: Publish package
needs: [ run-tests,
build-distribution ]
runs-on: ubuntu-20.04
steps:
- name: Download artifacts
uses: actions/[email protected]
with:
name: dist
path: dist
- name: Publish package on Python Package Index
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{secrets.PYPI_USERNAME}}
password: ${{secrets.PYPI_PASSWORD}}