-
Notifications
You must be signed in to change notification settings - Fork 7
153 lines (144 loc) · 5.25 KB
/
build.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
name: Build
on:
push:
# Only run on branches (not tags)
branches:
- '*'
workflow_dispatch:
workflow_run:
workflows: ['Update Mixxx']
types: [completed]
jobs:
build:
runs-on: macos-11
env:
DEPS_BASE_NAME: mixxx-deps-arm64-macos
ARTIFACT_BASE_NAME: mixxx-arm64-macos
VCPKG_DEFAULT_TRIPLET: arm64-osx-min1100
VCPKG_DEFAULT_HOST_TRIPLET: x64-osx-min1015
VCPKG_OVERLAY_TRIPLETS: vcpkg/overlay/triplets
VCPKG_OVERLAY_PORTS: vcpkg/overlay/osx:vcpkg/overlay/ports
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
MIXXX_ROOT: ${{ github.workspace }}/mixxx
SCRIPTS_ROOT: ${{ github.workspace }}/scripts
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0' # to compute the monotonic version correctly
submodules: true
- name: Fetch versions and paths
run: |
for mod in "${{ env.VCPKG_ROOT }}" "${{ env.MIXXX_ROOT }}"; do
echo "$(basename "$mod")_commit=$(cd $mod && git rev-parse HEAD)" >> "$GITHUB_ENV"
echo "$(basename "$mod")_commit_short=$(cd $mod && git rev-parse --short HEAD)" >> "$GITHUB_ENV"
done
echo "mixxx_version=$(scripts/mixxx-version)" >> "$GITHUB_ENV"
shell: bash
- name: Set up build environment
run: |
${{ env.SCRIPTS_ROOT }}/install-brew-deps
xcrun --show-sdk-version
# Build dependencies
- name: Bootstrap vcpkg
run: ${{ env.SCRIPTS_ROOT }}/bootstrap-vcpkg
- name: Set up vcpkg cache
uses: actions/cache@v3
with:
path: ${{ env.VCPKG_ROOT }}/installed
# TODO: Include hashed list of installed packages in key?
key: vcpkg-installed-${{ env.VCPKG_DEFAULT_TRIPLET }}-${{ env.vcpkg_commit }}-${{ github.ref }}-${{ github.run_number }}
restore-keys: |
vcpkg-installed-${{ env.VCPKG_DEFAULT_TRIPLET }}-${{ env.vcpkg_commit }}-${{ github.ref }}-
vcpkg-installed-${{ env.VCPKG_DEFAULT_TRIPLET }}-${{ env.vcpkg_commit }}-
- name: Check disk space
run: df -h
- name: Output vcpkg dependency graph
run: ${{ env.SCRIPTS_ROOT }}/install-vcpkg-deps --graph --no-install --no-remove
- name: Install vcpkg packages
run: ${{ env.SCRIPTS_ROOT }}/install-vcpkg-deps
- name: Upload vcpkg build logs
if: always()
uses: actions/upload-artifact@v3
with:
name: vcpkg-buildlogs
path: ${{ env.VCPKG_ROOT }}/buildtrees/**/*.log
# Export dependency archive to artifacts
- name: Export vcpkg archive
run: >-
${{ env.SCRIPTS_ROOT }}/vcpkg export
--x-all-installed
--zip
--output="${{ env.DEPS_BASE_NAME }}-${{ env.vcpkg_commit_short }}"
- name: Upload vcpkg archive
uses: actions/upload-artifact@v3
with:
name: ${{ env.DEPS_BASE_NAME }}-${{ env.vcpkg_commit_short }}
path: ${{ env.VCPKG_ROOT }}/${{ env.DEPS_BASE_NAME }}-${{ env.vcpkg_commit_short }}.zip
# Build Mixxx
- name: Configure build cache size
run: ccache -M 500M
- name: Set up build cache
uses: actions/cache@v3
with:
path: $HOME/Library/Caches/ccache
key: ccache-${{ env.mixxx_commit }}-${{ github.ref }}-${{ github.run_number }}
restore-keys: |
ccache-${{ env.mixxx_commit }}-${{ github.ref }}-
ccache-${{ env.mixxx_commit }}-
ccache-
- name: Configure Mixxx build
run: >-
cmake
-G Ninja
-B build
-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DMACOS_BUNDLE=ON
-DCMAKE_CROSSCOMPILING=1
-DRUN_HAVE_POSIX_REGEX=0
-DCMAKE_C_COMPILER=$(xcrun -find cc)
-DCMAKE_CXX_COMPILER=$(xcrun -find c++)
-DCMAKE_OSX_DEPLOYMENT_TARGET="11.0"
-DCMAKE_OSX_ARCHITECTURES=arm64
-DCMAKE_SYSTEM_PROCESSOR=arm64
-DQT6=ON
working-directory: mixxx
- name: Upload Mixxx configuration logs
if: always()
uses: actions/upload-artifact@v3
with:
name: mixxx-configurelogs
path: ${{ env.MIXXX_ROOT }}/build/CMakeFiles/*.log
- name: Build Mixxx
run: cmake --build build --target mixxx
working-directory: mixxx
- name: Package Mixxx
run: cpack -G DragNDrop -V && mv *.dmg "mixxx-${{ env.mixxx_version }}.dmg"
working-directory: mixxx/build
- name: Upload packaged Mixxx binaries
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_BASE_NAME }}
path: ${{ env.MIXXX_ROOT }}/build/*.dmg
- name: Create tag
if: github.ref == 'refs/heads/main'
run: |
version="${{ env.mixxx_version }}"
tag="v$version"
git fetch --tags
if git rev-parse "$tag" >/dev/null 2>&1; then
echo "tag_created=false" >> "$GITHUB_ENV"
else
git tag -am "Version $version" "$tag"
git push origin "$tag"
echo "tag=$tag" >> "$GITHUB_ENV"
echo "tag_created=true" >> "$GITHUB_ENV"
fi
shell: bash
- name: Create GitHub release
if: ${{ env.tag_created == 'true' }}
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.tag }}
name: ${{ env.mixxx_version }}
files: ${{ env.MIXXX_ROOT }}/build/*.dmg