Coeur-Morny-Cono/.github/workflows/unit-test.yml
Eyre_S 3dd701cbef
Suqash merge: Separate unit tests
commit 3b24ff6d15aa3671176629ca86ef1c34cd56d6cd
Author: Eyre_S <sukazyo@outlook.com>
Date:   Thu Feb 27 19:04:30 2025 +0800

    fix assembly run error

commit 5dbad550ba3bc09c1c8d7ce4863d8d2dabf2c56d
Author: Eyre_S <sukazyo@outlook.com>
Date:   Thu Feb 27 19:01:38 2025 +0800

    fix artifact conflict

commit 377140f225803138f404b89d77f0becdb2c6e912
Author: Eyre_S <sukazyo@outlook.com>
Date:   Thu Feb 27 18:56:08 2025 +0800

    separate unit tests, remove unnecessary compile, add names
2025-02-27 19:07:19 +08:00

135 lines
4.3 KiB
YAML

name: "Unit Test"
run-name: "Test projects using Unit Test framework to ensure code quality"
on: [workflow_call]
jobs:
build-tests:
name: "Build project tests"
runs-on: ubuntu-latest
steps:
- name: "Setup cached built project"
uses: actions/cache/restore@v4
with:
path: "./"
key: ${{ runner.os }}-build-${{ github.sha }}
fail-on-cache-miss: 'true'
- name: "Setup Java 21"
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: sbt
- name: "Setup sbt"
uses: sbt/setup-sbt@v1
- name: "Compile unit tests"
run: sbt 'Test / compile'
- name: "Cache compiled unit tests"
uses: actions/cache/save@v4
with:
path: "./"
key: ${{ runner.os }}-build-${{ github.sha }}-withTests
unit-test-morny-system-lib:
name: "Run unit-test for morny-system-lib"
needs: [build-tests]
runs-on: ubuntu-latest
steps:
- name: "Setup cached built project"
uses: actions/cache/restore@v4
with:
path: "./"
key: ${{ runner.os }}-build-${{ github.sha }}-withTests
fail-on-cache-miss: 'true'
- name: "Setup Java 21"
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: sbt
- name: "Setup sbt"
uses: sbt/setup-sbt@v1
- name: "Run unit tests"
continue-on-error: true
run: sbt 'morny_system_lib / test'
- name: "Upload test reports as artifact"
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: 'unit-test-report_morny-system-lib'
path: ./morny-system-lib/target/test-reports/*
- name: "Publish test report to summary"
uses: phoenix-actions/test-reporting@v15
with:
output-to: 'step-summary'
name: 'Unit Tests Report'
path: ./morny-system-lib/target/test-reports/*.xml
reporter: 'java-junit'
unit-test-morny-core:
name: "Run unit-test for morny-core"
needs: [build-tests]
runs-on: ubuntu-latest
steps:
- name: "Setup cached built project"
uses: actions/cache/restore@v4
with:
path: "./"
key: ${{ runner.os }}-build-${{ github.sha }}-withTests
fail-on-cache-miss: 'true'
- name: "Setup Java 21"
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: sbt
- name: "Setup sbt"
uses: sbt/setup-sbt@v1
- name: "Run unit tests"
continue-on-error: true
run: sbt 'morny_core / test'
- name: "Upload test reports as artifact"
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: 'unit-test-report_morny-core'
path: ./morny-core/target/test-reports/*
- name: "Publish test report to summary"
uses: phoenix-actions/test-reporting@v15
with:
output-to: 'step-summary'
name: 'Unit Tests Report'
path: ./morny-core/target/test-reports/*.xml
reporter: 'java-junit'
unit-test-morny-coeur:
name: "Run unit-test for morny-coeur"
needs: [build-tests]
runs-on: ubuntu-latest
steps:
- name: "Setup cached built project"
uses: actions/cache/restore@v4
with:
path: "./"
key: ${{ runner.os }}-build-${{ github.sha }}-withTests
fail-on-cache-miss: 'true'
- name: "Setup Java 21"
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: sbt
- name: "Setup sbt"
uses: sbt/setup-sbt@v1
- name: "Run unit tests"
continue-on-error: true
run: sbt 'morny_coeur / test'
- name: "Upload test reports as artifact"
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: 'unit-test-report_morny-coeur'
path: ./morny-coeur/target/test-reports/*
- name: "Publish test report to summary"
uses: phoenix-actions/test-reporting@v15
with:
output-to: 'step-summary'
name: 'Unit Tests Report'
path: ./morny-coeur/target/test-reports/*.xml
reporter: 'java-junit'