From 58fb126394dd535d42d9dac54ab508a068a96ab3 Mon Sep 17 00:00:00 2001 From: Eyre_S Date: Fri, 9 Aug 2024 15:11:34 +0800 Subject: [PATCH] Squashed GitHub workflows commit 0cb3f1eae52f78fd300bac7af150af5821990e5c Author: Eyre_S Date: Fri Aug 9 15:09:52 2024 +0800 test actions x18 commit 436efe382f4b0c2051b9945984371e1573498c00 Author: Eyre_S Date: Fri Aug 9 15:00:45 2024 +0800 test actions x17 commit bccf4feafa8a8759e987c605cd37f6ed4b996d61 Author: Eyre_S Date: Fri Aug 9 14:53:28 2024 +0800 test actions x16 commit cbe0b62d45dcc11e429b411b9feb3523e7ca18be Author: Eyre_S Date: Fri Aug 9 14:38:36 2024 +0800 test actions x15 commit 3dd08270475254cbf04c137fe7d6b79a47aef189 Author: Eyre_S Date: Fri Aug 9 14:25:03 2024 +0800 test actions x14 commit 9c9c52d74570a1b5a18fcc4ad4a752eeb98d3d12 Author: Eyre_S Date: Fri Aug 9 14:22:14 2024 +0800 test actions x13 commit 887d728c4a756bd6152032d51f2b470f85103f8d Author: Eyre_S Date: Fri Aug 9 14:03:04 2024 +0800 test actions x12 commit 370258a875df42b7b4d00b4e98e808ada328415f Author: Eyre_S Date: Fri Aug 9 13:39:33 2024 +0800 test actions x11 commit 2d3b0b3f0ca266d7cefe515cebcef804bb248b33 Author: Eyre_S Date: Fri Aug 9 13:37:34 2024 +0800 test actions x10 commit 4e5563d16a0d8236a32d6809767e2926fa495a41 Author: Eyre_S Date: Fri Aug 9 13:36:29 2024 +0800 test actions x9 commit 38ae144cee7428835fef1e7b06cb60f968a098c6 Author: Eyre_S Date: Fri Aug 9 13:34:50 2024 +0800 test actions x8 commit 21ee2ed1609e2aa475102616fbbcd3e309268b43 Author: Eyre_S Date: Fri Aug 9 13:29:07 2024 +0800 test actions x7 commit c07ae3d3a95ed044456d8f14a70fe17de20ec43e Author: Eyre_S Date: Fri Aug 9 13:08:24 2024 +0800 test actions x6 commit 54a3c67cb22283da803838e6fab74489803a4896 Author: Eyre_S Date: Fri Aug 9 12:59:29 2024 +0800 test actions x5 commit af690cdcf50c835e4462043da0ad3eed0d6c95a0 Author: Eyre_S Date: Fri Aug 9 12:50:04 2024 +0800 test actions x4 commit 484ee0fb0fe0035a3d12eb66dbada0f3d4ed73b2 Author: Eyre_S Date: Fri Aug 9 12:46:40 2024 +0800 test actions x3 commit 6d96fd72b81bb88042fb4138857634bdbbd78673 Author: Eyre_S Date: Fri Aug 9 12:38:09 2024 +0800 test actions x2 commit 9965f78406b9b91f69165c2c3fa8dec5cc0e4883 Author: Eyre_S Date: Fri Aug 9 01:18:33 2024 +0800 test actions fix commit 78e2c4b65fe5dfb6e74a52ea3bd452b30c9bb345 Author: Eyre_S Date: Fri Aug 9 01:15:21 2024 +0800 test actions --- .github/workflows/assembly-generate.yml | 28 ++++++++++++++++++ .github/workflows/assembly-run.yml | 33 +++++++++++++++++++++ .github/workflows/build.yml | 32 ++++++++++++++++++++ .github/workflows/test.yml | 11 +++++++ .github/workflows/unit-test.yml | 39 +++++++++++++++++++++++++ 5 files changed, 143 insertions(+) create mode 100644 .github/workflows/assembly-generate.yml create mode 100644 .github/workflows/assembly-run.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/test.yml create mode 100644 .github/workflows/unit-test.yml diff --git a/.github/workflows/assembly-generate.yml b/.github/workflows/assembly-generate.yml new file mode 100644 index 0000000..424abfa --- /dev/null +++ b/.github/workflows/assembly-generate.yml @@ -0,0 +1,28 @@ +name: assembly-run.yml +on: [workflow_call] +jobs: + build: + uses: ./.github/workflows/build.yml + assembly: + needs: [build] + 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 with SBT" + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: sbt + - name: "Generate assembly jar" + run: sbt assembly + - name: "Publish assembly jar" + uses: actions/upload-artifact@v4 + with: + name: 'assembly-jar' + path: ./morny-coeur/target/*-assembly-*.jar diff --git a/.github/workflows/assembly-run.yml b/.github/workflows/assembly-run.yml new file mode 100644 index 0000000..62a7197 --- /dev/null +++ b/.github/workflows/assembly-run.yml @@ -0,0 +1,33 @@ +name: assembly-run.yml +on: [workflow_call] +jobs: + generate-assembly: + uses: ./.github/workflows/assembly-generate.yml + run-assembly: + needs: [generate-assembly] + runs-on: ubuntu-latest + steps: + - name: "Setup assembly jar from artifacts" + uses: actions/download-artifact@v4 + with: + name: 'assembly-jar' + path: ./assembles/ + - name: "Setup Java 21" + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + - name: "Run assembly jar" + id: assembly-run + shell: bash + run: | + + exec 5>&1 + outputs=$(java -jar ./assembles/*.jar -q -v | tee >(cat - >&5)) + + echo '# Assembly Jar Runs' >> $GITHUB_STEP_SUMMARY + echo '' >> $GITHUB_STEP_SUMMARY + echo 'The execution result while running assembly jar:' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo "$outputs" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f8df18c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,32 @@ +name: "Build" +run-name: "Build projects to ensure compiling is successful" +on: [workflow_call] +jobs: + compile: + runs-on: ubuntu-latest + steps: + - name: "Check if there's already have cache" + id: check-cache + uses: actions/cache/restore@v4 + with: + path: "./" + key: ${{ runner.os }}-build-${{ github.sha }} + lookup-only: 'true' + - if: steps.check-cache.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + - if: steps.check-cache.outputs.cache-hit != 'true' + name: "Setup Java 21 with SBT" + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: sbt + - if: steps.check-cache.outputs.cache-hit != 'true' + name: "Compile Project" + run: sbt compile + - if: steps.check-cache.outputs.cache-hit != 'true' + name: "Cache the built project" + uses: actions/cache/save@v4 + with: + path: "./" + key: ${{ runner.os }}-build-${{ github.sha }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..e335172 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,11 @@ +name: Tests +on: [push] +jobs: + check-build: + uses: ./.github/workflows/build.yml + check-unit-tests: + needs: [check-build] + uses: ./.github/workflows/unit-test.yml + check-assembly-run: + needs: [check-build] + uses: ./.github/workflows/assembly-run.yml diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml new file mode 100644 index 0000000..1b19455 --- /dev/null +++ b/.github/workflows/unit-test.yml @@ -0,0 +1,39 @@ +name: "Unit Test" +run-name: "Test projects using Unit Test framework to ensure code quality" +on: [workflow_call] +jobs: + build: + uses: ./.github/workflows/build.yml + unit-test: + needs: [build] + 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 with SBT" + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: sbt + - name: "Run unit tests" + id: do-unit-test + run: sbt test + - name: "Upload test reports as artifact" + if: steps.do-unit-test.conclusion == 'failure' || steps.do-unit-test.conclusion == 'success' + uses: actions/upload-artifact@v4 + with: + name: 'unit-test-report' + path: ./*/target/test-reports/* + - name: "Publish test report to summary" + if: steps.do-unit-test.conclusion == 'failure' || steps.do-unit-test.conclusion == 'success' + uses: phoenix-actions/test-reporting@v15 + with: + output-to: 'step-summary' + name: 'Unit Tests Report' + path: ./*/target/test-reports/*.xml + reporter: 'java-junit'