Skip to content

Nightly - Build

Nightly - Build #31

#
# 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: Nightly - Build
on:
schedule:
- cron: '0 16 */1 * *' # once a day. UTC time
workflow_dispatch:
inputs:
commit-id:
required: false
type: string
env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dcheckstyle.skip=true -Dmaven.javadoc.skip=true -Djacoco.skip=true -DskipITs -DskipTests -Dspotless.apply.skip=true
REPOSITORY: apache/shardingsphere
REPOSITORY_NAME: shardingsphere
HUB: ghcr.io/apache/shardingsphere
PROXY: ghcr.io/apache/shardingsphere-proxy
PROXY_NATIVE: ghcr.io/apache/shardingsphere-proxy-native
jobs:
upload-to-nightlies:
if: (github.event_name == 'schedule' && github.repository == 'apache/shardingsphere')
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ env.REPOSITORY_NAME }}-maven-third-party-cache-${{ github.sha }}
restore-keys: |
${{ env.REPOSITORY_NAME }}-maven-third-party-cache-
${{ env.REPOSITORY_NAME }}-maven-third-party-
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
- name: Build project
run: |
./mvnw -B clean install -Prelease
- uses: burnett01/[email protected]
with:
switches: -avzr
path: distribution/proxy/target/apache-shardingsphere-*.tar.gz
remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/shardingsphere
remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }}
remote_port: ${{ secrets.NIGHTLIES_RSYNC_PORT }}
remote_user: ${{ secrets.NIGHTLIES_RSYNC_USER }}
remote_key: ${{ secrets.NIGHTLIES_RSYNC_KEY }}
build-proxy-image:
if: github.repository == 'apache/shardingsphere'
name: Build Proxy Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.commit-id }}
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
- name: Cache Maven Repos
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ env.REPOSITORY_NAME }}-maven-third-party-cache-${{ github.sha }}
restore-keys: |
${{ env.REPOSITORY_NAME }}-maven-third-party-cache-
${{ env.REPOSITORY_NAME }}-maven-third-party-
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.HUB }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- name: Push docker image
run: ./mvnw -am -pl distribution/proxy -B -Prelease,docker.buildx.push -DskipTests -Dproxy.image.repository=${{ env.PROXY }} -Dproxy.image.tag=${{ github.sha }} clean install
build-proxy-native-image:
if: github.repository == 'apache/shardingsphere'
timeout-minutes: 90
permissions:
contents: read
packages: write
name: Build GraalVM Native Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.commit-id }}
- uses: graalvm/setup-graalvm@v1
with:
version: '22.3.1'
java-version: '17'
components: 'espresso,native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
- uses: docker/login-action@v2
with:
registry: ${{ env.HUB }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push docker image
run: |
./mvnw -PgenerateStandardMetadata -DskipNativeTests -B -T1C clean test
./mvnw -am -pl distribution/proxy-native -Prelease.native,docker.buildx.push.native -B -T1C -DskipTests -Dproxy.image.repository=${{ env.PROXY_NATIVE }} -Dproxy.image.tag=${{ github.sha }} clean package