ci: don't ignore workflow files #25
Workflow file for this run
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
on: | |
push: | |
paths-ignore: | |
- '.vscode/**' | |
- '**.toml' | |
- '**.md' | |
pull_request: | |
paths-ignore: | |
- '.vscode/**' | |
- '**.toml' | |
- '**.md' | |
workflow_dispatch: | |
name: CI | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.9" | |
- name: Run flake8 | |
uses: julianwachholz/flake8-action@v2 | |
with: | |
checkName: "Python Lint" | |
path: src/ | |
- name: Run Docker lint | |
uses: ghe-actions/dockerfile-validator@v1 | |
with: | |
dockerfile: 'Dockerfile' | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.12" | |
- name: Run image | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: "1.7.1" | |
- name: Install depepdencies | |
run: poetry install --only main --no-root | |
- name: Run test | |
run: poetry run python test.py | |
push: | |
name: Push Docker image to container registry | |
runs-on: ubuntu-latest | |
if: startsWith(github.event.ref, 'refs/tags/v') | |
needs: [lint, test] | |
steps: | |
- name: Log in to the Container registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |