Skip to content

Added healthcheck command for test containers. Add uploading of test … #54

Added healthcheck command for test containers. Add uploading of test …

Added healthcheck command for test containers. Add uploading of test … #54

name: Build jars
on:
workflow_dispatch:
push:
tags:
- "extender-v[0-9]+.[0-9]+.[0-9]+"
- "client-v[0-9]+.[0-9]+.[0-9]+"
- "manifestmergetool-v[0-9]+.[0-9]+.[0-9]+"
env:
GOOGLE_ARTIFACT_REGISTRY: europe-west1-docker.pkg.dev
MAVEN_SERVICE_ACCOUNT: [email protected]
jobs:
client:
if: ${{ startsWith(github.ref_name, 'client-') }}
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Generate version
id: version
run: |
SHORT_SHA="$(echo ${GITHUB_SHA} | cut -c1-8)"
TAG_NAME=${{ github.ref_name }}
TAG_VERSION="${TAG_NAME#*-v}"
echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT
- name: Login to Google Artifact registry (Maven)
uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f
with:
service_account: ${{ env.MAVEN_SERVICE_ACCOUNT }}
credentials_json: ${{ secrets.MAVEN_REGISTRY_JSON_KEY }}
export_environment_variables: true
create_credentials_file: true
- name: Install Java
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808
- name: Build the extender-client.jar
run: ./gradlew -PclientVersion=${{ steps.version.outputs.tag_version }} client:jar
- name: Test the extender-client.jar
run: ./gradlew -PclientVersion=${{ steps.version.outputs.tag_version }} client:test
- name: Publish to Google artifact registry
run: ./gradlew -PclientVersion=${{ steps.version.outputs.tag_version }} publishExtenderClientPublicationToExtenderRepoRepository
- name: Prepare jar for GH release
run: |
mkdir -p ${{ github.workspace }}/gh_release
cp ${{ github.workspace }}/client/build/libs/extender-client-${{ steps.version.outputs.tag_version }}.jar \
${{ github.workspace }}/gh_release/extender-client-${{ steps.version.outputs.tag_version }}.jar
- name: Publish to Github release
run: |
chmod 0444 ${{ github.workspace }}/gh_release/*.jar
echo ${{ github.token }} | gh auth login --with-token
gh release create "${GITHUB_REF_NAME}" \
--draft \
--generate-notes \
--target ${{ github.sha }} \
${{ github.workspace }}/gh_release/*.jar
- name: Notify if tests failed
uses: homoluctus/slatify@cd4b4a1158cfb3e26fe1ee35c1cd4f0247dfbf96
if: failure()
with:
type: ${{ job.status }}
job_name: 'Extender cleint release'
channel: '#defold-alarms-build'
url: ${{ secrets.SLACK_WEBHOOK }}
manifestmerger:
if: ${{ startsWith(github.ref_name, 'manifestmergetool-') }}
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Generate version
id: version
run: |
SHORT_SHA="$(echo ${GITHUB_SHA} | cut -c1-8)"
TAG_NAME=${{ github.ref_name }}
TAG_VERSION="${TAG_NAME#*-v}"
echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT
- name: Login to Google Artifact registry (Maven)
uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f
with:
service_account: ${{ env.MAVEN_SERVICE_ACCOUNT }}
credentials_json: ${{ secrets.MAVEN_REGISTRY_JSON_KEY }}
export_environment_variables: true
create_credentials_file: true
- name: Install Java
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808
- name: Build manifestmerger
run: ./gradlew -PmanifestMergetoolVersion=${{ steps.version.outputs.tag_version }} :manifestmergetool:mainJar
- name: Test manifestmerger
run: ./gradlew -PmanifestMergetoolVersion=${{ steps.version.outputs.tag_version }} :manifestmergetool:test
- name: Publish to Google artifact registry
run: ./gradlew -PmanifestMergetoolVersion=${{ steps.version.outputs.tag_version }} publishManifestMergeToolPublicationToExtenderRepoRepository
- name: Prepare jar for GH release
run: |
mkdir -p ${{ github.workspace }}/gh_release
cp ${{ github.workspace }}/server/manifestmergetool/build/libs/manifestmergetool-${{ steps.version.outputs.tag_version }}.jar \
${{ github.workspace }}/gh_release/manifestmergetool-${{ steps.version.outputs.tag_version }}.jar
- name: Publish to Github release
run: |
chmod 0444 ${{ github.workspace }}/gh_release/*.jar
echo ${{ github.token }} | gh auth login --with-token
gh release create "${GITHUB_REF_NAME}" \
--draft \
--generate-notes \
--target ${{ github.sha }} \
${{ github.workspace }}/gh_release/*.jar
- name: Notify if tests failed
uses: homoluctus/slatify@cd4b4a1158cfb3e26fe1ee35c1cd4f0247dfbf96
if: failure()
with:
type: ${{ job.status }}
job_name: 'Manifest merge tool release'
channel: '#defold-alarms-build'
url: ${{ secrets.SLACK_WEBHOOK }}
extender:
if: ${{ startsWith(github.ref_name, 'extender-') }}
runs-on: ubuntu-22.04
steps:
# cleanup disk space because we use lots of disk space for Docker image during extender tests
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Generate version
id: version
run: |
SHORT_SHA="$(echo ${GITHUB_SHA} | cut -c1-8)"
TAG_NAME=${{ github.ref_name }}
TAG_VERSION="${TAG_NAME#*-v}"
echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT
- name: Install Java
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808
- name: Build extender
run: ./gradlew -PextenderVersion=${{ steps.version.outputs.tag_version }} server:bootJar
- name: Login to Google Artifact registry (Docker)
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ${{ env.GOOGLE_ARTIFACT_REGISTRY }}
username: _json_key
password: ${{ secrets.DOCKER_REGISTRY_JSON_KEY }}
- name: Pull necessary docker images
run: |
# pull all containers under profile 'test'. Part of them is used in 'auth-test'
# if you need some new container under other profiles - need to add new statement with different profile
docker compose --file ./server/docker/docker-compose.yml --profile test pull
- name: Run extender tests
run: ./gradlew -PextenderVersion=${{ steps.version.outputs.tag_version }} server:test -i
- name: Login to Google Artifact registry (Maven)
uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f
with:
service_account: ${{ env.MAVEN_SERVICE_ACCOUNT }}
credentials_json: ${{ secrets.MAVEN_REGISTRY_JSON_KEY }}
export_environment_variables: true
create_credentials_file: true
- name: Publish to Google artifact registry
run: ./gradlew -PextenderVersion=${{ steps.version.outputs.tag_version }} publishExtenderPublicationToExtenderRepoRepository
- name: Prepare jar for GH release
run: |
mkdir -p ${{ github.workspace }}/gh_release
cp ${{ github.workspace }}/server/build/libs/extender-${{ steps.version.outputs.tag_version }}.jar \
${{ github.workspace }}/gh_release/extender-${{ steps.version.outputs.tag_version }}.jar
- name: Publish to Github release
run: |
chmod 0444 ${{ github.workspace }}/gh_release/*.jar
echo ${{ github.token }} | gh auth login --with-token
gh release create "${GITHUB_REF_NAME}" \
--draft \
--generate-notes \
--target ${{ github.sha }} \
${{ github.workspace }}/gh_release/*.jar
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-result
path: ${{ github.workspace }}/server/build/reports/tests/
retention-days: 10
- name: Notify if tests failed
uses: homoluctus/slatify@cd4b4a1158cfb3e26fe1ee35c1cd4f0247dfbf96
if: failure()
with:
type: ${{ job.status }}
job_name: 'Extender release'
channel: '#defold-alarms-build'
url: ${{ secrets.SLACK_WEBHOOK }}