feat(build): use path-filters

This commit is contained in:
Phan An 2022-11-14 15:05:11 +01:00
parent 02c5e79dac
commit f24fd44a3a
No known key found for this signature in database
GPG key ID: A81E4477F0BB6FDC
4 changed files with 62 additions and 17 deletions

View file

@ -3,20 +3,38 @@ on:
pull_request:
branches:
- master
paths-ignore:
- resources/assets/**
push:
branches:
- master
paths-ignore:
- resources/assets/**
workflow_dispatch:
branches:
- master
paths-ignore:
- resources/assets/**
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
changed: ${{ steps.filter.outputs.backend }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
backend:
- '!./resources/assets/**'
- '!./.github/workflows/unit-frontend.yml'
- '!./vite.config.js'
- '!./package.json'
- '!./yarn.lock'
- '!./.eslintrc'
- '!./cypress.json'
test:
needs: changes
if: ${{needs.changes.outputs.changed == 'backend'}}
runs-on: ubuntu-latest
strategy:
matrix:
@ -53,3 +71,11 @@ jobs:
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
skip:
name: Skip
runs-on: ubuntu-latest
if: ${{needs.changes.outputs.changed != 'backend'}}
steps:
- name: Skip
run: echo "No backend-related changes detected, skipping."

View file

@ -3,29 +3,40 @@ on:
pull_request:
branches:
- master
paths:
- resources/assets/**
- .github/workflows/unit-frontend.yml
push:
branches:
- master
- next
paths:
- resources/assets/**
- .github/workflows/unit-frontend.yml
workflow_dispatch:
branches:
- master
- next
paths:
- resources/assets/**
- .github/workflows/unit-frontend.yml
env:
LARAVEL_BYPASS_ENV_CHECK: 1
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
changed: ${{ steps.filter.outputs.backend }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
frontend:
- './resources/assets/**'
- './vite.config.js'
- './package.json'
- './yarn.lock'
- './.eslintrc'
- './cypress.json'
test:
needs: changes
if: ${{needs.changes.outputs.changed == 'frontend'}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
@ -46,3 +57,11 @@ jobs:
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
skip:
needs: changes
if: ${{needs.changes.outputs.changed != 'frontend'}}
runs-on: ubuntu-latest
steps:
- name: Skip
run: echo "No frontend-related changes detected, skipping."

0
.gitmodules vendored
View file