feat: Make git optional (#150) #433
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: Run Tests | |
on: | |
push: | |
branches: | |
- main | |
- v* | |
pull_request: | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
changed-files: | |
name: Changed Files | |
runs-on: ubuntu-latest | |
outputs: | |
test-source: ${{ steps.changed-files.outputs.test-source_any_modified == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 50 # Assume PRs are less than 50 commits | |
- name: Find changed files | |
uses: tj-actions/changed-files@v45 | |
id: changed-files | |
with: | |
files_yaml: | | |
common: &common | |
- .github/workflows/test-worker.yml | |
- Makefile | |
test-source: | |
- *common | |
- cmd/** | |
- go.* | |
- '*.go' | |
source: | |
name: "Test on ${{ matrix.os }}" | |
runs-on: "${{ matrix.os }}-latest" | |
needs: changed-files | |
if: ${{ needs.changed-files.outputs.test-source == 'true' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu | |
- windows | |
- macos | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/go-build | |
/go/pkg/mod | |
key: go-${{ runner.os }}-${{ hashFiles('go.sum') }} | |
restore-keys: go-${{ runner.os }} | |
- name: Test | |
run: | | |
set -xe | |
make test | |
check: | |
if: always() | |
name: Tests Successful | |
runs-on: ubuntu-latest | |
needs: [source] | |
steps: | |
- name: Whether the whole test suite passed | |
uses: re-actors/[email protected] | |
with: | |
allowed-skips: ${{ toJSON(needs) }} | |
jobs: ${{ toJSON(needs) }} |