Skip to content
/ titan Public
forked from titan-data/titan

Commit

Permalink
Windows build (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek Smart authored and mcred committed Oct 31, 2019
1 parent 5332b31 commit 9b39781
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 46 deletions.
126 changes: 82 additions & 44 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,90 @@ name: Publish
on: create

jobs:
build:
name: Build ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, macOS-10.14]
build-windows:
name: Build Windows
runs-on: windows-2019
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '8.0.212'
- name: Setup Env
run: ./scripts/setup.sh ${{ matrix.os }}
- name: Build Jar
run: ./scripts/compile-maven.sh
- name: Compile Binary
if: startsWith(github.ref, 'refs/tags/')
run: ./scripts/build.sh ${{ matrix.os }}
- name: Upload ${{ matrix.os }} Binary
if: matrix.os == 'macOS-10.14'
uses: actions/upload-artifact@master
with:
name: titan-cli-darwin_amd64.zip
path: releases
- name: Upload ${{ matrix.os }} Binary
if: matrix.os == 'ubuntu-18.04'
uses: actions/upload-artifact@master
with:
name: titan-cli-linux_amd64.tar
path: releases
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '8.0.212'
- name: Build Docker Container
working-directory: ./scripts/windows
run: docker build -t graal-build .
shell: pwsh
- name: Build Jar
run: ./mvnw compile package
shell: pwsh
- name: Compile Binary
run: docker run -v D:\a\titan\titan:c:\titan -w c:\titan graal-build
shell: pwsh
- name: Compress Binary
run: ./scripts/windows/archive-binary
shell: pwsh
- name: Upload Binary
uses: actions/upload-artifact@master
with:
name: titan-cli-windows_amd64.zip
path: releases
build-linux:
name: Build Linux
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '8.0.212'
- name: Setup Env
run: ./scripts/setup.sh ubuntu-18.04
- name: Build Jar
run: ./scripts/compile-maven.sh
- name: Compile Binary
run: ./scripts/build.sh ubuntu-18.04
- name: Upload Binary
uses: actions/upload-artifact@master
with:
name: titan-cli-linux_amd64.tar
path: releases
build-macos:
name: Build macOS
runs-on: macOS-10.14
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '8.0.212'
- name: Setup Env
run: ./scripts/setup.sh macOS-10.14
- name: Build Jar
run: ./scripts/compile-maven.sh
- name: Compile Binary
run: ./scripts/build.sh macOS-10.14
- name: Upload Binary
uses: actions/upload-artifact@master
with:
name: titan-cli-darwin_amd64.zip
path: releases
release:
name: Draft Release
runs-on: ubuntu-18.04
needs: build
needs: [build-windows, build-linux, build-macos]
steps:
- uses: actions/checkout@v1
- uses: actions/download-artifact@master
with:
name: titan-cli-darwin_amd64.zip
path: releases
- uses: actions/download-artifact@master
with:
name: titan-cli-linux_amd64.tar
path: releases
- name: Draft Release
if: startsWith(github.ref, 'refs/tags/')
run: ./scripts/draft-release.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v1
- uses: actions/download-artifact@master
with:
name: titan-cli-darwin_amd64.zip
path: releases
- uses: actions/download-artifact@master
with:
name: titan-cli-linux_amd64.tar
path: releases
- uses: actions/download-artifact@master
with:
name: titan-cli-windows_amd64.zip
path: releases
- name: Draft Release
if: startsWith(github.ref, 'refs/tags/')
run: ./scripts/draft-release.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion scripts/draft-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,8 @@ UPLOAD_URL="${RAW_URL%/*}"

echo $UPLOAD_URL
for file in ${PWD}/releases/*.zip; do
${PWD}/scripts/upload_asset.sh "$UPLOAD_URL/assets?name=$(basename $file)" $file
${PWD}/scripts/upload_asset.sh "$UPLOAD_URL/assets?name=$(basename $file)" $file "zip"
done
for file in ${PWD}/releases/*.tar; do
${PWD}/scripts/upload_asset.sh "$UPLOAD_URL/assets?name=$(basename $file)" $file "x-tar"
done
3 changes: 2 additions & 1 deletion scripts/upload_asset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ set -o pipefail

UPLOAD_URL=$1
FILE=$2
MIME=$3
SIZE=$(wc -c $FILE | awk '{print $1}')


#Upload Asset
curl \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Length: $SIZE"\
-H "Content-Type: application/zip" \
-H "Content-Type: application/$MIME" \
--data-binary @$FILE "$UPLOAD_URL"
8 changes: 8 additions & 0 deletions scripts/windows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# escape=`

FROM mcr.microsoft.com/windows/servercore@sha256:d7e7e3702cbc4d8ea29001a02c1c852d0229a0679d94e017a41c43dbaa01db20

RUN @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
RUN choco install windows-sdk-7.1 graalvm kb2519277 -y

CMD call scripts/windows/build-native.cmd
3 changes: 3 additions & 0 deletions scripts/windows/archive-binary.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$version = Get-Content .\VERSION -Raw
mkdir releases
Compress-Archive -Path titan.exe -CompressionLevel Optimal -DestinationPath releases/titan-$version-windows_amd64.zip
4 changes: 4 additions & 0 deletions scripts/windows/build-native.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo on
set /p Version=<VERSION
call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /Release
native-image -cp target\titan-%Version%-jar-with-dependencies.jar -H:Name=titan -H:Class=io.titandata.titan.Cli -H:+ReportUnsupportedElementsAtRuntime -H:ReflectionConfigurationFiles=config\reflect-config.json -H:ResourceConfigurationFiles=config\resource-config.json -H:JNIConfigurationFiles=config\jni-config.json -H:+AddAllCharsets --allow-incomplete-classpath --enable-http

0 comments on commit 9b39781

Please sign in to comment.