Merge pull request #93 from epam/master #81
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release CI | |
on: | |
push: | |
branches: | |
- release | |
env: | |
GRADLE_OPTS: "-Dorg.gradle.daemon=false" | |
jobs: | |
prepare: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Prepare | |
if: ${{ startsWith(github.ref, 'refs/heads/release') }} | |
run: | | |
versionSnapshot=`grep 'version=' gradle.properties | sed 's/version=\([^-]*\)/\1/'` | |
versionRelease=`echo $versionSnapshot | sed 's/\([^-]*\)-SNAPSHOT/\1/'` | |
echo "$versionSnapshot -> $versionRelease" | |
sed -i "s/version=$versionSnapshot/version=$versionRelease/" gradle.properties | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: prepare-version | |
path: | | |
./gradle.properties | |
retention-days: 7 | |
build-wrappers: | |
runs-on: ubuntu-22.04 | |
needs: [prepare] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Download prepare-version artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: prepare-version | |
- name: build | |
run: | | |
./gradlew makeNativeWrappers | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build-wrappers | |
path: | | |
./gradle.properties | |
./*java/dfp/build/generated/sources/nativeWrappers/com/epam/deltix/dfp* | |
./*java/dfp-math/build/generated/sources/nativeWrappers/com/epam/deltix/dfpmath* | |
./csharp/EPAM.Deltix.DFP/NativeImpl.cs | |
./csharp/EPAM.Deltix.DFP/Version.targets | |
./csharp/EPAM.Deltix.DFPMath/NativeMathImpl.cs | |
./csharp/EPAM.Deltix.DFPMath/Version.targets | |
./native/include* | |
retention-days: 7 | |
build-native-linux: | |
runs-on: ubuntu-22.04 | |
needs: [build-wrappers] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Download build-wrappers artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-wrappers | |
- name: build | |
run: | | |
sudo apt update | |
sudo apt install -yqq g++-arm-linux-gnueabihf \ | |
g++-aarch64-linux-gnu \ | |
g++-i686-linux-gnu \ | |
musl-tools | |
./gradlew makeNativeLinux | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build-native-linux | |
path: | | |
./*native/install* | |
retention-days: 7 | |
build-native-windows: | |
runs-on: windows-2022 | |
needs: [build-wrappers] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Download build-wrappers artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-wrappers | |
- name: Use MSBuild | |
uses: microsoft/[email protected] | |
- name: build | |
run: | | |
./gradlew makeNativeWindows | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build-native-windows | |
path: | | |
./*native/install* | |
retention-days: 7 | |
build-native-macos: | |
runs-on: macos-12 | |
needs: [build-wrappers] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Download build-wrappers artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-wrappers | |
- name: build | |
run: | | |
./gradlew makeNativeDarwin | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build-native-macos | |
path: | | |
./*native/install* | |
retention-days: 7 | |
compress-native: | |
runs-on: ubuntu-22.04 | |
needs: [build-wrappers, build-native-linux, build-native-windows, build-native-macos] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download build-wrappers artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-wrappers | |
- name: Download native-linux artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-native-linux | |
- name: Download native-windows artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-native-windows | |
- name: Download native-macos artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-native-macos | |
- name: compress | |
run: | | |
zstd --version | |
./gradlew nativeInstallToBin | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: compress-native | |
path: | | |
./gradle.properties | |
./*native/bin* | |
./*native/binmath* | |
./*java/dfp/build/generated/sources/nativeWrappers/com/epam/deltix/dfp* | |
./*java/dfp-math/build/generated/sources/nativeWrappers/com/epam/deltix/dfpmath* | |
./csharp/EPAM.Deltix.DFP/NativeImpl.cs | |
./csharp/EPAM.Deltix.DFP/Version.targets | |
./csharp/EPAM.Deltix.DFPMath/NativeMathImpl.cs | |
./csharp/EPAM.Deltix.DFPMath/Version.targets | |
./native/include* | |
retention-days: 7 | |
build-java: | |
runs-on: ubuntu-22.04 | |
needs: [compress-native] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Download compress-native artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: compress-native | |
- name: Setup java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'adopt' | |
java-version: '19' | |
- name: build | |
run: | | |
./gradlew jar | |
./gradlew javadocJar | |
./gradlew copyTestJars | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: java-jars | |
path: | | |
./*java/dfp/build/libs/* | |
./*java/dfp-math/build/libs/* | |
./*java/dfp/testLibs/* | |
./*java/dfp-math/testLibs/* | |
./*java/dfpNativeTests/testLibs/* | |
./*java/vtaTest/testLibs/* | |
retention-days: 7 | |
build-dotnet: | |
runs-on: windows-2022 | |
needs: [compress-native] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Download compress-native artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: compress-native | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '3.1.x' | |
- name: build | |
run: | | |
cd csharp | |
./build -Target Build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dotnet-build | |
path: | | |
./*csharp/EPAM.Deltix.DFP/bin/Release/* | |
./*csharp/EPAM.Deltix.DFPMath/bin/Release/* | |
./*csharp/EPAM.Deltix.DFP.Demo/bin/Release/* | |
retention-days: 7 | |
test-java: | |
runs-on: ${{ matrix.os }} | |
needs: [build-java] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ 'ubuntu-22.04', 'windows-2022', 'macos-12'] | |
java: [ '8', '11', '19'] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Download java-jars artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: java-jars | |
- name: Setup java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'adopt' | |
java-version: ${{ matrix.java }} | |
- name: Show environment | |
run: | | |
./gradlew :java:systemInfo:runSystemInfo | |
- name: test | |
run: | | |
./gradlew runTestJars | |
test-dotnet: | |
runs-on: ${{ matrix.os }} | |
needs: [compress-native] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ 'ubuntu-22.04', 'windows-2022', 'macos-12'] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Download compress-native artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: compress-native | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '3.1.x' | |
- name: test windows | |
if: ${{ matrix.os == 'windows-2022' }} | |
run: | | |
cd csharp | |
./build --target=Run-Unit-Tests | |
- name: test nix | |
if: ${{ matrix.os == 'ubuntu-22.04' || matrix.os == 'macos-12' }} | |
run: | | |
cd csharp | |
./build.sh --target=Run-Unit-Tests | |
- name: Upload test results on failure | |
uses: actions/upload-artifact@v3 | |
if: ${{ failure() }} | |
with: | |
path: | | |
csharp/EPAM.Deltix.DFP/bin/* | |
csharp/EPAM.Deltix.DFPMath/bin/* | |
csharp/*.txt | |
csharp/*.xml | |
name: Dotnet-3.1-${{ matrix.os }}-TestReports | |
release: | |
if: ${{ startsWith(github.ref, 'refs/heads/release') }} | |
needs: [build-java, test-java, build-dotnet, test-dotnet] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Release | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
versionSnapshot=`grep 'version=' gradle.properties | sed 's/version=\([^-]*\)/\1/'` | |
versionRelease=`echo $versionSnapshot | sed 's/\([^-]*\)-SNAPSHOT/\1/'` | |
versionSnapshotNext=`echo $versionSnapshot | perl -pe 's/^((\d+\.)*)(\d+)(.*)$/$1.($3+1).$4/e'` | |
echo "$versionSnapshot -> $versionRelease -> $versionSnapshotNext" | |
sed -i "s/version=$versionSnapshot/version=$versionRelease/" gradle.properties | |
sed -i "s/\(implementation[[:blank:]]\{1,\}'com\.epam\.deltix:dfp:\)[0-9.]\{5,\}'/\1$versionRelease'/" README.md | |
git commit -am "[skip-ci] Generate release version" | |
git push origin HEAD | |
git tag $versionRelease | |
git push origin $versionRelease | |
sed -i "s/version=$versionRelease/version=$versionSnapshotNext/" gradle.properties | |
git commit -am "[skip-ci] Generate next snapshot version" | |
git push origin HEAD | |
publish-java: | |
if: ${{ startsWith(github.ref, 'refs/heads/release') }} | |
needs: [release] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Download compress-native artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: compress-native | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'adopt' | |
java-version: '19' | |
- run: ./gradlew publish | |
env: | |
SONATYPE_REPOSITORY: ${{ secrets.SONATYPE_REPOSITORY }} | |
SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
SIGNING_PRIVATE_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }} | |
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | |
publish-dotnet: | |
if: ${{ startsWith(github.ref, 'refs/heads/release') }} | |
needs: [release] | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Download compress-native artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: compress-native | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '3.1.x' | |
- name: build | |
run: | | |
cd csharp | |
./build -Target Pack | |
dotnet nuget push artifacts\*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s ${{ secrets.NUGET_URL }} |