-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (124 loc) · 4.9 KB
/
nightly-build-artifact.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
#
# 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/rsync-deployments@5.2
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