Skip to content

build sub-projects #5470

build sub-projects

build sub-projects #5470

name: build sub-projects
on:
pull_request: {}
workflow_dispatch: {}
merge_group: {}
jobs:
buildFrontend:
name: build frontend
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.12.0
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: "8.15.3"
- run: |-
pnpm install
pnpm projen
pnpm nx run-many --target=build
cd frontend/
pnpm run format
pnpm run build
pnpm run test
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
with:
check_name: Test results for frontend of web console
report_paths: './frontend/test-reports/junit.xml'
fail_on_failure: true
require_tests: true
detailed_summary: true
job_name: build frontend
update_check: true
include_passed: true
- name: Find mutations
id: self_mutation
run: |-
git add .
git diff --staged --patch --exit-code > .repo.patch || echo "self_mutation_happened=true" >> $GITHUB_OUTPUT
- name: Upload patch
if: steps.self_mutation.outputs.self_mutation_happened
uses: actions/upload-artifact@v4
with:
name: .repo.patch
path: .repo.patch
- name: Fail build on mutation
if: steps.self_mutation.outputs.self_mutation_happened
run: |-
echo "::error::Files were changed during build (see build log). If this was triggered from a fork, you will need to update your branch."
cat .repo.patch
exit 1
self-mutation:
needs: buildFrontend
runs-on: ubuntu-latest
permissions:
contents: write
if: always() && needs.buildFrontend.outputs.self_mutation_happened && !(github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PROJEN_GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Download patch
uses: actions/download-artifact@v4
with:
name: .repo.patch
path: ${{ runner.temp }}
- name: Apply patch
run: '[ -s ${{ runner.temp }}/.repo.patch ] && git apply ${{ runner.temp }}/.repo.patch || echo "Empty patch. Skipping."'
- name: Set git identity
run: |-
git config user.name "github-actions"
git config user.email "github-actions@github.com"
- name: Push changes
env:
PULL_REQUEST_REF: ${{ github.event.pull_request.head.ref }}
run: |-
git add .
git commit -s -m "chore: self mutation"
git push origin HEAD:$PULL_REQUEST_REF
build-etl-common:
name: build etl common library
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
- name: Setup Gradle
uses: gradle/gradle-build-action@v3
with:
gradle-version: 7.6
- name: Build & Test etl common library
run: |-
cd ./src/data-pipeline/etl-common
gradle clean build
gradle jacocoAggregatedReport
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
with:
check_name: Test results for etl common library
report_paths: './src/data-pipeline/etl-common/build/test-results/test/TEST-*.xml'
fail_on_failure: true
require_tests: true
detailed_summary: true
job_name: build etl common library
update_check: true
include_passed: true
- name: Add coverage to PR
id: jacoco
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ./src/data-pipeline/etl-common/build/reports/jacoco/jacocoAggregatedReport/jacocoAggregatedReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
title: Etl common library's test coverage
min-coverage-overall: 80
min-coverage-changed-files: 80
build-data-pipeline:
name: build data pipeline
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
- name: Setup Gradle
uses: gradle/gradle-build-action@v3
with:
gradle-version: 7.6
- name: Build & Test data pipeline spark application
run: |-
cd ./src/data-pipeline/etl-common
gradle clean install
cd ../spark-etl
gradle clean build
gradle jacocoAggregatedReport
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
with:
check_name: Test results for data pipeline spark application
report_paths: './src/data-pipeline/spark-etl/build/test-results/test/TEST-*.xml'
fail_on_failure: true
require_tests: true
detailed_summary: true
job_name: build data pipeline
update_check: true
include_passed: true
- name: Add coverage to PR
id: jacoco
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ./src/data-pipeline/spark-etl/build/reports/jacoco/jacocoAggregatedReport/jacocoAggregatedReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
title: Data Pipeline spark application's test coverage
min-coverage-overall: 80
min-coverage-changed-files: 80
build-streaming-ingestion:
name: build streaming ingestion
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'corretto'
- name: Setup Gradle
uses: gradle/gradle-build-action@v3
with:
gradle-version: 7.6
- name: Build & Test streaming ingestion flink application
run: |-
cd ./src/data-pipeline/etl-common
gradle clean install
cd ../../streaming-ingestion/flink-etl
gradle clean build
gradle jacocoAggregatedReport
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
with:
check_name: Test results for streaming ingestion flink application
report_paths: './src/streaming-ingestion/flink-etl/build/test-results/test/TEST-*.xml'
fail_on_failure: true
require_tests: true
detailed_summary: true
job_name: build streaming ingestion
update_check: true
include_passed: true
- name: Add coverage to PR
id: jacoco
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ./src/streaming-ingestion/flink-etl/build/reports/jacoco/jacocoAggregatedReport/jacocoAggregatedReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
title: Streaming ingestion flink application's test coverage
min-coverage-overall: 80
min-coverage-changed-files: 80
build-data-pipeline-example:
name: build data pipeline example
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
- name: Setup Gradle
uses: gradle/gradle-build-action@v3
with:
gradle-version: 7.6
- name: Build & Test data pipeline examples
run: |-
cd ./examples/custom-plugins
./build.sh