Added version command #48
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: Pi-Bot CI | |
# yamllint disable-line rule:truthy | |
on: | |
[push, workflow_dispatch] | |
env: | |
# Cache version to control pre-commit caches | |
CACHE_VERSION: 0 | |
# 3.9 is recent enough | |
DEFAULT_PYTHON: 3.10.11 | |
# 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/[email protected] | |
- name: Setup Python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON}} | |
cache: "pip" | |
- name: Generate pre-commit cache key | |
id: pre-commit_cache_key | |
run: > | |
echo "::set-output | |
name=key::${{ env.CACHE_VERSION }}-${{ env.DEFAULT_PYTHON }}-${{ | |
hashFiles('.pre-commit-config.yaml') }}" | |
- name: Install pre-commit | |
run: | | |
pip install --upgrade pip | |
pip install "$(cat requirements_test.txt | grep pre-commit)" | |
- name: Restore base pre-commit environment | |
id: cache-pre-commmit | |
uses: actions/[email protected] | |
with: | |
path: ${{ env.PRE_COMMIT_CACHE }} | |
key: > | |
${{ runner.os | |
}}-pre-commit-${{ | |
steps.pre-commit_cache_key.outputs.key }} | |
- 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 |