Merge pull request #87 from epam/master #80
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-latest | |
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-native-linux: | |
needs: [prepare] | |
runs-on: ubuntu-20.04 | |
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: | | |
sudo apt update | |
sudo apt install -yqq g++-9-arm-linux-gnueabihf \ | |
g++-9-aarch64-linux-gnu \ | |
g++-9-i686-linux-gnu \ | |
musl-tools | |
cd .. | |
mkdir llvm | |
cd llvm | |
curl -OL https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/clang+llvm-12.0.0-armv7a-linux-gnueabihf.tar.xz | |
curl -OL https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/clang+llvm-12.0.0-aarch64-linux-gnu.tar.xz | |
curl -OL https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/clang+llvm-12.0.0-i386-unknown-freebsd12.tar.xz | |
tar -xf clang+llvm-12.0.0-armv7a-linux-gnueabihf.tar.xz | |
tar -xf clang+llvm-12.0.0-aarch64-linux-gnu.tar.xz | |
tar -xf clang+llvm-12.0.0-i386-unknown-freebsd12.tar.xz | |
ls -al | |
cd ../DFP/ | |
ls -al | |
./gradlew makeNativeLinux | |
./gradlew makeNativeWrappers | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build-native-linux | |
path: | | |
./*native/bin* | |
./*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 | |
retention-days: 7 | |
build-native-windows: | |
needs: [prepare] | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Download prepare-version artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: prepare-version | |
- name: Use MSBuild | |
uses: microsoft/setup-msbuild@v1.1 | |
- name: build | |
run: | | |
./gradlew makeNativeWindows | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build-native-windows | |
path: | | |
./*native/bin* | |
retention-days: 7 | |
build-native-macos: | |
needs: [prepare] | |
runs-on: ubuntu-20.04 | |
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: | | |
sudo apt update | |
sudo apt install clang make libssl-dev liblzma-dev libxml2-dev fuse | |
cd ./osxcross/tarballs/ | |
wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz | |
cd .. | |
UNATTENDED=yes OSX_VERSION_MIN=10.7 JOBS=4 ./build.sh | |
cd .. | |
./gradlew makeNativeDarwin | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build-native-macos | |
path: | | |
./*native/bin* | |
retention-days: 7 | |
compress-native: | |
runs-on: ubuntu-latest | |
needs: [build-native-linux, build-native-windows, build-native-macos] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download prepare-version artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: prepare-version | |
- 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 | |
zstd -19 --rm -r ./native/bin | |
zstd -19 --rm -r ./native/binmath | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: compress-native | |
path: | | |
./gradle.properties | |
./*native/bin* | |
./*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 | |
retention-days: 7 | |
build-java: | |
runs-on: ubuntu-latest | |
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-2019 | |
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: ubuntu-latest | |
needs: [build-java] | |
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: '8' | |
- name: Show environment | |
run: | | |
./gradlew :java:systemInfo:runSystemInfo | |
- name: test | |
run: | | |
./gradlew runTestJars | |
test-dotnet: | |
runs-on: windows-2019 | |
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: test | |
run: | | |
cd csharp | |
./build --target=Run-Unit-Tests | |
release: | |
if: ${{ startsWith(github.ref, 'refs/heads/release') }} | |
needs: [build-java, test-java, build-dotnet, test-dotnet] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Release | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
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-latest | |
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-2019 | |
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 }} |