Skip to content

Update dependency environs to v11 #393

Update dependency environs to v11

Update dependency environs to v11 #393

Workflow file for this run

name: Test And Build BOT
on:
push:
paths-ignore:
- ".github/**"
- ".devcontainer/**"
branches-ignore:
- "renovate/**"
pull_request:
branches-ignore:
- "renovate/**"
jobs:
tests:
runs-on: ubuntu-latest
env:
CheckFiles: "launcher.py cogs/"
steps:
- uses: actions/[email protected]
with:
ref: ${{ github.head_ref }}
- name: Set up Python 3.10
uses: actions/[email protected]
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
flake8 --select=E9,F63,F7,F82 --show-source
- name: Check with Isort
run: |
pip install isort
isort --check --sp setup.cfg $CheckFiles
- name: Sort with Isort
if: failure()
run: |
isort --sp setup.cfg $CheckFiles
- name: Create Pull Request
if: failure()
uses: peter-evans/[email protected]
with:
branch: actions/auto
commit-message: Changes done by tests
title: Linter changed files
build-and-push-container:
if: github.event_name != 'pull_request' && contains(github.ref, 'actions') != 'true'
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Create VARS
id: vars
run: |
echo "branch=${GITHUB_REF//refs\/heads\//}" >> $GITHUB_OUTPUT
echo "username=$(echo ${GITHUB_REPOSITORY} | cut -d/ -f1 | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
echo "source=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/tree/${GITHUB_REF//refs\/heads\//}" >> $GITHUB_OUTPUT
echo "url=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/blob/master/README.md" >> $GITHUB_OUTPUT
echo "tag=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]'):${GITHUB_SHA}" >> $GITHUB_OUTPUT
echo "bot_ver=$(cat cogs/utils/Bot_version.py | cut -d'"' -f 2)" >> $GITHUB_OUTPUT
# - name: Login to DockerHub
# uses: docker/login-action@v1
# with:
# username: ${{ steps.vars.outputs.username }}
# password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ steps.vars.outputs.username }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
version: latest
driver-opts: image=moby/buildkit:master
- name: Build and push
uses: docker/[email protected]
with:
push: true
attests: type=sbom,generator=docker/buildkit-syft-scanner
provenance: true # https://github.com/docker/buildx/issues/1509
platforms: ${{ steps.vars.outputs.platform }}
file: ./amd64.Dockerfile
build-args: BUILDKIT_SBOM_SCAN_CONTEXT=true,BUILDKIT_SBOM_SCAN_STAGE=true
tags: |
ghcr.io/${{ steps.vars.outputs.tag }}
labels: |
org.opencontainers.image.source=${{ steps.vars.outputs.source }}
org.opencontainers.image.url=${{ steps.vars.outputs.url }}
- name: Create manifests for GitHub Container Registry
env:
DOCKER_CLI_EXPERIMENTAL: enabled
run: |
IMAGE=ghcr.io/$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]')
SOURCE=${IMAGE}:${GITHUB_SHA}
docker buildx imagetools create -t ${IMAGE}:${{ steps.vars.outputs.branch }} ${SOURCE}
if [[ ${GITHUB_REF//refs\/heads\//} == master ]]; then
docker buildx imagetools create -t ${IMAGE}:${{ steps.vars.outputs.bot_ver }} ${SOURCE}
docker buildx imagetools create -t ${IMAGE}:latest ${SOURCE}
fi