Skip to content

v003

v003 #41

Workflow file for this run

name: CI
####################################
# Start the job on all push and PR #
####################################
on:
pull_request:
branches: [master, main]
types: [synchronize, opened, reopened, ready_for_review]
# push:
# branches: [master, main]
jobs:
precommits:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
# key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
key: ${{ runner.os }}-pip-
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install pre-commit
pre-commit install
- name: Cache shfmt binary
uses: actions/cache@v3
with:
path: /usr/local/bin/shfmt
# key: ${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
key: ${{ runner.os }}-shfmt-
- name: Install shfmt
run: |
SHFMT_VERSION="v3.7.0"
SHFMT_BIN="shfmt_${SHFMT_VERSION}_linux_amd64"
wget -O shfmt "https://github.com/mvdan/sh/releases/download/${SHFMT_VERSION}/${SHFMT_BIN}"
chmod +x shfmt
sudo mv shfmt /usr/local/bin/
- name: Run pre-commits
run: |
CUR_SHA=$(git log --pretty=tformat:"%H" -n1 .)
echo $CUR_SHA
echo ${{ env.BASE_COMMIT_ID }}
git fetch
pre-commit run --from-ref origin/main --to-ref $CUR_SHA