diff --git a/.github/workflows/java-client.build-and-test.yaml b/.github/workflows/java-client.build-and-test.yaml new file mode 100644 index 0000000..beb96d5 --- /dev/null +++ b/.github/workflows/java-client.build-and-test.yaml @@ -0,0 +1,84 @@ +# +# Copyright (c) 2024 - for information on the respective copyright owner +# see the NOTICE file and/or the repository https://github.com/carbynestack/thymus. +# +# SPDX-License-Identifier: Apache-2.0 +# +name: Build and test Java Client +on: + workflow_dispatch: + push: + branches: + - 'master' + pull_request: + branches: + - 'master' +jobs: + changes: + runs-on: ubuntu-22.04 + permissions: + pull-requests: read + outputs: + java-client: ${{ steps.filter.outputs.java-client }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Check whether Java client codebase is affected + uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + java-client: + - '(clients/java|.github)/**' + java-client-test: + runs-on: ubuntu-22.04 + needs: changes + if: ${{ needs.changes.outputs.java-client == 'true' }} + defaults: + run: + working-directory: clients/java + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: '8' + distribution: 'temurin' + cache: 'maven' + - name: Setting up Github Package Repository as Maven Repository + uses: s4u/maven-settings-action@v2 + with: + githubServer: false + servers: | + [{ + "id": "github", + "username": "${{ github.actor }}", + "password": "${{ secrets.GITHUB_TOKEN }}" + }] + - name: Build with Maven + run: mvn install -Dskip.tests --batch-mode --update-snapshots --no-transfer-progress + - name: Run Tests + run: mvn verify --activate-profiles coverage --batch-mode --no-transfer-progress + - name: Collect Jacoco reports + run: echo ::set-output name=reports::$(find . -regex 'target/site/jacoco/jacoco.xml' | tr '\n' ',' | sed 's/.$//') + id: jacoco + - uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ${{ steps.jacoco.outputs.reports }} + flags: java-client + name: codecov + # This is required to allow for setting the test job as required in scenarios + # where the tests are not actually run, e.g., when the helm chart is updated. + java-client-test-status: + runs-on: ubuntu-22.04 + needs: java-client-test + if: '!cancelled()' # Makes the job run regardless whether 'test' succeeds or not but allows for cancellation + steps: + - name: Tests successful + if: ${{ !(contains(needs.java-client-test.result, 'failure')) }} + run: exit 0 + - name: Tests failed + if: ${{ contains(needs.java-client-test.result, 'failure') }} + run: exit 1 diff --git a/.github/workflows/java-client.publish.yaml b/.github/workflows/java-client.publish.yaml new file mode 100644 index 0000000..e446224 --- /dev/null +++ b/.github/workflows/java-client.publish.yaml @@ -0,0 +1,61 @@ +# +# Copyright (c) 2024 - for information on the respective copyright owner +# see the NOTICE file and/or the repository https://github.com/carbynestack/thymus. +# +# SPDX-License-Identifier: Apache-2.0 +# +name: Publish Java Client +on: + push: + tags: + - "java-client-v[0-9]+.[0-9]+.[0-9]+" +defaults: + run: + working-directory: clients/java +env: + WORKING_DIRECTORY: clients/java +jobs: + publish: + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Retrieve license obligation resources + run: | + cd 3RD-PARTY-LICENSES + find . -maxdepth 1 -type d -not -path . | zip -r@ 3rd-party-copyrights + find . -iname origin.src | \ + awk '{ \ + split($0,b,"/"); \ + system("xargs < " $0 " curl --create-dirs -Lo ./sources/" b[2] ".zip " $2)}' && \ + find -regex './sources$' | awk '{system("zip -jr ./3rd-party-sources.zip " $0)}' + mkdir -p ../license-obligations && mv `find . -regex "^./3rd-party-.*.zip$"` ../license-obligations/ + - name: Update Release with license obligations resources + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: ${{ env.WORKING_DIRECTORY }}/license-obligations/* + artifactErrorsFailBuild: true + makeLatest: true + omitBodyDuringUpdate: true + omitNameDuringUpdate: true + - name: Setup Java + uses: actions/setup-java@v4 + with: + java-version: '8' + distribution: 'temurin' + cache: 'maven' + - name: Setting up Github Package Repository as Maven Repository + uses: s4u/maven-settings-action@v2 + with: + githubServer: false + servers: | + [{ + "id": "github", + "username": "${{ secrets.GHPR_USERNAME }}", + "password": "${{ secrets.GHPR_TOKEN }}" + }] + - name: Publish version to GitHub Packages + run: mvn deploy -Dskip.tests --batch-mode --no-transfer-progress + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 14ab993..782d018 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,4 +1,5 @@ { ".": "0.1.1", - "charts/thymus": "0.2.3" + "charts/thymus": "0.2.3", + "clients/java": "0.1.0" }