feat: add ruff linter with ci check #599
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
name: ci | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
lint: | |
runs-on: 'ubuntu-latest' | |
steps: | |
- name: 'Get Changed Files' | |
id: 'files' | |
uses: 'masesgroup/retrieve-changed-files@v3' | |
with: | |
format: 'json' | |
# a force push will cause the action above to fail. Don't do force push when people are | |
# reviewing! | |
- name: Check out code. | |
uses: actions/checkout@v4 | |
- uses: 'actions/setup-go@v5' | |
with: | |
go-version: '1.20' | |
- name: 'Check EditorConfig Lint' | |
run: | | |
sudo apt install -y jq | |
go install 'github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@latest' | |
readarray -t changed_files <<<"$(jq -r '.[]' <<<'${{ steps.files.outputs.added_modified }}')" | |
~/go/bin/editorconfig-checker ${changed_files[@]} | |
- name: Lint and format Python with Ruff | |
uses: astral-sh/ruff-action@v1 | |
typo: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code. | |
uses: actions/checkout@v4 | |
- name: spell check | |
run: | | |
pip install codespell==2.2 | |
git grep --cached -l '' | grep -v -e 'History\.md' -e 'AUTHORS' -e 'man/.*\.1' -e 'man/.*\.html' | xargs codespell --ignore-words=.github/.ignore_words | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest==8.1.2 GitPython==3.1.43 testpath==0.6.0 | |
- name: Unit test | |
run: make test | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- ubuntu-latest | |
- macos-latest | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Check out code. | |
uses: actions/checkout@v4 | |
- name: Linux Install | |
if: matrix.platform == 'ubuntu-latest' | |
run: | | |
sudo apt-get install -y bsdmainutils | |
- name: Script | |
run: | | |
./check_integrity.sh | |
- name: Brew release | |
if: matrix.platform == 'macos-latest' | |
run: | | |
mkdir ../release && git archive --format=tar.gz HEAD > ../release/git-extras-release.tar.gz | |
cd ../release | |
tar -xzf git-extras-release.tar.gz && make PREFIX=$(pwd) INSTALL_VIA=brew | |
./bin/git-extras update | grep "brew upgrade git-extras" |