Skip to content

Commit

Permalink
fix: introduce release-please process (#51)
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Becker <[email protected]>
  • Loading branch information
sbckr committed Jul 27, 2023
1 parent 40a9faa commit 39a21ec
Show file tree
Hide file tree
Showing 21 changed files with 671 additions and 451 deletions.
48 changes: 0 additions & 48 deletions .github/workflows/build-test-deploy.yaml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/chart.publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# Copyright (c) 2023 - for information on the respective copyright owner
# see the NOTICE file and/or the repository https://github.com/carbynestack/castor.
#
# SPDX-License-Identifier: Apache-2.0
#
name: Publish Service Chart
on:
push:
tags:
- "chart-v[0-9]+.[0-9]+.[0-9]+"
env:
REGISTRY: ghcr.io
jobs:
publish:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get version
run: echo "VERSION=${GITHUB_REF#refs/*/chart-v}" >> $GITHUB_ENV
- name: Log in to container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Helm Chart
uses: appany/[email protected]
with:
name: castor
repository: carbynestack
tag: ${{ env.VERSION }}
path: castor-service/charts/castor
registry: ${{ env.REGISTRY }}
registry_username: ${{ github.actor }}
registry_password: ${{ secrets.GITHUB_TOKEN }}
85 changes: 85 additions & 0 deletions .github/workflows/java.build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#
# Copyright (c) 2021-2023 - for information on the respective copyright owner
# see the NOTICE file and/or the repository https://github.com/carbynestack/castor.
#
# SPDX-License-Identifier: Apache-2.0
#
name: Build and test artifacts
on:
workflow_dispatch:
push:
branches:
- 'master'
pull_request:
branches:
- 'master'
jobs:
changes:
runs-on: ubuntu-22.04
permissions:
pull-requests: read
outputs:
# Expose matched filters as job 'packages' output variable
modules: ${{ steps.filter.outputs.changes }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check which modules are affected
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
parent: '(castor-parent|.github)/**'
common: '(castor-common|.github)/**'
java-client: '(castor-java-client|.github)/**'
upload-java-client: '(castor-upload-java-client|.github)/**'
service: '(castor-service|.github)/**'
test:
needs: changes
strategy:
matrix:
module: ${{ fromJSON(needs.changes.outputs.modules) }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
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: ./mvnw install -pl ${GITHUB_REPOSITORY#*/}-${{ matrix.module }} -Dskip.tests --batch-mode --update-snapshots --no-transfer-progress
- name: Run Tests
run: ./mvnw verify -pl ${GITHUB_REPOSITORY#*/}-${{ matrix.module }} --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@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ steps.jacoco.outputs.reports }}
name: ${{ matrix.module }}
flags: ${{ matrix.module }}
# This is required to allow for setting the test job as required in scenarios where only some
# tests are run, e.g., for castor-java-client but not for castor-upload-java-client.
test-status:
runs-on: ubuntu-22.04
needs: test
steps:
- name: Tests successful
if: ${{ !(contains(needs.test.result, 'failure')) }}
run: exit 0
- name: Tests failed
if: ${{ contains(needs.test.result, 'failure') }}
run: exit 1
104 changes: 104 additions & 0 deletions .github/workflows/java.publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#
# Copyright (c) 2021-2023 - for information on the respective copyright owner
# see the NOTICE file and/or the repository https://github.com/carbynestack/castor.
#
# SPDX-License-Identifier: Apache-2.0
#
name: Publish and Release Java
on:
push:
tags:
- "parent-v[0-9]+.[0-9]+.[0-9]+"
- "common-v[0-9]+.[0-9]+.[0-9]+"
- "java-client-v[0-9]+.[0-9]+.[0-9]+"
- "upload-java-client-v[0-9]+.[0-9]+.[0-9]+"
- "service-v[0-9]+.[0-9]+.[0-9]+"
env:
REGISTRY: ghcr.io
jobs:
prepare:
runs-on: ubuntu-22.04
outputs:
MODULE: "${{ steps.module.outputs.identifier }}"
VERSION: "${{ steps.release.outputs.version }}"
steps:
- name: Get Release Package Name
id: package
run: |
echo ::set-output name=name::$(echo ${GITHUB_REF_NAME} | sed -E 's/-v[0-9]+\.[0-9]+\.[0-9]+//')
- name: Get Module Identifier
id: module
run: |
echo ::set-output name=identifier::${GITHUB_REPOSITORY#*/}-${{ steps.package.outputs.name }}
- name: Checkout repository
uses: actions/checkout@v2
- name: Get Release Version
run: echo ::set-output name=version::$(${GITHUB_REF#refs/*/${{ steps.package.outputs.name }}-v})
id: release
publish:
runs-on: ubuntu-22.04
needs: [prepare]
env:
MODULE: "${{ needs.prepare.outputs.MODULE }}"
VERSION: "${{ needs.prepare.outputs.VERSION }}"
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Retrieve license obligation resources
id: license-obligations
working-directory: "${{ env.MODULE }}"
run: |
cd 3RD-PARTY-LICENSES
FILES=$(find . -maxdepth 1 -type d -not -path .)
if [ -n "$FILES" ]
then
echo "${FILES}" | zip -r@ 3rd-party-copyrights
fi
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
ARCHIVES=$(find . -regex "^./3rd-party-.*.zip$")
OBLIGATIONS_FOUND="false"
if [ -n "$ARCHIVES" ]
then
mv $(echo "${ARCHIVES}") ../license-obligations/
OBLIGATIONS_FOUND="true"
fi
echo "OBLIGATIONS_FOUND=${OBLIGATIONS_FOUND}" >> $GITHUB_OUTPUT
- name: Update Release with license obligations resources
uses: ncipollo/release-action@v1
if: steps.license-obligations.outputs.OBLIGATIONS_FOUND == 'true'
with:
allowUpdates: true
artifacts: ${{ env.MODULE }}/license-obligations/*
artifactErrorsFailBuild: true
makeLatest: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
- name: Setup java
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: 'maven'
- name: Setting up Github Package Repository as Maven Repository
uses: s4u/[email protected]
with:
githubServer: false
servers: |
[{
"id": "github",
"username": "${{ secrets.GHPR_USERNAME }}",
"password": "${{ secrets.GHPR_TOKEN }}"
}]
- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish version to GitHub Packages and Docker Image on GHCR
run: ./mvnw -pl ${{ env.MODULE }} deploy -Ddockerfile.skip=false -Dskip.tests --batch-mode --no-transfer-progress
118 changes: 0 additions & 118 deletions .github/workflows/publish-and-release.yaml

This file was deleted.

Loading

0 comments on commit 39a21ec

Please sign in to comment.