mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-17 11:19:15 +00:00
158 lines
7.4 KiB
YAML
158 lines
7.4 KiB
YAML
name: release
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- 'wiki/**'
|
|
- '.github/workflows/*'
|
|
- '**/*.md'
|
|
workflow_dispatch:
|
|
inputs:
|
|
skip_tests:
|
|
description: Skip tests (set to "true" to skip all tests)
|
|
default: 'false'
|
|
local_target_platform:
|
|
description: Build with a local target platform (set to "true" to use local target platform)
|
|
default: 'false'
|
|
runner_cpus:
|
|
description: Default is 16, but can be 4, 8, and 64 as well
|
|
default: '16'
|
|
|
|
jobs:
|
|
build:
|
|
permissions:
|
|
contents: write
|
|
checks: write
|
|
runs-on: ubuntu-latest-${{ github.event.inputs.runner_cpus == '' && '16' || github.event.inputs.runner_cpus }}cpu
|
|
steps:
|
|
- name: Allocate swap space
|
|
shell: bash
|
|
run: |
|
|
sudo dd if=/dev/zero of=/mnt/large-swapfile bs=1G count=10
|
|
sudo chmod 600 /mnt/large-swapfile
|
|
sudo mkswap /mnt/large-swapfile
|
|
sudo chown root:root /mnt/large-swapfile
|
|
sudo swapon /mnt/large-swapfile
|
|
- name: Collect Workflow Telemetry
|
|
uses: catchpoint/workflow-telemetry-action@94c3c3d9567a0205de6da68a76c428ce4e769af1 # v2.0.0
|
|
with:
|
|
comment_on_pr: false
|
|
- name: Check out the repository to the runner
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: '500'
|
|
- name: Install JDK 8
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin' # See 'Supported distributions' for available options
|
|
java-version: '8'
|
|
mvn-toolchain-id: 'JavaSE-1.8'
|
|
- name: Setup Android SDK
|
|
uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407 # v3.2.2
|
|
with:
|
|
log-accepted-android-sdk-licenses: 'false'
|
|
cmdline-tools-version: 9123335 # This corresponds to human-friendly version number 8.0
|
|
- name: Start MongoDB
|
|
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d #v1.12.0
|
|
with:
|
|
mongodb-version: 7.0
|
|
- name: Start RabbitMQ
|
|
uses: namoshek/rabbitmq-github-action@58b841360ede0e19fc5e4929fc2477ecc09193d8 # v1.1.0
|
|
with:
|
|
version: '3.8.9'
|
|
ports: '5672:5672'
|
|
- shell: bash
|
|
env: # Or as an environment variable
|
|
APP_PARAMETERS: "-Daws.region=eu-west-1 -Dgoogle.maps.authenticationparams=${{ secrets.GOOGLE_MAPS_AUTHENTICATIONPARAMS }} -Daws.s3.test.s3AccessId=${{ secrets.AWS_S3_TEST_S3ACCESSID }} -Daws.s3.test.s3AccessKey=${{ secrets.AWS_S3_TEST_S3ACCESSKEY }} -Dgeonames.org.usernames=${{ secrets.GEONAMES_ORG_USERNAMES }}"
|
|
JAVA8_HOME: ${{env.JAVA_HOME_8_X64}}
|
|
run: |
|
|
./configuration/buildAndUpdateProduct.sh -x ${{ github.event.inputs.runner_cpus == '' && '16' || github.event.inputs.runner_cpus }} ${{ github.event.inputs.skip_tests == 'true' && '-t' || '' }} ${{ github.event.inputs.local_target_platform == 'true' && '-v' || '' }} build 2>&1
|
|
- name: Upload build log
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: build.log
|
|
path: build.log
|
|
retention-days: 90
|
|
- name: Collect Test Reports
|
|
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 # v1.9.1
|
|
if: always()
|
|
with:
|
|
name: Maven Tests
|
|
path: '**/TEST-*.xml'
|
|
max-annotations: '1'
|
|
list-suites: failed
|
|
list-tests: failed
|
|
reporter: java-junit
|
|
fail-on-error: true
|
|
- name: Build Release
|
|
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/docker-17' || startsWith(github.ref, 'refs/heads/releases/') }}
|
|
shell: bash
|
|
run: |
|
|
./configuration/buildAndUpdateProduct.sh -u -L ${{ github.event.inputs.skip_tests == 'true' && '-n untested' || '' }} release
|
|
- name: Determine release name
|
|
run: |
|
|
echo "SIMPLE_VERSION_INFO=$( basename dist/* )" >>${GITHUB_ENV}
|
|
- name: Upload test results
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: test-results
|
|
path: |
|
|
**/surefire-reports/**
|
|
retention-days: 90
|
|
- name: Upload distribution artifact
|
|
uses: actions/upload-artifact@v4
|
|
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/docker-17' || startsWith(github.ref, 'refs/heads/releases/') }}
|
|
with:
|
|
name: ${{ env.SIMPLE_VERSION_INFO }}
|
|
path: dist/**/*
|
|
retention-days: 90
|
|
- name: Create Release
|
|
id: create_release
|
|
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/docker-17' || startsWith(github.ref, 'refs/heads/releases/') }}
|
|
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
|
|
with:
|
|
tag_name: ${{ env.SIMPLE_VERSION_INFO }}
|
|
name: ${{ env.SIMPLE_VERSION_INFO }}
|
|
draft: false
|
|
prerelease: false
|
|
- name: Upload Release Asset tar.gz
|
|
id: upload-release-asset-tar-gz
|
|
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/docker-17' || startsWith(github.ref, 'refs/heads/releases/') }}
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
|
asset_path: ./dist/${{ env.SIMPLE_VERSION_INFO }}/${{ env.SIMPLE_VERSION_INFO }}.tar.gz
|
|
asset_name: ${{ env.SIMPLE_VERSION_INFO }}.tar.gz
|
|
asset_content_type: application/x-tar
|
|
- name: Upload Release Asset release_notes.txt
|
|
id: upload-release-asset-release-notes-txt
|
|
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/docker-17' || startsWith(github.ref, 'refs/heads/releases/') }}
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
|
asset_path: ./dist/${{ env.SIMPLE_VERSION_INFO }}/release-notes.txt
|
|
asset_name: release-notes.txt
|
|
asset_content_type: text/plain
|
|
- name: Trigger Hudson job
|
|
if: always()
|
|
shell: bash
|
|
run: |
|
|
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
|
|
if [ "${{ github.event.inputs.skip_tests }}" = "true" ]; then
|
|
JOB=SAPSailingAnalytics-master-fasttrack-no-tests
|
|
else
|
|
JOB=SAPSailingAnalytics-master
|
|
fi
|
|
elif [[ "${{ github.ref }}" =~ refs/heads/releases/.* ]]; then
|
|
JOB=$( echo "${{ github.ref }}" | sed -e 's/^refs\/heads\/releases\///' )
|
|
else
|
|
JOB=$( echo "${{ github.ref }}" | sed -e 's/^refs\/heads\///' )
|
|
fi
|
|
echo "Identified Hudson job: ${JOB}"
|
|
curl https://${{ secrets.HUDSON_JOB_USERNAME }}:${{ secrets.HUDSON_JOB_PASSWORD}}@hudson.sapsailing.com/job/${JOB}/build?token=${{ secrets.HUDSON_JOB_TOKEN }}
|