forked from bambulab/BambuStudio
-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (129 loc) · 5.4 KB
/
build_deps.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
on:
workflow_call:
inputs:
cache-key:
required: true
type: string
cache-path:
required: true
type: string
valid-cache:
required: true
type: boolean
os:
required: true
type: string
arch:
required: false
type: string
build-deps-only:
required: false
type: boolean
jobs:
build_deps:
name: Build Deps
if: inputs.build-deps-only || inputs.valid-cache != true
runs-on: ${{ inputs.os }}
env:
date:
steps:
# Setup the environment
- name: Checkout
uses: actions/checkout@v4
with:
lfs: 'true'
- name: load cached deps
uses: actions/cache@v4
with:
path: ${{ inputs.cache-path }}
key: ${{ inputs.cache-key }}
- name: setup dev on Windows
if: inputs.os == 'windows-latest'
uses: microsoft/setup-msbuild@v2
- name: Get the date on Ubuntu and macOS
if: inputs.os != 'windows-latest'
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV
shell: bash
- name: Get the date on Windows
if: inputs.os == 'windows-latest'
run: echo "date=$(Get-Date -Format 'yyyyMMdd')" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
shell: pwsh
# Build Dependencies
- name: Build on Windows
if: inputs.os == 'windows-latest'
working-directory: ${{ github.workspace }}
run: |
choco install strawberryperl
choco install pkgconfiglite
mkdir ${{ github.workspace }}\deps\build
mkdir ${{ github.workspace }}\deps\build\BambuStudio_dep
cd "${{ github.workspace }}\deps\build"
cmake ../ -G "Visual Studio 17 2022" -A x64 -DDESTDIR="./BambuStudio_dep" -DCMAKE_BUILD_TYPE=Release -DDEP_DEBUG=OFF
msbuild /m ALL_BUILD.vcxproj
- name: pack deps on Windows
if: inputs.os == 'windows-latest'
working-directory: ${{ github.workspace }}
run: Compress-Archive -Path "${{ github.workspace }}\deps\build\BambuStudio_dep\*" -DestinationPath "${{ github.workspace }}\deps\build\BambuStudio_dep_win64_${{ env.date }}_vs2022.zip"
shell: pwsh
- name: Fix python install error on mac
if: inputs.os == 'macos-13'
working-directory: ${{ github.workspace }}
run: |
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
sudo rm -rf /Library/Frameworks/Python.framework/
brew install --force python3 && brew unlink python3 && brew unlink python3 && brew link --overwrite python3
- name: Build on Mac ${{ inputs.arch }}
if: inputs.os == 'macos-13'
working-directory: ${{ github.workspace }}
run: |
brew install automake texinfo nasm yasm x264
brew uninstall --ignore-dependencies zstd
mkdir -p ${{ github.workspace }}/deps/build_${{ inputs.arch }}
mkdir -p ${{ github.workspace }}/deps/build_${{ inputs.arch }}/BambuStudio_dep_${{ inputs.arch }}
cd ${{ github.workspace }}/deps/build_${{ inputs.arch }}
cmake ../ -DDESTDIR="${{ github.workspace }}/deps/build_${{ inputs.arch }}/BambuStudio_dep_${{ inputs.arch }}" -DOPENSSL_ARCH="darwin64-x86_64-cc"
make -j4
brew install zstd
- name: pack deps on Macos
if: inputs.os == 'macos-13'
working-directory: ${{ github.workspace }}
run: tar -zcvf "BambuStudio_dep_mac_${{ inputs.arch }}_$(date +"%Y%m%d").tar.gz" "${{ github.workspace }}/deps/build_${{ inputs.arch }}/BambuStudio_dep_${{ inputs.arch }}"
- name: Build on Ubuntu
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
working-directory: ${{ github.workspace }}
run: |
sudo ./BuildLinux.sh -ur
sudo chown $USER -R ./
./BuildLinux.sh -dfr
cd deps/build
tar -czvf BambuStudio_dep_${{ inputs.os }}_$(date +"%Y%m%d").tar.gz destdir
# Upload Artifacts
- name: Upload Mac ${{ inputs.arch }} artifacts
if: inputs.os == 'macos-13'
uses: actions/upload-artifact@v4
with:
name: BambuStudio_dep_mac_${{ inputs.arch }}_${{ env.date }}
path: ${{ github.workspace }}/BambuStudio_dep_mac_${{ inputs.arch }}*.tar.gz
- name: Upload Windows artifacts
if: inputs.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: BambuStudio_dep_win64_${{ env.date }}
path: ${{ github.workspace }}/deps/build/BambuStudio_dep*.zip
- name: Upload Ubuntu artifacts
if: ${{ ! env.ACT && (inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04') }}
uses: actions/upload-artifact@v4
with:
name: BambuStudio_dep_${{ inputs.os }}_${{ env.date }}
path: ${{ github.workspace }}/deps/build/BambuStudio_dep_${{ inputs.os }}_*.tar.gz
build_Bambu:
name: Build BambuStudio
needs: [build_deps]
if: ${{ !cancelled() && !inputs.build-deps-only && (inputs.valid-cache == true && needs.build_deps.result == 'skipped') || (inputs.valid-cache != true && success()) }}
uses: ./.github/workflows/build_bambu.yml
with:
cache-key: ${{ inputs.cache-key }}
cache-path: ${{ inputs.cache-path }}
os: ${{ inputs.os }}
arch: ${{ inputs.arch }}
secrets: inherit