mirror of
https://github.com/tj/git-extras.git
synced 2026-09-14 01:16:31 -04:00
* fix(github-actions): changed files output for editorcondig-checker Seems that ci.yml includes a dead dependency action just to get list of changed files for the PR / push. This seems weird as the repo is all about git. Propose removing this extra dep with straightforward implemenation. Also: github runners do have `jq` preinstalled. * feat(ci): print changed files to log in lint job
91 lines
2.8 KiB
YAML
91 lines
2.8 KiB
YAML
name: ci
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
jobs:
|
|
lint:
|
|
runs-on: 'ubuntu-latest'
|
|
steps:
|
|
- name: Check out code.
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: 'Get Changed Files'
|
|
id: 'files'
|
|
run: |
|
|
CHANGED_FILES=$(git diff --name-only "${BASE_SHA:-$BEFORE_SHA}...${HEAD_SHA:-GITHUB_REF}")
|
|
echo "::notice::Changed files: $CHANGED_FILES"
|
|
{
|
|
echo "added_modified<<EOF"
|
|
echo "$CHANGED_FILES"
|
|
echo "EOF"
|
|
} >> "$GITHUB_OUTPUT"
|
|
env:
|
|
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
BEFORE_SHA: "${{ github.event.before }}"
|
|
- uses: 'actions/setup-go@v5'
|
|
with:
|
|
go-version: '1.20'
|
|
- name: 'Install EditorConfig Lint'
|
|
run: go install 'github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@latest'
|
|
- name: 'Check EditorConfig Lint'
|
|
run: echo "$FILES" | xargs ~/go/bin/editorconfig-checker
|
|
env:
|
|
# NOTE: use env to pass the output in order to avoid possible injection attacks
|
|
FILES: "${{ steps.files.outputs.added_modified }}"
|
|
|
|
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"
|