Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post Migration - Split UT and IT in separate jobs #29

Merged
merged 5 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 46 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,46 @@ on:
env:
TEST_CASSANDRA_PWD: ${RANDOM}${RANDOM}${RANDOM}
jobs:
test-java:


test-transform:
runs-on: ubuntu-latest
#if: ${{ false }} # disable for now
#avoids duplicate execution of pr from local repo, but allows pr from forked repos and dependabot
if: (github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork) || (github.event_name == 'pull_request' && (github.event.pull_request.head.repo.fork || startsWith(github.head_ref, 'dependabot/')))
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Test transform module and aggregate surefire report
run: mvn test -Daggregate=true -Dtest=* -pl modevo-transform -am -Dmaven.test.failure.ignore=true -U --no-transfer-progress
- name: Additional aggregated junit report
uses: javiertuya/junit-report-action@v1
with:
surefire-files: "**/target/surefire-reports/TEST-*.xml"
report-dir: target/site

- name: Generate report checks
if: always()
uses: mikepenz/[email protected]
with:
check_name: "test-result-transform"
report_paths: "**/surefire-reports/TEST-*.xml"
fail_on_failure: 'true'

- if: always()
name: Publish test report files
uses: actions/upload-artifact@v4
with:
name: "test-report-files-transform"
path: |
target/site
**/target/site/jacoco/jacoco.xml
**/target/surefire-reports
test-script:
runs-on: ubuntu-latest
#if: ${{ false }} # disable for now
#avoids duplicate execution of pr from local repo, but allows pr from forked repos and dependabot
Expand All @@ -33,7 +72,7 @@ jobs:
chmod u+x setup/wait-container-ready.sh && ./setup/wait-container-ready.sh test-cassandra 1 "Created default superuser role"
docker exec test-cassandra cqlsh localhost 9042 -u cassandra -p cassandra -f creationSchema.cql
- name: Test and aggregate surefire report
run: mvn test -Daggregate=true -Dmaven.test.failure.ignore=true -U --no-transfer-progress
run: mvn test -Daggregate=true -Dtest=!TestTransform* -pl modevo-script -am -Dmaven.test.failure.ignore=true -U --no-transfer-progress

- name: Additional aggregated junit report
uses: javiertuya/junit-report-action@v1
Expand All @@ -45,22 +84,22 @@ jobs:
if: always()
uses: mikepenz/[email protected]
with:
check_name: "test-result"
check_name: "test-result-script"
report_paths: "**/surefire-reports/TEST-*.xml"
fail_on_failure: 'true'

- if: always()
name: Publish test report files
uses: actions/upload-artifact@v4
with:
name: "test-report-files"
name: "test-report-files-script"
path: |
target/site
**/target/site/jacoco/jacoco.xml
**/target/surefire-reports

sonarqube:
needs: [test-java]
needs: [test-transform, test-script]
#if: ${{ false }} # disable for now
#This job fails when comming from a dependabot PR (can't read the sonarqube token for security reasons).
#Links to discussions and workaround at: https://github.com/giis-uniovi/samples-giis-template/issues/4
Expand All @@ -71,7 +110,8 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
sonar-token: ${{ secrets.SONAR_TOKEN }}
restore-artifact-name1: "test-report-files"
restore-artifact-name1: "test-report-files-transform"
suarezgpablo marked this conversation as resolved.
Show resolved Hide resolved
restore-artifact-name2: "test-report-files-script"

publish-java-snapshot:
if: ${{ false }} # disable for now
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.junit.Rule;
import org.junit.rules.TestName;

public class TestSchemaChanges {
public class TestTransform {

private static final String inputModelsFolderTemp = "target/input-models/";
private static final String schema = "schema.xmi";
Expand Down