Skip to content

Commit

Permalink
Build GraalVM Native Image for ShardingSphere Proxy Test
Browse files Browse the repository at this point in the history
  • Loading branch information
linghengqian committed Sep 22, 2022
1 parent a36962b commit 8ad4592
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: GraalVM Native Image Daily Continuous Integration

on:
# TODO
# schedule:
# - cron: '0 0 * * *'
pull_request:
branches:
- master

env:
TARGET_DIR: /home/runner/work/shardingsphere/shardingsphere/shardingsphere-distribution/shardingsphere-proxy-distribution/target

jobs:
build:
if: github.repository == 'apache/shardingsphere'
timeout-minutes: 90
permissions:
contents: read
packages: write
name: GraalVM Native Image on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: graalvm/setup-graalvm@v1
with:
version: '22.2.0'
java-version: '17'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
# Test TODO
- name: Build with Maven
run: |
./mvnw -am -pl shardingsphere-distribution/shardingsphere-proxy-distribution -B -Prelease -DskipTests -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Drat.skip=true clean install
ls -l ${{ env.TARGET_DIR }}
./mvnw -am -pl shardingsphere-distribution/shardingsphere-proxy-distribution -B -Pnative -DskipTests -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Drat.skip=true clean install
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
<freemarker.version>2.3.31</freemarker.version>
<spotless-maven-plugin.version>2.22.1</spotless-maven-plugin.version>
<caffeine.version>2.9.2</caffeine.version>
<native.maven.plugin.version>0.9.13</native.maven.plugin.version>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,49 @@
</plugins>
</build>
</profile>
<profile>
<id>native</id>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>${native.maven.plugin.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
</goals>
<phase>package</phase>
</execution>
<execution>
<id>test-native</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
<configuration>
<imageName>${project.build.finalName}-shardingsphere-proxy-bin</imageName>
<mainClass>org.apache.shardingsphere.proxy.Bootstrap</mainClass>
<fallback>false</fallback>
<verbose>true</verbose>
<classpath>
<entry>target/${project.build.finalName}-shardingsphere-proxy-bin/conf</entry>
<entry>.</entry>
<entry>target/${project.build.finalName}-shardingsphere-proxy-bin/lib/*</entry>
<entry>target/${project.build.finalName}-shardingsphere-proxy-bin/ext-lib/*</entry>
</classpath>
<metadataRepository>
<enabled>true</enabled>
</metadataRepository>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit 8ad4592

Please sign in to comment.