forked from google/zetasql
-
Notifications
You must be signed in to change notification settings - Fork 9
182 lines (151 loc) · 5.04 KB
/
main.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# This is a basic workflow to help you get started with Actions
name: Build
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master, feat/hybridse-zetasql]
tags:
- v*
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
centos-build:
runs-on: ubuntu-latest
container:
image: ghcr.io/aceforeverd/hybridsql-base:0.4.0
steps:
- uses: actions/checkout@v2
- name: Setup Bazel
run: |
curl --create-dirs -SLo /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.10.1/bazelisk-linux-amd64
chmod +x /usr/local/bin/bazel
- name: Install Java
run: |
yum install -y java-1.8.0-openjdk-devel
- name: build zetasql parser
run: |
source /opt/rh/devtoolset-8/enable
source /opt/rh/rh-python38/enable
./build_zetasql_parser.sh
- name: Determine Version
if: ${{ github.event_name == 'push' }}
run: |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
VERSION=$(echo $VERSION | sed -e 's/^v//')
echo "TAG=$VERSION" >> $GITHUB_ENV
- name: pack libzetasql
run: |
./pack_zetasql.sh -d centos
env:
TAG: ${{ env.TAG }}
- name: Upload Artifacts
if: ${{ github.event_name == 'push' }}
uses: actions/upload-artifact@v2
with:
path: libzetasql-*.tar.gz
name: release-artifacts
ubuntu-build:
runs-on: ubuntu-latest
container:
image: ubuntu:20.04
steps:
- name: setup dependencies
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y -q curl build-essential unzip python3-dev git
update-alternatives --install /usr/bin/python python /usr/bin/python3 100
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt' # See 'Supported distributions' for available options
java-version: '8'
- name: Setup Bazel
run: |
curl --create-dirs -SLo /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.10.1/bazelisk-linux-amd64
chmod +x /usr/local/bin/bazel
- name: build zetasql parser
run: |
./build_zetasql_parser.sh
- name: Determine Version
if: ${{ github.event_name == 'push' }}
run: |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
VERSION=$(echo $VERSION | sed -e 's/^v//')
echo "TAG=$VERSION" >> $GITHUB_ENV
- name: pack libzetasql
run: |
git config --global --add safe.directory "$(pwd)"
./pack_zetasql.sh -d ubuntu
env:
TAG: ${{ env.TAG }}
- name: Upload Artifacts
if: ${{ github.event_name == 'push' }}
uses: actions/upload-artifact@v2
with:
path: libzetasql-*.tar.gz
name: release-artifacts
macos-build:
runs-on: macos-latest
timeout-minutes: 120
env:
bazel_version: '3.7.2'
steps:
- uses: actions/checkout@v3
- name: update bazel version
run: echo ${{ env.bazel_version }} > .bazelversion
- name: setup python3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: install bazelisk
run: |
brew install bazelisk
- name: install utils tools
run: |
brew install coreutils
brew install binutils
- name: build
run: |
./build_zetasql_parser.sh
- name: Determine Version
if: ${{ github.event_name == 'push' }}
run: |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
VERSION=$(echo $VERSION | sed -e 's/^v//')
echo "TAG=$VERSION" >> $GITHUB_ENV
- name: pack libzetasql
run: |
./pack_zetasql.sh
env:
TAG: ${{ env.TAG }}
- name: Upload Artifacts
if: ${{ github.event_name == 'push' }}
uses: actions/upload-artifact@v2
with:
path: libzetasql-*.tar.gz
name: release-artifacts
release:
runs-on: ubuntu-latest
needs: ["centos-build", "ubuntu-build", "macos-build"]
if: startsWith(github.ref, 'refs/tags/v')
timeout-minutes: 120
steps:
- name: Download Release Artifacts
uses: actions/download-artifact@v2
with:
name: release-artifacts
- name: generate signature
run: |
sha256sum libzetasql-*.tar.gz > SHA256SUM
- name: Release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: softprops/action-gh-release@v1
with:
files: |
libzetasql-*.tar.gz
SHA256SUM
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}