fix: Update Lint CI to work with new precommits and repo structure #85
This file contains hidden or 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: Pi-Bot CI | |
# yamllint disable-line rule:truthy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
# Cache version to control pre-commit caches | |
CACHE_VERSION: 0 | |
# Location of the pre-commit cache. This is set by pre-commit, not us! | |
PRE_COMMIT_CACHE: ~/.cache/pre-commit | |
# Cancels previous runs targeting the same hash | |
concurrency: | |
group: > | |
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4.2.2 | |
- name: Setup Python | |
uses: actions/setup-python@v5.6.0 | |
- name: Setup precommit | |
uses: pre-commit/action@v3.0.1 | |
- name: Install pre-commit dependencies if no cache | |
if: steps.cache-pre-commit.outputs.cache-hit != 'true' | |
run: | | |
pre-commit install-hooks | |
- name: Install hadolint | |
run: > | |
sudo wget -O | |
/bin/hadolint | |
https://github.com/hadolint/hadolint/releases/download/v2.10.0/hadolint-Linux-x86_64 | |
sudo chmod +x /bin/hadolint | |
- name: Run hooks | |
run: > | |
SKIP=no-commit-to-branch | |
pre-commit run --all-files --show-diff-on-failure | |
build: | |
name: Build Image | |
needs: lint | |
if: "github.ref == 'refs/heads/main'" | |
uses: ./.github/workflows/build.yml |