Simplify docker image building process #2127
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 | |
env: | |
PYTHON_VERSION: 3.8 | |
POETRY_VERSION: 1.2.2 | |
# Run this build workflow for every new PR | |
on: | |
pull_request: | |
branches: [main] | |
merge_group: | |
permissions: | |
contents: read | |
pull-requests: write | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
check-py: | |
name: Check Python code | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Setup Poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- name: Setup dev libs | |
run: | | |
sudo apt-get install libsasl2-dev | |
- name: Lint & Type Check | |
run: | | |
poetry install -E all | |
poetry run flake8 | |
poetry run black --check . | |
poetry run isort --check . | |
poetry run mypy . --explicit-package-bases | |
poetry run bandit -r . -c pyproject.toml | |
- name: Test | |
run: | | |
poetry run coverage run -m pytest | |
poetry run coverage xml | |
- name: Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Pytest coverage comment | |
uses: orgoro/coverage@v3 | |
with: | |
coverageFile: ./coverage.xml | |
token: ${{ secrets.GITHUB_TOKEN }} | |
thresholdAll: 0.85 | |
thresholdNew: 0.85 | |
thresholdModified: 0.0 | |
- name: Check bumped version | |
run: bash .github/scripts/check_version.sh | |
docker: | |
name: Docker build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Setup Poetry | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- name: Export requirements.txt | |
run: poetry export -E all -f requirements.txt --output requirements.txt | |
- name: Build Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: false |