-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (146 loc) · 5.48 KB
/
standalone-cd.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
# runs python packaging/pack.py to create a desktop build
# the build is at packaging/dist/latest/xxx.zip
# the build is uploaded to s3 with shallwefootball/s3-upload-action@master
name: Standalone CD
# only run on tag push
on:
push:
tags:
- 'v*'
workflow_dispatch: # allow manual trigger
jobs:
build:
strategy:
matrix:
#target: [windows.x86_64, linux.x86_64, darwin.x86_64, darwin.aarch64]
target: [
{target: linux.x86_64, runs-on: ubuntu-latest},
{target: darwin.x86_64, runs-on: macos-latest},
{target: darwin.aarch64, runs-on: macos-latest},
{target: windows.x86_64, runs-on: ubuntu-latest}
]
edition: [demo, full]
include:
# cloud edition is only for linux.x86_64
- edition: cloud
target: {target: linux.x86_64, runs-on: ubuntu-latest}
runs-on: ${{ matrix.target.runs-on }}
steps:
# checkout with submodules
- name: Get token from Github App
uses: actions/create-github-app-token@v1
id: app_token
with:
app-id: ${{ secrets.CI_APP_ID }}
private-key: ${{ secrets.CI_APP_PEM }}
# owner is required, otherwise the creds will fail the checkout step
owner: ${{ github.repository_owner }}
- name: Checkout from GitHub
uses: actions/checkout@v4
with:
submodules: true
token: ${{ steps.app_token.outputs.token }}
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install dependencies
run: |
pip install -r packaging/pack_requirements.txt
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install npm dependencies
run: |
cd frontend && npm install && cd ..
cd submodules/topicsync-client && npm install && cd ../..
cd submodules/objectsync-client && npm install && cd ../..
- name: Decode pyarmor registration file
env:
REGFILE: ${{ secrets.PYARMOR_REGFILE }}
run: |
echo $REGFILE | base64 -d > ~/.pyarmor-regfile-4553.zip
- name: Register pyarmor
run: |
pyarmor reg ~/.pyarmor-regfile-4553.zip && rm ~/.pyarmor-regfile-4553.zip
- name: Run pack.py
env:
SIGNATURE_E: ${{ secrets.SIGNATURE_E }}
SIGNATURE_N: ${{ secrets.SIGNATURE_N }}
run: python packaging/pack.py --build_name ${{ matrix.edition }} --folder_name build --platform ${{ matrix.target.target }} --edition ${{ matrix.edition }}
- name: Setup AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-1
- name: Sync files to S3 bucket
run: |
aws s3 cp packaging/dist/build/*.zip s3://${{ secrets.S3_DESKTOP_ARTIFACT_BUCKET }}/releases/${{ matrix.edition }}/
- name: Upload artifact for testing
uses: actions/upload-artifact@v2
with:
name: standalone-${{ matrix.target.target }}-${{ matrix.edition }}
path: packaging/dist/build/*.zip
build-docker:
# only run if the tag is not prerelease
if: '! contains(github.ref_name, ''-a'') && ! contains(github.ref_name, ''-b'')'
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: standalone-linux.x86_64-cloud
path: work
- name: Unzip artifact
run: unzip work/*.zip -d work/grapycal
- name: Docker - Login
uses: docker/login-action@v3
with:
registry: registry.grapycal.com
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker - Build / Push
uses: docker/build-push-action@v5
with:
context: ./work/grapycal
file: work/grapycal/lab.Dockerfile
platforms: linux/amd64
push: true
tags: registry.grapycal.com/lab:${{ github.ref_name }}
# test:
# needs: build
# strategy:
# matrix:
# target: [
# {runs-on: windows-latest, target: windows.x86_64},
# {runs-on: ubuntu-latest, target: linux.x86_64},
# {runs-on: macos-latest, target: darwin.x86_64},
# {runs-on: macos-latest, target: darwin.aarch64}
# ]
# edition: [demo, full]
# # if linux, use ubuntu-latest. If windows, use windows-latest. If mac, use macos-latest.
# runs-on: ${{ matrix.target.runs-on }}
# steps:
# - name: Download artifact
# uses: actions/download-artifact@v2
# with:
# name: standalone-${{ matrix.target.target }}-${{ matrix.edition }}
# path: packaging/dist/build
# - name: Unzip artifact
# run: unzip packaging/dist/build/*.zip -d packaging/dist/build/grapycal
# - name: Set up Python 3.11
# uses: actions/setup-python@v2
# with:
# python-version: 3.11
# - name: Install and run grapycal
# run: |
# cd packaging/dist/build/grapycal
# python install.py
# python main.py &
# - name: Wait for 20 seconds
# run: sleep 20
# - name: Check if Grapycal is running
# run: ps aux | grep main.py | grep -v grep || exit 1