chore: multiple patterns for sparse-checkout #61
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: PR | |
on: | |
workflow_dispatch: {} | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "!docs/**" | |
- "!archive/**" | |
- "!custom-archive/**" | |
- "!tools/bin/**" | |
- "!**.yaml" | |
- "!**.md" | |
- "!**.txt" | |
- "!**.conf" | |
# override previous rules: | |
- "**.c" | |
- "**.h" | |
- "**.go" | |
- "**.sh" | |
- ".github/workflows/pr.yaml" | |
concurrency: | |
group: ${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
verify-and-test: | |
name: Verify and Test | |
runs-on: ubuntu-latest | |
steps: | |
# | |
- name: Checkout Code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
submodules: true | |
# | |
- name: Install Dependencies | |
uses: ./.github/actions/build-dependencies | |
with: | |
from: pr | |
# | |
# CODE VERIFICATION | |
# | |
- name: Install staticchecker | |
run: | | |
GOROOT=/usr/local/go GOPATH=$HOME/go go install honnef.co/go/tools/cmd/staticcheck@a093f7c2d3d45d5104fb3414ae939a98be37be02 # v0.4.7 | |
sudo cp $HOME/go/bin/staticcheck /usr/bin/ | |
shell: bash | |
# | |
- name: Install goimports-reviser | |
run: | | |
go install github.com/incu6us/goimports-reviser/v3@38044e6cb02749195e5384d9d9535ed00a10fc1f # v3.6.4 | |
sudo cp $HOME/go/bin/goimports-reviser /usr/bin/ | |
shell: bash | |
# | |
- name: Lint | |
run: | | |
if test -z "$(gofmt -l .)"; then | |
echo "Congrats! There is nothing to fix." | |
else | |
echo "The following lines should be fixed." | |
gofmt -s -d . | |
exit 1 | |
fi | |
# | |
- name: Check Golang Vet | |
run: | | |
make check-vet | |
# | |
- name: Check with StaticCheck | |
run: | | |
make check-staticcheck | |
# | |
# CODE TESTING | |
# | |
- name: Run Unit Tests | |
run: | | |
make test-unit |