feat: enhance test CI #2
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
name: Run Tests | |
concurrency: | |
group: docker-${{ github.event_name }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
test-go: | |
name: Test Go Codes | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
service: | |
- game | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
src: | |
- '.github/workflows/test.yml' | |
- '${{ matrix.service }}-service/**' | |
- name: Set up Golang | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Run Go Test | |
if: steps.changes.outputs.src == 'true' | |
run: | | |
cd ./${{ matrix.service }}-service | |
go test ./... | |
test-java: | |
name: Test Java Codes | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
service: | |
- hrm | |
- player | |
- geo | |
- challenge | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
src: | |
- '.github/workflows/test.yml' | |
- '${{ matrix.service }}-service/**' | |
- name: Set up JDK 21 for x64 | |
uses: actions/setup-java@v3 | |
if: steps.changes.outputs.src == 'true' | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
architecture: x64 | |
- name: Run Maven Test | |
if: steps.changes.outputs.src == 'true' | |
run: | | |
cd ./${{ matrix.service }}-service | |
mvn test |