Skip to content

fix(deps): update dependency sentry-sdk to v2.18.0 (fastapi) #792

fix(deps): update dependency sentry-sdk to v2.18.0 (fastapi)

fix(deps): update dependency sentry-sdk to v2.18.0 (fastapi) #792

name: Docker
on:
push:
pull_request:
env:
IMAGE_NAME: pylerplate
jobs:
test:
runs-on: ubuntu-latest
env:
POETRY_VERSION: '1.8.1'
PYTHON_VERSION: '3.12.3'
PIP_DISABLE_PIP_VERSION_CHECK: 1
steps:
- uses: actions/checkout@v4
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
# libcurl4-openssl-dev - for pycurl
# gettext-base - for envsubst
packages: libcurl4-openssl-dev gettext-base
version: 2.0
- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-1
- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
version: ${{ env.POETRY_VERSION }}
- name: Ensure `~/.local/bin` is in PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry
cache-dependency-path: poetry.lock
- name: Set Poetry environment
run: poetry env use $PYTHON_VERSION
- name: Set VIRTUAL_ENV
run: echo "VIRTUAL_ENV=$(poetry env info -p)" >> $GITHUB_ENV
- run: poetry install --no-root
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-1|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: pre-commit
run: poetry run pre-commit run -a --show-diff-on-failure --color=always
- run: |
poetry run pytest \
--junitxml=pytest.xml \
--cov --cov-report=term-missing:skip-covered \
2>&1 | tee pytest-cov.txt; exit ${PIPESTATUS[0]}
if: ${{ always() }}
- name: Get Coverage
if: ${{ always() }}
uses: MishaKav/pytest-coverage-comment@main
continue-on-error: true
with:
junitxml-path: pytest.xml
pytest-coverage-path: pytest-cov.txt
default-branch: master
github-token: ${{ secrets.GITHUB_TOKEN }}
# Uncomment to enable SSH to Actions
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
# if: ${{ failure() }}
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
# Ensure test job passes before pushing image.
needs: test
runs-on: ubuntu-latest
permissions: write-all
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push image to GitHub Container Registry
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION