-
Notifications
You must be signed in to change notification settings - Fork 4
157 lines (154 loc) · 5.96 KB
/
release.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
name: release
on:
release:
types: [ published ]
env:
GITHUB_TOKEN: ${{ github.token }}
cache-version: v1.0.0
jobs:
osx:
name: Create artifacts on macOS-latest
runs-on: macos-10.15
steps:
- name: Checkout the repository
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Cache
uses: pat-s/always-upload-cache@v2.1.5
with:
path: ~/.cache/bazel
key: ${{ env.cache-version }}-${{ runner.os }}-bazelisk-build-${{ hashFiles('./**') }}
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-bazelisk-build-
- name: Build
shell: bash
run: |
export TEST_TMPDIR=~/.cache/bazel
brew install graphviz
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
bazel shutdown
export CC=g++
make
mkdir alphasql_darwin_x86_64
mv ./bazel-bin/alphasql/alphadag /usr/local/bin/
mv ./bazel-bin/alphasql/alphacheck /usr/local/bin/
cd /usr/local/bin/
# ensure without path to prevent `cannot execute binary file` error.
sudo tar -zcvf alphasql_darwin_x86_64.tar.gz alphadag alphacheck
cd -
mv /usr/local/bin/alphasql_darwin_x86_64.tar.gz ./
- name: Get Release
id: get
uses: bruceadams/get-release@v1.2.0
- name: Upload OSX Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: alphasql_darwin_x86_64.tar.gz
asset_name: alphasql_darwin_x86_64.tar.gz
asset_content_type: application/tar+gzip
- name: Test installation
shell: bash
env:
TAG: ${{ github.event.release.tag_name }}
run: |
temp=$(mktemp -d)
wget -P $temp "https://github.com/Matts966/alphasql/releases/download/${TAG}/alphasql_darwin_x86_64.tar.gz"
sudo tar -zxvf $temp/alphasql_darwin_x86_64.tar.gz -C /usr/local/bin
alphadag ./samples/sample
linux:
name: Create artifacts on Linux
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Cache
uses: pat-s/always-upload-cache@v2.1.5
with:
path: ~/.cache/bazel
key: ${{ env.cache-version }}-${{ runner.os }}-bazelisk-build-${{ hashFiles('./**') }}
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-bazelisk-build-
- name: Build
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 build //...
mkdir alphasql_linux_x86_64
mv ./bazel-bin/alphasql/alphadag ./alphasql_linux_x86_64/alphadag
mv ./bazel-bin/alphasql/alphacheck ./alphasql_linux_x86_64/alphacheck
sudo tar -zcvf alphasql_linux_x86_64.tar.gz alphasql_linux_x86_64
- name: Get Release
id: get
uses: bruceadams/get-release@v1.2.0
- name: Upload Linux Asset
id: upload-linux-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: alphasql_linux_x86_64.tar.gz
asset_name: alphasql_linux_x86_64.tar.gz
asset_content_type: application/tar+gzip
- name: Test installation
shell: bash
env:
TAG: ${{ github.event.release.tag_name }}
run: |
temp=$(mktemp -d)
wget -P $temp "https://github.com/Matts966/alphasql/releases/download/${TAG}/alphasql_linux_x86_64.tar.gz"
sudo tar -zxvf $temp/alphasql_linux_x86_64.tar.gz -C /usr/local/bin --strip=1
alphadag ./samples/sample
docker-hub:
name: Push image to docker hub
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Docker Build and Push
uses: docker/build-push-action@v1
env:
DOCKER_BUILDKIT: 1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: matts966/alphasql
tag_with_ref: true
dockerfile: docker/Dockerfile
cache_froms: matts966/alphasql:latest
tags: latest
- name: Test installation
shell: bash
env:
TAG: ${{ github.event.release.tag_name }}
run: |
docker run "matts966/alphasql:${TAG}" alphadag .
docker-github:
name: Push image to GitHub Packages
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Push to GitHub Packages
uses: docker/build-push-action@v1
env:
DOCKER_BUILDKIT: 1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: matts966/alphasql/alphasql
tag_with_ref: true
dockerfile: docker/Dockerfile
cache_froms: matts966/alphasql:latest
tags: latest