Refactor unit test profiles, try to speed things up #3785
Workflow file for this run
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
# @author Ivan Senic | |
name: Continuous Integration | |
# runs on | |
# * pushes and pull requests on the "main" (pull request only for specific paths) | |
# * manual trigger | |
on: | |
push: | |
branches: [ "main"] | |
pull_request: | |
branches: [ "main", "feature/*" ] | |
workflow_dispatch: | |
# cancel same workflows in progress for pull request branches | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
# global env vars, available in all jobs and steps | |
env: | |
MAVEN_OPTS: '-Xmx4g' | |
DS_ARTIFACTORY_USERNAME: ${{ secrets.DS_ARTIFACTORY_USERNAME }} | |
DS_ARTIFACTORY_PASSWORD: ${{ secrets.DS_ARTIFACTORY_PASSWORD }} | |
# Jobs structure: | |
# | |
# 1. Runs unit tests | |
# 2. Then 2 jobs in parallel | |
# a) Integration tests with docker image | |
# b) Integration tests with native docker image | |
jobs: | |
# runs unit tests | |
build: | |
name: Unit tests | |
runs-on: ubuntu-latest | |
# max run time 12 minutes | |
timeout-minutes: 12 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: maven | |
- name: Setup Maven | |
run: | | |
mkdir -p ~/.m2 | |
cat <<EOF > ~/.m2/settings.xml | |
<settings> | |
<servers> | |
<server> | |
<id>stargate-central</id> | |
<username>${DS_ARTIFACTORY_USERNAME}</username> | |
<password>${DS_ARTIFACTORY_PASSWORD}</password> | |
</server> | |
<server> | |
<id>stargate-snapshots</id> | |
<username>${DS_ARTIFACTORY_USERNAME}</username> | |
<password>${DS_ARTIFACTORY_PASSWORD}</password> | |
</server> | |
<server> | |
<id>artifactory</id> | |
<username>${DS_ARTIFACTORY_USERNAME}</username> | |
<password>${DS_ARTIFACTORY_PASSWORD}</password> | |
</server> | |
<server> | |
<id>artifactory-snapshots</id> | |
<username>${DS_ARTIFACTORY_USERNAME}</username> | |
<password>${DS_ARTIFACTORY_PASSWORD}</password> | |
</server> | |
<server> | |
<id>artifactory-releases</id> | |
<username>${DS_ARTIFACTORY_USERNAME}</username> | |
<password>${DS_ARTIFACTORY_PASSWORD}</password> | |
</server> | |
</servers> | |
</settings> | |
EOF | |
# Adding -Poffline includes offline mode classes as well for test | |
- name: Build & Test | |
run: | | |
./mvnw -B -ntp clean test -Poffline | |
# runs int tests | |
int-tests: | |
name: Integration tests | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
# max run time 40 minutes | |
timeout-minutes: 40 | |
strategy: | |
# let all tests run, can find multiple failures in different setup | |
fail-fast: false | |
# matrix props: | |
matrix: | |
type: [ docker, native, dse69-it, hcd-it ] | |
include: | |
- type: docker | |
profile: '-Poffline' | |
- type: dse69-it | |
profile: '-Pdse69-it,offline' | |
- type: hcd-it | |
profile: '-Phcd-it,offline' | |
exclude: | |
- type: native | |
#profile: '-Pnative' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: maven | |
- name: Setup Maven | |
run: | | |
mkdir -p ~/.m2 | |
cat <<EOF > ~/.m2/settings.xml | |
<settings> | |
<servers> | |
<server> | |
<id>stargate-central</id> | |
<username>${DS_ARTIFACTORY_USERNAME}</username> | |
<password>${DS_ARTIFACTORY_PASSWORD}</password> | |
</server> | |
<server> | |
<id>stargate-snapshots</id> | |
<username>${DS_ARTIFACTORY_USERNAME}</username> | |
<password>${DS_ARTIFACTORY_PASSWORD}</password> | |
</server> | |
<server> | |
<id>artifactory</id> | |
<username>${DS_ARTIFACTORY_USERNAME}</username> | |
<password>${DS_ARTIFACTORY_PASSWORD}</password> | |
</server> | |
<server> | |
<id>artifactory-snapshots</id> | |
<username>${DS_ARTIFACTORY_USERNAME}</username> | |
<password>${DS_ARTIFACTORY_PASSWORD}</password> | |
</server> | |
<server> | |
<id>artifactory-releases</id> | |
<username>${DS_ARTIFACTORY_USERNAME}</username> | |
<password>${DS_ARTIFACTORY_PASSWORD}</password> | |
</server> | |
</servers> | |
</settings> | |
EOF | |
# login to ECR to we can pull coord image from there | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.ECR_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.ECR_SECRET_KEY }} | |
aws-region: us-east-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
with: | |
mask-password: 'true' | |
# run the int tests | |
- name: Integration Test | |
env: | |
COORD_IMAGE: ${{ secrets.ECR_REPOSITORY }}/stargateio/coordinator-dse-next | |
run: | | |
./mvnw -B -ntp clean verify -DskipUnitTests -Dquarkus.container-image.build=true -Dquarkus.container-image.tag=${{ github.sha }} -Dstargate.int-test.coordinator.image=$COORD_IMAGE -Drun-create-index-parallel=true ${{ matrix.profile }} |