mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
Bumps [bats-core/bats-action](https://github.com/bats-core/bats-action) from 3.0.1 to 4.0.0. - [Release notes](https://github.com/bats-core/bats-action/releases) - [Commits](https://github.com/bats-core/bats-action/compare/3.0.1...4.0.0) --- updated-dependencies: - dependency-name: bats-core/bats-action dependency-version: 4.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
136 lines
4.1 KiB
YAML
136 lines
4.1 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@v6
|
|
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@v6'
|
|
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 }}"
|
|
- name: checkstyle
|
|
run: ./scripts/checkstyle.py
|
|
- name: Shellcheck
|
|
run: shellcheck --severity=error bin/* ./*.sh
|
|
- name: Lint and format Python with Ruff
|
|
uses: astral-sh/ruff-action@v3
|
|
|
|
typo:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out code.
|
|
uses: actions/checkout@v6
|
|
- name: Install poetry
|
|
run: pip install poetry
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
cache: 'poetry'
|
|
cache-dependency-path: "tests/pyproject.toml"
|
|
python-version-file: "tests/pyproject.toml"
|
|
- name: Install dependencies
|
|
run: |
|
|
cd tests || exit
|
|
poetry install --only dev
|
|
- name: spell check
|
|
run: |
|
|
cd tests
|
|
git grep --cached -l '' .. | \
|
|
grep -v -e 'History\.md' -e 'AUTHORS' -e 'man/.*\.1' -e 'man/.*\.html' | \
|
|
xargs poetry run codespell --ignore-words=../.github/.ignore_words
|
|
|
|
test-pytest:
|
|
name: 'Test with Pytest'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
- name: Install poetry
|
|
run: pip install poetry
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.12'
|
|
cache: 'poetry'
|
|
cache-dependency-path: "tests/pyproject.toml"
|
|
python-version-file: "tests/pyproject.toml"
|
|
- name: Install Python Dependencies
|
|
run: |
|
|
cd tests || exit
|
|
poetry install --only test
|
|
- name: Test with Pytest
|
|
run: |
|
|
cd tests
|
|
poetry run pytest
|
|
|
|
test-bats:
|
|
name: 'Test with Bats'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
- name: Setup Bats
|
|
id: setup-bats
|
|
uses: bats-core/bats-action@4.0.0
|
|
with:
|
|
bats-version: 'v1.8.1'
|
|
- name: Test with Bats
|
|
env:
|
|
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
|
|
TERM: xterm
|
|
run: bats ./tests
|
|
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform:
|
|
- ubuntu-latest
|
|
- macos-latest
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- name: Check out code.
|
|
uses: actions/checkout@v6
|
|
- 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"
|