-
Notifications
You must be signed in to change notification settings - Fork 2
102 lines (91 loc) · 3.12 KB
/
release.yml
File metadata and controls
102 lines (91 loc) · 3.12 KB
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
name: Build and Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.variant }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
variant: cpu
dist_name: AmicoScript
artifact_os: linux
- os: windows-latest
variant: cpu
dist_name: AmicoScript
artifact_os: windows
- os: macos-latest
variant: cpu
dist_name: AmicoScript
artifact_os: macos
- os: windows-latest
variant: gpu
dist_name: AmicoScript-GPU
artifact_os: windows-gpu
- os: ubuntu-latest
variant: gpu
dist_name: AmicoScript-GPU
artifact_os: linux-gpu
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
if [ "${{ matrix.variant }}" = "gpu" ]; then
pip install -r backend/requirements-gpu.txt
else
pip install -r backend/requirements.txt
fi
pip install -r requirements-pyinstaller.txt
shell: bash
- name: Build with PyInstaller
run: |
if [ "${{ matrix.variant }}" = "gpu" ]; then
python package.py --gpu
else
python package.py
fi
shell: bash
- name: Smoke test built artifact
run: |
if [ "${{ matrix.variant }}" = "gpu" ]; then
AMICO_SMOKE_TIMEOUT=180 python scripts/smoke_test_bundle.py --gpu
else
AMICO_SMOKE_TIMEOUT=180 python scripts/smoke_test_bundle.py
fi
shell: bash
- name: Create zip artifact (Windows)
if: runner.os == 'Windows'
run: |
pwsh -Command "if (-Not (Test-Path build\artifacts)) { New-Item -ItemType Directory -Path build\artifacts | Out-Null }; Compress-Archive -Path 'dist/${{ matrix.dist_name }}/*' -DestinationPath 'build\artifacts\AmicoScript-${{ github.ref_name }}-${{ matrix.artifact_os }}.zip' -Force"
- name: Create zip artifact (macOS)
if: runner.os == 'macOS'
run: |
mkdir -p build/artifacts
# Preserve .app bundle structure.
ditto -c -k --keepParent "dist/AmicoScript.app" "build/artifacts/AmicoScript-${{ github.ref_name }}-macos.zip"
shell: bash
- name: Create zip artifact (Linux)
if: runner.os == 'Linux'
run: |
mkdir -p build/artifacts
zip -r "build/artifacts/AmicoScript-${{ github.ref_name }}-${{ matrix.artifact_os }}.zip" dist/${{ matrix.dist_name }} || true
shell: bash
- name: Create GitHub Release and upload artifacts
uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref_name }}
artifacts: build/artifacts/*.zip
allowUpdates: true
skipIfReleaseExists: false