Merge pull request #427 from powerapi-ng/dependabot/docker/python-ad4… #640
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: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
permissions: | |
contents: read | |
jobs: | |
build-and-test: | |
name: Build project and run tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.x"] | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ".[devel]" | |
- name: Lint with flake8 | |
run: | | |
flake8 --count --show-source --statistics src/ tests/ | |
- name: Static code analysis with pylint | |
run: | | |
pylint src/ tests/ | |
- name: Test with pytest | |
run: | | |
pytest --cov=powerapi --cov-report=term --cov-report=xml tests/unit | |
- name: Upload coverage reports to Codecov | |
if: ${{ matrix.python-version }} == "3.10" | |
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: coverage.xml | |
build-container-image: | |
name: Build container image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 | |
- name: Build image | |
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 | |
with: | |
push: false | |
provenance: false | |
load: true | |
tags: localbuild/powerapi:sha-${{ github.sha }} |