-
Notifications
You must be signed in to change notification settings - Fork 1.8k
155 lines (150 loc) Β· 5.11 KB
/
master.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
name: Master
on:
push:
paths:
- '.github/workflows/push.yml'
- '.github/workflows/master.yml'
- 'packages/**'
- '.eslintrc.js'
- '.prettierrc'
- 'lerna.json'
- 'package.json'
- 'rollup.config.js'
- 'yarn.lock'
- 'rust/cubesqlplanner/**'
- 'rust/cubenativeutils/**'
- 'rust/cubesql/**'
branches:
- master
jobs:
latest-tag-sha:
runs-on: ubuntu-20.04
outputs:
sha: ${{ steps.get-tag.outputs.sha }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: git-log
run: git log HEAD~30..HEAD
- id: get-tag-test
run: echo "$SHA $(git rev-list -n 1 "$(git tag --contains "$SHA")")"
env:
SHA: ${{ github.sha }}
- id: get-tag
run: echo "sha=$(git rev-list -n 1 "$(git tag --contains "$SHA")")" >> "$GITHUB_OUTPUT"
env:
SHA: ${{ github.sha }}
- id: get-tag-out
run: echo "$OUT"
env:
OUT: ${{ steps.get-tag.outputs.sha }}
build_native_linux:
runs-on: ubuntu-20.04
timeout-minutes: 60
name: Build Linux Native backend for Dev image
container:
image: cubejs/rust-cross:x86_64-unknown-linux-gnu-15082024-python-3.9
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2024-07-15
# override: true # this is by default on
rustflags: ""
components: rustfmt
target: x86_64-unknown-linux-gnu
cache: false
- uses: Swatinem/rust-cache@v2
with:
workspaces: ./rust/cubesql -> target
key: cubesql-x86_64-unknown-linux-gnu
shared-key: cubesql-x86_64-unknown-linux-gnu
- name: Install Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Yarn
run: npm install -g yarn
- name: Set Yarn version
run: yarn policies set-version v1.22.22
# We don't need to install all yarn deps to build native
- name: Install cargo-cp-artifact
run: npm install -g cargo-cp-artifact@0.1
- name: Build native (with Python)
env:
PYO3_PYTHON: python3.9
CARGO_BUILD_TARGET: x86_64-unknown-linux-gnu
working-directory: ./packages/cubejs-backend-native
run: yarn run native:build-debug-python
- name: Store build artifact for dev image
uses: actions/upload-artifact@v4
with:
name: "native-linux-x64-glibc-3.9.node" # this name is referenced below in docker-image-dev
path: ./packages/cubejs-backend-native/index.node
overwrite: true
docker-image-dev:
name: Release :dev image
needs: [latest-tag-sha, build_native_linux]
runs-on: ubuntu-20.04
if: (needs['latest-tag-sha'].outputs.sha != github.sha)
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Download backend-native artifact
uses: actions/download-artifact@v4
with:
name: "native-linux-x64-glibc-3.9.node" # this name is referenced in above in native_linux
path: ./packages/cubejs-backend-native/
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Push to Docker Hub
uses: docker/build-push-action@v6
with:
context: ./
file: ./packages/cubejs-docker/dev.Dockerfile
platforms: linux/amd64
push: true
tags: cubejs/cube:dev
- name: Update repo description
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: cubejs/cube
readme-filepath: ./packages/cubejs-docker/README.md
trigger-test-suites:
name: Trigger test suites run
runs-on: ubuntu-20.04
needs: [docker-image-dev]
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Dispatch event
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_TRIGGER_TOKEN }}
script: |
const prUrl = context.payload.pull_request ? context.payload.pull_request.html_url : '';
const commitUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${context.sha}`;
await github.rest.actions.createWorkflowDispatch({
owner: 'cubedevinc',
repo: 'sql-api-test-suite',
workflow_id: 'test_and_run_test_suites.yml',
ref: 'main',
inputs: {
'cube-image': 'cubejs/cube:dev',
'source-repo': context.repo.repo,
'source-pr-url': prUrl,
'source-commit-url': commitUrl,
'initiator': '${{ github.actor }}'
}
})