Skip to content

Commit

Permalink
ci: use dorny/paths-filter to filter paths when running go-tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaiszaher authored Sep 7, 2023
1 parent 70c9f17 commit fac46b7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 47 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/test-required.yml

This file was deleted.

35 changes: 25 additions & 10 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,22 +12,41 @@ on:
- ready_for_review
branches:
- "main"
paths:
- '**.go'
- 'go.*'
- '.github/workflows/test.yml'


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 fac46b7

Please sign in to comment.