Skip to content

Bump pygments from 2.13.0 to 2.15.0 #129

Bump pygments from 2.13.0 to 2.15.0

Bump pygments from 2.13.0 to 2.15.0 #129

Workflow file for this run

name: CI
on:
- push
- pull_request
env:
PYTHON_VERSION: "3.10"
IMAGE_NAME: bootstrap-academy/events-ms
jobs:
codestyle:
name: Codestyle (black+isort)
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache Virtual Environment
uses: actions/cache@v3
with:
path: |
.venv
~/.cache/pip
~/.cache/pypoetry
key: ${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }}
- name: Setup poetry
run: |
pip install poetry poethepoet
poetry install -n --no-root
- name: Check code formatting with black
run: poe black --diff --check
mypy:
name: mypy
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache Virtual Environment
uses: actions/cache@v3
with:
path: |
.venv
~/.cache/pip
~/.cache/pypoetry
key: ${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }}
- name: Setup poetry
run: |
pip install poetry poethepoet
poetry install -n --no-root
- name: Check typing with mypy
run: poe mypy
linter:
name: Linter (flake8)
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache Virtual Environment
uses: actions/cache@v3
with:
path: |
.venv
~/.cache/pip
~/.cache/pypoetry
key: ${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }}
- name: Setup poetry
run: |
pip install poetry poethepoet
poetry install -n --no-root
- name: Check code style with wemake-python-styleguide
run: poe flake8
# - name: Lint with wemake-python-styleguide
# uses: wemake-services/wemake-python-styleguide@0.15.3
# with:
# reporter: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && 'github-pr-review' || 'terminal' }}
# env:
# GITHUB_TOKEN: ${{ secrets.github_token }}
tests:
name: Tests (pytest+coverage)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache Virtual Environment
uses: actions/cache@v3
with:
path: |
.venv
~/.cache/pip
~/.cache/pypoetry
key: ${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }}
- name: Setup poetry
run: |
pip install poetry poethepoet
poetry install -n --no-root
- name: Run unit tests with coverage
run: poe coverage --xml --no-check --no-clean
- name: Send coverage report to codeclimate
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
if: ${{ env.CC_TEST_REPORTER_ID != null }}
run: |
set -ex
wget -O reporter https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
chmod +x reporter
./reporter after-build
- name: Check coverage
run: poetry run coverage report
docker_build:
name: Docker Build
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository }}
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- "linux/amd64"
# - "linux/arm/v7"
# - "linux/arm64/v8"
# - "linux/s390x"
# - "linux/ppc64le"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
submodules: recursive
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.2.1
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.platform }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-buildx-${{ matrix.platform }}-
- name: Create Tag
id: tag
run: echo ::set-output "name=tag::$(echo ${{ matrix.platform }} | tr / -)"
- name: Build
uses: docker/build-push-action@v3.2.0
with:
push: false
load: true
tags: ${{ steps.tag.outputs.tag }}
platforms: ${{ matrix.platform }}
file: Dockerfile
context: .
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Build Docker Image Archive
id: archive
env:
TAG: ${{ steps.tag.outputs.tag }}
run: |
set -ex
name=${TAG}.tar.gz
docker save $TAG | gzip > $name
echo ::set-output name=name::$name
- name: Upload Docker Image Archive
uses: actions/upload-artifact@v3
with:
name: ${{ steps.archive.outputs.name }}
path: ${{ steps.archive.outputs.name }}
retention-days: 1
docker_push:
name: Docker Push
if: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' && github.ref != 'refs/heads/template' }}
needs: [ codestyle, mypy, linter, tests, docker_build ]
concurrency: docker
runs-on: ubuntu-latest
steps:
- name: Download Docker Image Archive
uses: actions/download-artifact@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.github_token }}
- name: Create and Push Tags
run: |
set -ex
name=$IMAGE_NAME
tag=${GITHUB_REF#refs/tags/v}
branch=${GITHUB_REF#refs/heads/}
if [[ $GITHUB_REF = refs/tags/v* ]]; then
tags="v$tag latest"
elif [[ $GITHUB_REF = refs/heads/* ]]; then
tags="$branch"
fi
tags="$(echo $tags | tr / -)"
echo Tags: $tags
platforms=""
for file in $(ls */*); do
echo Loading $file
platform=$(docker load -qi $file | cut -d' ' -f3)
platform=${platform%:*}
platforms="$platforms $platform"
for tag in $tags; do
tag=ghcr.io/$name:$tag-$platform
docker tag $platform $tag
docker push $tag
done
done
for tag in $tags; do
cmd="docker manifest create ghcr.io/$name:$tag"
for platform in $platforms; do
cmd="$cmd --amend ghcr.io/$name:$tag-$platform"
done
$cmd
docker manifest push ghcr.io/$name:$tag
done
- name: Clear
if: always()
run: rm -f ${HOME}/.docker/config.json
# docker_deploy:
# name: Docker Deploy
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
# needs: [ docker_push ]
# environment: server-test
# runs-on: ubuntu-latest
#
# steps:
# - name: Deploy
# env:
# CREDENTIALS: ${{ secrets.UPDATE_CREDENTIALS }}
# URL: ${{ secrets.UPDATE_URL }}
# run: curl -u $CREDENTIALS $URL