Skip to content

Commit

Permalink
Fix stuck unit tests (#342)
Browse files Browse the repository at this point in the history
* Disable publish

* Change unit test command in CD

* Change trigger to push

* Test new CD

* Restore publish script
  • Loading branch information
AnasNaouchi authored May 17, 2024
1 parent abe3e4c commit f3c8f4a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 22 deletions.
64 changes: 51 additions & 13 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,74 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path

name: Maven Package

on:
release:
types: [created]

jobs:
publish:
name: Publish Maven package
build:
name: Build project
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle

- name: Cache Gradle dependencies
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run ktlint
run: ./gradlew sdk:ktlintCheck

- name: Build project
run: ./gradlew sdk:build -x test
- name: Unit tests
run: ./gradlew sdk:testProductionDebugUnitTest
- name: Publish package

unit-test-maven-publish:
name: Unit test and Publish Maven package
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # required for SonarCloud

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Cache Gradle dependencies
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run unit tests
# Switch to jacocoTestReport when instrumentation flakiness is fixed
run: ./gradlew sdk:jacocoUnitTestReport

- name: Publish Maven package
run: ./gradlew sdk:publish
env:
PGP_SIGNING_KEY: ${{ secrets.PGP_SIGNING_KEY }}
PGP_SIGNING_PASSWORD: ${{ secrets.PGP_SIGNING_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

9 changes: 0 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ jobs:
run: ./gradlew sdk:ktlintCheck

- name: Build project
env:
NETCETERA_LICENSE_KEY: ${{ secrets.NETCETERA_LICENSE_KEY }}
SCHEME_NAME: ${{ secrets.SCHEME_NAME }}
DS_ID: ${{ secrets.DS_ID }}
MESSAGE_VERSION: ${{ secrets.MESSAGE_VERSION }}
ACS_REF_NUMBER: ${{ secrets.ACS_REF_NUMBER }}
DS_PUBLIC_KEY: ${{ secrets.DS_PUBLIC_KEY }}
NETCETERA_API_KEY: ${{ secrets.NETCETERA_API_KEY }}

run: ./gradlew sdk:build -x test

unit-test:
Expand Down

0 comments on commit f3c8f4a

Please sign in to comment.