forked from w-okada/voice-changer
-
Notifications
You must be signed in to change notification settings - Fork 7
168 lines (159 loc) · 5.45 KB
/
make-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
158
159
160
161
162
163
164
165
166
167
168
name: Make release
on:
workflow_dispatch: # allows manual triggering
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
create-tag:
runs-on: ubuntu-20.04
outputs:
release_id: ${{ steps.create_release.outputs.id }}
name: ${{ steps.tag.outputs.name }}
steps:
- name: Clone
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine tag name
id: tag
shell: bash
run: |
BUILD_NUMBER="$(git rev-list --count HEAD)"
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
if [[ "${{ env.BRANCH_NAME }}" == "master-custom" ]]; then
echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
else
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
fi
- name: Create release
id: create_release
uses: anzz1/action-create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
tag_name: ${{ steps.tag.outputs.name }}
build-all:
needs:
- create-tag
strategy:
matrix:
include:
- os: windows-latest
os_suffix: windows-amd64
reqs: cuda
backend: cuda
python-version: '3.11'
- os: windows-latest
os_suffix: windows-amd64
reqs: dml
backend: dml
python-version: '3.11'
- os: macos-13
os_suffix: macos-amd64
reqs: cpu
backend: cpu
python-version: '3.11'
- os: macos-latest
os_suffix: macos-arm64
reqs: cpu
backend: cpu
python-version: '3.11'
- os: ubuntu-20.04
os_suffix: linux-amd64
reqs: cpu
backend: cpu
python-version: '3.11'
- os: ubuntu-20.04
os_suffix: linux-amd64
reqs: cuda
backend: cuda
# Linux CUDA depends on faiss-gpu-cp310
python-version: '3.10'
- os: ubuntu-20.04
os_suffix: linux-amd64
reqs: rocm
backend: rocm
# onnxruntime-rocm supports only cp310
python-version: '3.10'
runs-on: ${{ matrix.os }}
env:
BACKEND: ${{ matrix.backend }}
BUILD_NAME: ${{ needs.create-tag.outputs.name }}
steps:
- name: Maximize build space
if: matrix.os == 'ubuntu-20.04'
uses: AdityaGarg8/remove-unwanted-software@v3
with:
remove-swapfile: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
remove-android: 'true'
remove-dotnet: 'true'
# remove-large-packages: 'true'
remove-haskell: 'true'
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# architecture: x64
# cache: pip
- name: Installing build dependencies
run: python -m pip install --no-cache-dir --upgrade pip wheel setuptools pyinstaller
- name: Installing project dependencies
run: python -m pip install --no-cache-dir -r requirements-common.txt -r requirements-${{ matrix.reqs }}.txt
working-directory: ./server
- name: Building executable
run: pyinstaller --clean -y --dist ./dist --workpath /tmp MMVCServerSIO.spec
working-directory: ./server
- name: Copy utils
run: cp ./server/{force_gpu_clocks.bat,reset_gpu_clocks.bat} ./server/dist/
shell: bash
if: matrix.os == 'windows-latest' && matrix.backend == 'cuda'
- name: Pack artifact
shell: bash
run: |
mkdir ./server/artifacts
if [ "$RUNNER_OS" = "Windows" ]; then
7z a -v2000m -tzip ./server/artifacts/voice-changer-${{ matrix.os_suffix }}-${{ matrix.reqs }}.zip ./server/dist/* > /dev/null 2>&1
else
cd ./server/dist
tar czf - ./* | split -b 2000m - ../artifacts/voice-changer-${{ matrix.os_suffix }}-${{ matrix.reqs }}.tar.gz.
cd -
fi
- name: Rename single asset
shell: bash
run: |
ls -al ./server/artifacts/
COUNT=$(ls -1q ./server/artifacts/ | wc -l | sed -r 's/[[:space:]]+//g')
if [ $COUNT = 1 ]; then
if [ "$RUNNER_OS" = "Windows" ]; then
mv ./server/artifacts/voice-changer-${{ matrix.os_suffix }}-${{ matrix.reqs }}.zip.001 ./server/artifacts/voice-changer-${{ matrix.os_suffix }}-${{ matrix.reqs }}.zip
else
mv ./server/artifacts/voice-changer-${{ matrix.os_suffix }}-${{ matrix.reqs }}.tar.gz.aa ./server/artifacts/voice-changer-${{ matrix.os_suffix }}-${{ matrix.reqs }}.tar.gz
fi
fi
- name: Upload release
id: upload_release
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const path = require('path');
const fs = require('fs');
const root = './server/artifacts';
const release_id = '${{ needs.create-tag.outputs.release_id }}';
const files = fs.readdirSync(root);
for (const file of files) {
console.log('uploadReleaseAsset', file);
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release_id,
name: file,
data: await fs.readFileSync(path.join(root, file))
});
}