This repository was archived by the owner on Feb 19, 2026. It is now read-only.
forked from datafusion-contrib/datafusion-java
-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (128 loc) · 5.14 KB
/
Copy pathbuild.yml
File metadata and controls
149 lines (128 loc) · 5.14 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
name: Build
on:
push:
branches: ["*"]
pull_request:
branches: ["*"]
jobs:
rust:
# Do not run this job for pull requests where both branches are from the same repo.
# Other jobs will be skipped too, as they depend on this one.
# This prevents duplicate CI runs for our own pull requests, whilst preserving the ability to
# run the CI for each branch push to a fork, and for each pull request originating from a fork.
if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id
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-debug-${{ 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"
# 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 cargoDevBuild
- 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/debug/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/debug/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\\debug\\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
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: Build and test
run: ./gradlew -PJNI_PATH=${{ github.workspace }}/datafusion-java/build/jni_libs/linux-x86_64 build
- name: Publish to Maven Local
run: ./gradlew publishToMavenLocal
- name: Upload built artifacts
uses: actions/upload-artifact@v3
with:
name: datafusion-java
if-no-files-found: error
path: ~/.m2/repository/uk/co/gresearch/datafusion/datafusion-java
retention-days: 3