Skip to content

Build

Build #3476

Workflow file for this run

name: Build
on:
push:
branches: main
pull_request:
branches: main
schedule:
- cron: '0 16 * * *'
workflow_dispatch:
permissions:
contents: read
jobs:
build:
if: ${{ github.repository_owner == 'ihub-pub' }}
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
disable-sudo: true
egress-policy: audit
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Set up JDK 17
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Build with Gradle
uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 # v3.5.0
with:
arguments: build -x test --scan
project-matrix:
if: ${{ github.repository_owner == 'ihub-pub' }}
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.name.outputs.test }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
disable-sudo: true
egress-policy: audit
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- id: name
name: Project Name Matrix
run: |
projects=()
for file in ./*
do
if [[ $file =~ "ihub-" ]]
then
projects[${#projects[@]}]=$(basename $file)
fi
done
p=$(IFS=,; echo "${projects[*]}")
p=${p//,/\",\"}
echo "test=[\"$p\"]" >> $GITHUB_OUTPUT
matrix-test:
runs-on: ubuntu-latest
needs: project-matrix
strategy:
matrix:
project_name: ${{ fromJson(needs.project-matrix.outputs.matrix) }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
disable-sudo: true
egress-policy: audit
- name: Checkout
if: ${{ matrix.project_name != 'ihub-plugins' }}
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Checkout ref main
if: ${{ matrix.project_name == 'ihub-plugins' }}
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
ref: main
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Testspace Setup CLI
uses: testspace-com/setup-testspace@8472399a8030486c043937b8451b5e743f961ae0 # v1.0.7
with:
domain: ${{ github.repository_owner }}
- name: Chmod
run: chmod +x ./gradlew
- name: Build with Gradle
uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 # v3.5.0
with:
arguments: ${{ matrix.project_name }}:test -DiHubTest.failFast=true
- name: Upload Coverage Reports
if: ${{ github.repository_owner == 'ihub-pub' }}
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
- name: Publish Results to Testspace
run: testspace */build/test-results/test/*.xml */build/reports/*/test/*.xml
- name: Upload Test Result
if: ${{ failure() }}
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: ${{ matrix.project_name }}-test
path: |
*/build/reports/tests
retention-days: 1
check:
runs-on: ubuntu-latest
needs: [ build, matrix-test ]
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
disable-sudo: true
egress-policy: audit
- name: Check Status
run: echo "Check Status"