Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use dorny/paths-filter to filter paths when running go-tests #3675

Merged
merged 3 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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@v3
- 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"'