Skip to content

Fix lint errors

Fix lint errors #60

Workflow file for this run

name: Build
on:
push:
branches:
- master
env:
# CI only secrets in order to allow django to boot, not used anywhere else
SECRET_KEY: "1234567890abcd"
BOT_TOKEN: "1234567890abcd"
jobs:
lint:
name: Lint code
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Setup Pipenv
run: python -m pip install --upgrade pipenv
- name: Cache dependencies
uses: actions/cache@v4
env:
cache-name: cache-pipenv
with:
path: ~/.cache/pipenv
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Pipfile.lock') }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
run: pipenv install --system --deploy --dev
- name: Run flake8 linting
run: flake8
- name: Run pylint linting
run: pylint dangobot
- name: Run static type checks
uses: jakebailey/pyright-action@v2
with:
python-version: "3.11"
pylance-version: latest-release
build-container:
name: Build Docker container
runs-on: ubuntu-latest
needs: lint
permissions:
packages: write
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get the commit hash
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build and publish container
uses: docker/build-push-action@v3
with:
platforms: linux/amd64
push: true
build-args: |
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
tags: |
ghcr.io/liquidpl/dangobot:${{ steps.vars.outputs.sha_short }}
ghcr.io/liquidpl/dangobot:latest