forked from datafusion-contrib/datafusion-java
-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (118 loc) · 4.55 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Release
on:
push:
branches: [main]
jobs:
rust:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Rust cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
datafusion-jni/target/
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.*') }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
# Setup a CentOS 7 container to build on Linux x64 for backwards compatibility.
- name: Start CentOS container and install Rust toolchain
if: runner.os == 'Linux'
run: |
docker run -d --name centos --entrypoint tail -v $PWD:$PWD -v $HOME/.cargo:/root/.cargo centos:7 -f /dev/null
docker exec centos sh -c "yum install -y centos-release-scl && \
yum install -y devtoolset-7 && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
source /root/.cargo/env && \
rustup toolchain install stable --profile minimal --no-self-update --component rustfmt clippy"
- name: Install Rust toolchain
if: runner.os != 'Linux'
run: rustup toolchain install stable --profile minimal --no-self-update --component rustfmt clippy
- name: Cargo build Linux
if: runner.os == 'Linux'
run: |
docker exec -w $PWD/datafusion-jni centos sh -c "source /root/.cargo/env && cargo build --release"
# Change file ownership so outputs can be cached
sudo chown -R $(whoami) datafusion-jni/target
sudo chown -R $(whoami) $HOME/.cargo
- name: Cargo build
if: runner.os != 'Linux'
run: ./gradlew cargoReleaseBuild
- name: Upload built artifacts
uses: actions/upload-artifact@v3
if: matrix.os == 'macos-latest'
with:
name: datafusion-jni-${{ matrix.os }}
if-no-files-found: error
path: "datafusion-jni/target/release/libdatafusion_jni.dylib"
retention-days: 3
- name: Upload built artifacts
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: datafusion-jni-${{ matrix.os }}
if-no-files-found: error
path: "datafusion-jni/target/release/libdatafusion_jni.so"
retention-days: 3
- name: Upload built artifacts
uses: actions/upload-artifact@v3
if: matrix.os == 'windows-latest'
with:
name: datafusion-jni-${{ matrix.os }}
if-no-files-found: error
# note no "lib"
path: "datafusion-jni\\target\\release\\datafusion_jni.dll"
retention-days: 3
- name: Stop CentOS container
if: runner.os == 'Linux'
run: docker rm -f centos
java:
needs:
- rust
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: "temurin"
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Download ubuntu artifacts
uses: actions/download-artifact@v3
with:
name: datafusion-jni-ubuntu-latest
path: datafusion-java/build/jni_libs/linux-x86_64
- name: Download windows artifacts
uses: actions/download-artifact@v3
with:
name: datafusion-jni-windows-latest
path: datafusion-java/build/jni_libs/windows-x86_64
- name: Download macos artifacts
uses: actions/download-artifact@v3
with:
name: datafusion-jni-macos-latest
path: datafusion-java/build/jni_libs/osx-x86_64
- name: List downloaded artifacts
run: tree datafusion-java/build/jni_libs
- name: Publish to Sonatype
run: ./gradlew publish
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}