Skip to content

Refactor the tests #135

Refactor the tests

Refactor the tests #135

Workflow file for this run

name: build-action
on:
push:
branches-ignore:
- 'gh-pages'
pull_request:
branches-ignore:
- 'gh-pages'
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{matrix.os}}
steps:
- name: Check repository
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
#Run only on macOS
- name: Setup Docker
if: ${{ matrix.os == 'macos-latest' && github.event_name == 'pull_request' }}
uses: better0fdead/actions-setup-docker@better0fdead/increase-timeout
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
#Build without test on Windows or macOS (when not a PR)
- name: Gradle build
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_CLOUD_ORGANIZATION: ${{ vars.SONAR_CLOUD_ORGANIZATION }}
SONAR_CLOUD_PROJECT_KEY: ${{ vars.SONAR_CLOUD_PROJECT_KEY }}
SONAR_CLOUD_PROJECT_NAME: ${{ vars.SONAR_CLOUD_PROJECT_NAME }}
run: |
if [[ "$RUNNER_OS" == "Windows" || ( "$RUNNER_OS" == "macOS" && ${{ github.event_name }} != 'pull_request' ) ]]; then
./gradlew build -x test
elif [[ ${{ github.event_name }} == 'pull_request' && ${{ github.event.pull_request.head.repo.full_name != 'eclipse/hara-ddiclient' }} ]]; then
./gradlew --info build
else
./gradlew --info build sonar
fi
shell: bash