Updated the trigger of the workflow to workflow_dispatch #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
# Only run on branches (not tags) | |
branches: | |
- '*' | |
workflow_dispatch: | |
workflow_run: | |
workflows: ['Update Mixxx'] | |
types: [completed] | |
env: | |
VCPKG_ROOT: '${{ github.workspace }}/vcpkg' | |
MIXXX_ROOT: '${{ github.workspace }}/mixxx' | |
SCRIPTS_ROOT: '${{ github.workspace }}/scripts' | |
XCODE_ROOT: /Applications/Xcode_15.2.app | |
SDK_ROOT: '${{ github.workspace }}/theos/sdks/iPhoneOS16.5.sdk' | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- name: iOS (arm64) | |
os: macos-14 | |
suffix: '' | |
triplet: arm64-ios-release | |
host_triplet: arm64-osx-release | |
ccache_path: ~/Library/Caches/ccache | |
cmake_args: >- | |
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED="NO" | |
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY="" | |
# - name: macOS (arm64) | |
# os: macos-11 | |
# suffix: '' | |
# triplet: arm64-osx-min1100-release | |
# host_triplet: x64-osx-min1015-release | |
# ccache_path: ~/Library/Caches/ccache | |
# cpack_generator: DragNDrop | |
# package_extension: dmg | |
# cmake_args: >- | |
# -DMACOS_BUNDLE=ON | |
# - name: macOS (x86_64) | |
# os: macos-11 | |
# suffix: '' | |
# triplet: x64-osx-min1015-release | |
# host_triplet: x64-osx-min1015-release | |
# ccache_path: ~/Library/Caches/ccache | |
# cpack_generator: DragNDrop | |
# package_extension: dmg | |
# cmake_args: >- | |
# -DMACOS_BUNDLE=ON | |
# - name: macOS (arm64, Debug Assertions) | |
# os: macos-11 | |
# suffix: '-debugasserts' | |
# triplet: arm64-osx-min1100-release | |
# host_triplet: x64-osx-min1015-release | |
# ccache_path: ~/Library/Caches/ccache | |
# cpack_generator: DragNDrop | |
# package_extension: dmg | |
# cmake_args: >- | |
# -DDEBUG_ASSERTIONS_FATAL=ON | |
# -DMACOS_BUNDLE=ON | |
# - name: macOS (x86_64, Debug Assertions) | |
# os: macos-11 | |
# suffix: '-debugasserts' | |
# triplet: x64-osx-min1015-release | |
# host_triplet: x64-osx-min1015-release | |
# ccache_path: ~/Library/Caches/ccache | |
# cpack_generator: DragNDrop | |
# package_extension: dmg | |
# cmake_args: >- | |
# -DDEBUG_ASSERTIONS_FATAL=ON | |
# -DMACOS_BUNDLE=ON | |
# - name: Linux (x86_64) | |
# os: ubuntu-latest | |
# suffix: '' | |
# triplet: x64-linux-release | |
# host_triplet: x64-linux-release | |
# ccache_path: ~/.ccache | |
# cpack_generator: TGZ | |
# package_extension: tar.gz | |
# # On Linux we build without battery support since this pulls in a | |
# # dependency on GLib which is tricky to get right in a static linking scenario. | |
# # See https://github.com/fwcd/m1xxx/pull/48#issuecomment-1807378063 | |
# cmake_args: >- | |
# -DBATTERY=OFF | |
# - name: Linux (x86_64, Debug Assertions) | |
# os: ubuntu-latest | |
# suffix: '-debugasserts' | |
# triplet: x64-linux-release | |
# host_triplet: x64-linux-release | |
# ccache_path: ~/.ccache | |
# cpack_generator: TGZ | |
# package_extension: tar.gz | |
# cmake_args: >- | |
# -DDEBUG_ASSERTIONS_FATAL=ON | |
# -DBATTERY=OFF | |
name: '${{ matrix.name }}' | |
runs-on: '${{ matrix.os }}' | |
env: | |
DEPS_BASE_NAME: 'deps-${{ matrix.triplet }}' | |
ARTIFACT_BASE_NAME: 'mixxx-${{ matrix.triplet }}${{ matrix.suffix }}' | |
VCPKG_DEFAULT_TRIPLET: '${{ matrix.triplet }}' | |
VCPKG_DEFAULT_HOST_TRIPLET: '${{ matrix.host_triplet }}' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' # to compute the monotonic version correctly | |
submodules: true | |
- name: Output runner info | |
run: uname -a | |
- 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 Linux build environment | |
if: runner.os == 'Linux' | |
run: ${{ env.SCRIPTS_ROOT }}/install-ubuntu-deps | |
- name: test | |
if: runner.os == 'macOS' | |
run: | | |
xcode-select -p | |
xcrun --sdk iphoneos --show-sdk-path | |
- name: Set up macOS build environment | |
if: runner.os == 'macOS' | |
run: | | |
${{ env.SCRIPTS_ROOT }}/install-macos-deps | |
# sudo xcode-select -s "${{ env.XCODE_ROOT }}" | |
echo "==> Build environment" | |
echo "Currently selected developer directory:" | |
xcode-select -p | |
echo "MacOSX SDK path:" | |
xcrun --show-sdk-path | |
echo "MacOSX SDK version:" | |
xcrun --show-sdk-version | |
echo "iOS SDK path:" | |
xcrun --sdk iphoneos --show-sdk-path | |
echo "iOS SDK version:" | |
xcrun --sdk iphoneos --show-sdk-version | |
# Setup Theos | |
- name: Check theos cache | |
run: | | |
echo upstream_heads=`git ls-remote https://github.com/theos/theos | head -n 1 | cut -f 1`-`git ls-remote https://github.com/theos/sdks | head -n 1 | cut -f 1` >> $GITHUB_ENV | |
- name: Use theos cache | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}/theos | |
key: ${{ env.upstream_heads }} | |
- name: Prepare Theos | |
uses: Randomblock1/theos-action@v1 | |
- name: check theos sdks | |
run: ls -la ${{ env.VCPKG_OSX_SYSROOT }} | |
# 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-${{ matrix.os }}-${{ env.VCPKG_DEFAULT_TRIPLET }}-${{ env.vcpkg_commit }}-${{ github.ref }}-${{ github.run_number }} | |
restore-keys: | | |
vcpkg-installed-${{ matrix.os }}-${{ env.VCPKG_DEFAULT_TRIPLET }}-${{ env.vcpkg_commit }}-${{ github.ref }}- | |
vcpkg-installed-${{ matrix.os }}-${{ 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 --clean-after-build | |
- name: Upload vcpkg build logs | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: 'vcpkg-buildlogs-${{ matrix.triplet }}' | |
path: ${{ env.VCPKG_ROOT }}/buildtrees/**/*.log | |
- name: Save vcpkg cache | |
uses: actions/cache/save@v3 | |
with: | |
# TODO: Share the key and the path with the previous step | |
path: ${{ env.VCPKG_ROOT }}/installed | |
key: vcpkg-installed-${{ matrix.os }}-${{ env.VCPKG_DEFAULT_TRIPLET }}-${{ env.vcpkg_commit }}-${{ github.ref }}-${{ github.run_number }} | |
# Export dependency archive to artifacts | |
- name: Export vcpkg archive | |
if: matrix.suffix == '' | |
working-directory: ${{ env.VCPKG_ROOT }} | |
run: >- | |
${{ env.SCRIPTS_ROOT }}/vcpkg export | |
--x-all-installed | |
--x-install-root="${{ env.VCPKG_ROOT }}/installed" | |
--zip | |
--output="${{ env.DEPS_BASE_NAME }}-${{ env.vcpkg_commit_short }}" | |
--output-dir="${{ env.VCPKG_ROOT }}" | |
- name: Upload vcpkg archive | |
if: matrix.suffix == '' | |
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: ${{ matrix.ccache_path }} | |
key: ccache-${{ matrix.triplet }}-${{ env.mixxx_commit }}-${{ github.ref }}-${{ github.run_number }} | |
restore-keys: | | |
ccache-${{ matrix.triplet }}-${{ env.mixxx_commit }}-${{ github.ref }}- | |
ccache-${{ matrix.triplet }}-${{ env.mixxx_commit }}- | |
ccache-${{ matrix.triplet }}- | |
- name: Configure Mixxx build | |
run: ${{ env.SCRIPTS_ROOT }}/configure-mixxx -- ${{ matrix.cmake_args }} | |
working-directory: mixxx | |
- name: Upload Mixxx configuration logs | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: configurelogs | |
path: ${{ env.MIXXX_ROOT }}/build/CMakeFiles/*.log | |
- name: Copy Makefile | |
run: ${{ env.SCRIPTS_ROOT }}/copy-makefile | |
- name: Build Mixxx | |
run: | | |
rm -f packages/* | |
make package | |
working-directory: mixxx/build | |
- name: Save build cache | |
if: always() | |
uses: actions/cache/save@v3 | |
with: | |
# TODO: Share the key with the setup step | |
path: ${{ matrix.ccache_path }} | |
key: ccache-${{ matrix.triplet }}-${{ env.mixxx_commit }}-${{ github.ref }}-${{ github.run_number }} | |
- name: Upload packaged Mixxx binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_BASE_NAME }} | |
path: ${{ env.MIXXX_ROOT }}/build/packages/*.tipa | |
overwrite: true | |
release: | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: [build] | |
env: | |
PACKAGE_GLOB: 'mixxx-*/*' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' # to compute the monotonic version correctly | |
submodules: true | |
- name: Fetch versions and paths | |
run: echo "mixxx_version=$(scripts/mixxx-version)" >> "$GITHUB_ENV" | |
shell: bash | |
- name: Download artifacts for all builds | |
uses: actions/download-artifact@v3 | |
with: | |
# TODO: Only download artifacts starting with 'mixxx-' to avoid needlessly downloading the dependency archives | |
path: '${{ env.MIXXX_ROOT }}/build' | |
- name: Create a release | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
version='${{ env.mixxx_version }}' | |
tag="v$version" | |
gh release create --title "$tag" "$tag" || true | |
gh release upload "$tag" '${{ env.MIXXX_ROOT }}'/build/${{ env.PACKAGE_GLOB }} || true |