fix CI, put mypy into pre-commit #378
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
name: CI | |
on: | |
pull_request: | |
branches: | |
- "*" | |
push: | |
branches: | |
- main | |
env: | |
IMAGE_NAME: fogapod/pink | |
jobs: | |
lint: | |
env: | |
UV_CACHE_DIR: /tmp/.uv-cache | |
runs-on: ubuntu-latest | |
steps: | |
- name: Restore uv cache | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.uv-cache | |
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
restore-keys: | | |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
uv-${{ runner.os }} | |
- uses: actions/checkout@v4 | |
- name: Set up uv | |
run: curl -LsSf https://astral.sh/uv/0.3.3/install.sh | sh | |
- name: Set up Python | |
run: uv python install | |
- name: install mypy | |
run: uv sync | |
- uses: pre-commit/[email protected] | |
- name: Minimize uv cache | |
run: uv cache prune --ci | |
deploy: | |
needs: [lint] | |
if: ${{ github.event_name == 'push' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Build image | |
run: | | |
docker pull $IMAGE_NAME | |
docker build -t $IMAGE_NAME:latest . \ | |
--build-arg GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) \ | |
--build-arg GIT_COMMIT=$(git rev-parse HEAD) \ | |
--build-arg GIT_DIRTY=$(git status --porcelain=v1 2>/dev/null | wc -l) | |
- name: Log in into Docker Hub | |
run: | | |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
- name: Push image to registry | |
run: | | |
docker push $IMAGE_NAME |