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: pull_request:
branches: branches:
- master - master
paths-ignore:
- resources/assets/**
push: push:
branches: branches:
- master - master
paths-ignore:
- resources/assets/**
workflow_dispatch: workflow_dispatch:
branches: branches:
- master - master
paths-ignore:
- resources/assets/**
jobs: 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: test:
needs: changes
if: ${{needs.changes.outputs.changed == 'backend'}}
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
@ -53,3 +71,11 @@ jobs:
uses: codecov/codecov-action@v1 uses: codecov/codecov-action@v1
with: with:
token: ${{ secrets.CODECOV_TOKEN }} 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: pull_request:
branches: branches:
- master - master
paths:
- resources/assets/**
- .github/workflows/unit-frontend.yml
push: push:
branches: branches:
- master - master
- next
paths:
- resources/assets/**
- .github/workflows/unit-frontend.yml
workflow_dispatch: workflow_dispatch:
branches: branches:
- master - master
- next
paths:
- resources/assets/**
- .github/workflows/unit-frontend.yml
env: env:
LARAVEL_BYPASS_ENV_CHECK: 1 LARAVEL_BYPASS_ENV_CHECK: 1
jobs: 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: test:
needs: changes
if: ${{needs.changes.outputs.changed == 'frontend'}}
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
@ -46,3 +57,11 @@ jobs:
uses: codecov/codecov-action@v1 uses: codecov/codecov-action@v1
with: with:
token: ${{ secrets.CODECOV_TOKEN }} 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