docker compose working #31
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: Pipeline | |
on: push | |
jobs: | |
code-quality: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
# - name: Setup Python | |
# uses: actions/setup-python@v4 | |
# with: | |
# python-version: 3.10.12 | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.4.1 | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: | | |
poetry install --no-interaction --no-root | |
- name: pylint | |
run: | | |
source .venv/bin/activate | |
pylint build tests | |
- name: black | |
run: | | |
source .venv/bin/activate | |
black --check . | |
run-tests: | |
needs: code-quality | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# - name: Setup Python | |
# uses: actions/setup-python@v4 | |
# with: | |
# python-version: 3.10.12 | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.4.1 | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: | | |
poetry install --no-interaction --no-root | |
- name: Run all tests with pytest | |
run: | | |
source .venv/bin/activate | |
pytest --cov | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
publish-all-images: | |
needs: run-tests | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Get Git Commit Tag Name | |
uses: olegtarasov/get-tag@v2.1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# - name: Setup Python | |
# uses: actions/setup-python@v4 | |
# with: | |
# python-version: 3.10.12 | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.4.1 | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: | | |
poetry install --no-interaction --no-root | |
- name: Publish Image to Docker Hub | |
env: | |
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | |
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
run: | | |
source .venv/bin/activate | |
python -m build.publish |