Skip to content

Commit

Permalink
ci: use dorny/paths-filter to filter paths when running go-tests (r…
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaiszaher authored and ijames-gc committed Feb 13, 2024
1 parent d1f9e9b commit 6007638
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 48 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/test-required.yml

This file was deleted.

35 changes: 24 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ on:
push:
branches:
- "main"
paths:
- '**.go'
- 'go.*'
- '.github/workflows/test.yml'
pull_request:
types:
- opened
Expand All @@ -16,24 +12,41 @@ on:
- ready_for_review
branches:
- "main"
paths:
- '**.go'
- 'go.*'
- '.github/workflows/test.yml'
workflow_dispatch:


concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test:
changes:
outputs:
should-run-tests: ${{ steps.changes.outputs.go == 'true' }}
if: github.event.pull_request.draft == false
runs-on: ubuntu-22.04
steps:
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
go:
- '**.go'
- 'go.*'
- '.github/workflows/test.yml'
test:
needs: [changes]
if: needs.changes.outputs.should-run-tests == 'true'
name: runner / gotest
runs-on: ubuntu-22.04
container: ghcr.io/runatlantis/testing-env:latest
steps:
- uses: actions/checkout@v4
- run: make test-all
- run: make check-fmt

skip-test:
needs: [changes]
if: needs.changes.outputs.should-run-tests == 'false'
name: runner / gotest
runs-on: ubuntu-22.04
steps:
- run: 'echo "No build required"'

0 comments on commit 6007638

Please sign in to comment.