forked from google/zetasql
-
Notifications
You must be signed in to change notification settings - Fork 8
76 lines (76 loc) · 2.98 KB
/
build.yaml
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
name: Build
on: push
env:
cache-version: v1.0.2
jobs:
linux:
name: Test the repository on Linux
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Cache
uses: pat-s/[email protected]
with:
path: ~/.cache/bazel
key: ${{ env.cache-version }}-${{ runner.os }}-bazelisk-build-${{ hashFiles('./**') }}
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-bazelisk-build-
- name: Setup
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 900 \
--slave /usr/bin/g++ g++ /usr/bin/g++-9
bazelisk test --test_output=errors //zetasql/public:sql_formatter_test
bazelisk build //zetasql/tools/zetasql-formatter:format
sudo cp bazel-bin/zetasql/tools/zetasql-formatter/format zetasql-formatter
zip zetasql-formatter_linux_x86_64.zip zetasql-formatter
- name: Test
run: |
cd zetasql/tools/zetasql-formatter
ls example_tests | xargs -n1 -I {} sh -c 'cat example_tests/{} | ../../../zetasql-formatter > example_tests_formatted/{}'
git diff --exit-code -- '*.sql'
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: zetasql-formatter_linux_x86_64.zip
prerelease: true
generate_release_notes: true
macos:
name: Test the repository
runs-on: macos-10.15
steps:
- name: Checkout the repository
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Cache
uses: pat-s/[email protected]
with:
path: ~/.cache/bazel
key: ${{ env.cache-version }}-${{ runner.os }}-bazelisk-build-${{ hashFiles('./**') }}
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-bazelisk-build-
- name: Setup
run: |
export TEST_TMPDIR=~/.cache/bazel
CC=g++ bazelisk test --test_output=errors //zetasql/public:sql_formatter_test
CC=g++ bazelisk build //zetasql/tools/zetasql-formatter:format
sudo cp bazel-bin/zetasql/tools/zetasql-formatter/format zetasql-formatter
zip zetasql-formatter_darwin_amd64.zip zetasql-formatter
- name: Test
run: |
cd zetasql/tools/zetasql-formatter
ls example_tests | xargs -n1 -I {} sh -c 'cat example_tests/{} | ../../../zetasql-formatter > example_tests_formatted/{}'
git diff --exit-code -- '*.sql'
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: zetasql-formatter_darwin_amd64.zip
prerelease: true
generate_release_notes: true