-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
backend: | ||
- changed-files: | ||
- any-glob-to-any-file: | ||
- '*gradle*' | ||
- gradle/** | ||
- openapi/** | ||
- src/** | ||
frontend: | ||
- changed-files: | ||
- any-glob-to-any-file: | ||
- web/** | ||
workflows: | ||
- changed-files: | ||
- any-glob-to-any-file: | ||
- .github/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Landonlite Backend Workflow | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "master" | ||
|
||
jobs: | ||
Compare-changes: | ||
uses: ./.github/workflows/compare-changes.yml | ||
|
||
print-compare-changes-output: | ||
runs-on: ubuntu-latest | ||
needs: Compare-changes | ||
steps: | ||
- run: echo "BackendDisable ${{ needs.compare-changes.outputs.backendDisable }}" | ||
- run: printf "backendDisable ${{ needs.Compare-changes.outputs.backendDisable == 'true' }}\n" | ||
printf "playwrightDisable ${{ needs.Compare-changes.outputs.playwrightDisable == 'true' }}" | ||
|
||
backend-tests: | ||
needs: | ||
- Compare-changes | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build | ||
|
||
- name: Run tests | ||
run: ./gradlew test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Compare changes | ||
on: | ||
workflow_call: | ||
outputs: | ||
backendDisable: | ||
value: ${{ jobs.compare-changes.outputs.backendDisable && jobs.compare-changes.outputs.workflowsDisable }} | ||
frontendDisable: | ||
value: ${{ jobs.compare-changes.outputs.frontendDisable && jobs.compare-changes.outputs.workflowsDisable }} | ||
playwrightDisable: | ||
value: ${{ jobs.compare-changes.outputs.playwrightDisable && jobs.compare-changes.outputs.workflowsDisable && jobs.compare-changes.outputs.backendDisable && jobs.compare-changes.outputs.frontendDisable }} | ||
|
||
jobs: | ||
compare-changes: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
outputs: | ||
backendDisable: ${{ !contains(fromJSON(steps.changed-files.outputs.changes), 'backend') }} | ||
frontendDisable: ${{ !contains(fromJSON(steps.changed-files.outputs.changes), 'frontend') }} | ||
playwrightDisable: ${{ !contains(fromJSON(steps.changed-files.outputs.changes), 'playwright') }} | ||
workflowsDisable: ${{ !contains(fromJSON(steps.changed-files.outputs.changes), 'workflows') }} | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- name: Get changed files | ||
id: changed-files | ||
uses: linz/action-change-labeler@5552aadd9f8d2ca6df5515487a2e0cb6c5226b26 # v1.0.0 | ||
|
||
- run: echo "Changes detected ${{ steps.changed-files.outputs.changes }}" | ||
- run: echo "backend changed" | ||
if: contains(fromJSON(steps.changed-files.outputs.changes), 'backend') | ||
- run: echo "frontend changed" | ||
if: contains(fromJSON(steps.changed-files.outputs.changes), 'frontend') | ||
- run: echo "playwright changed" | ||
if: contains(fromJSON(steps.changed-files.outputs.changes), 'playwright') | ||
- run: echo "workflows changed" | ||
if: contains(fromJSON(steps.changed-files.outputs.changes), 'workflows') | ||
|
||
- name: Check for both frontend and backend changes | ||
if: ${{ contains(fromJSON(steps.changed-files.outputs.changes), 'backend') && contains(fromJSON(steps.changed-files.outputs.changes), 'frontend')}} | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
core.setFailed('PR has both FE and BE changes, please split your FE and BE changes into separate PRs') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Landonlite Frontend Workflow | ||
on: | ||
pull_request: | ||
branches: | ||
- "master" | ||
|
||
jobs: | ||
compare-changes: | ||
uses: ./.github/workflows/compare-changes.yml | ||
|
||
print-compare-changes-output: | ||
runs-on: ubuntu-latest | ||
needs: compare-changes | ||
steps: | ||
- run: echo "FrontendDisable ${{ needs.compare-changes.outputs.frontendDisable }}" | ||
- run: printf "should run frontend CI ${{ needs.compare-changes.outputs.frontendDisable == 'false' }}\n" | ||
|
||
frontend-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Cache npm packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Run tests | ||
run: npm test |