Publish cmake and ninja as zips (5/n) #8
Workflow file for this run
This file contains hidden or 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
########################################################################## | |
# File: dkcoder\.github\workflows\cmake-build-static.yml # | |
# # | |
# Copyright 2024 Diskuv, Inc. # | |
# # | |
# Licensed under the Open Software License version 3.0 # | |
# (the "License"); you may not use this file except in compliance # | |
# with the License. You may obtain a copy of the License at # | |
# # | |
# https://opensource.org/license/osl-3-0-php/ # | |
# # | |
########################################################################## | |
# What does suitable mean? | |
# 1. On Linux either a low glibc version or none at all (musl static linking) | |
# 2. The cmake archive is a zip file since there is fast native support for | |
# zipfiles in dk.exe using MlFront_ZipFile. | |
name: CMake suitable for dk.exe bootstrap | |
on: | |
push: | |
jobs: | |
build-static: | |
runs-on: ubuntu-latest | |
# We never want the DkCoder version numbers to conflict with the CMake releases. | |
# So use tags that are real CMake versions. Example: cmake-3.25.2 | |
if: startsWith(github.ref, 'refs/tags/cmake-') | |
strategy: | |
matrix: | |
include: | |
- platform: linux/amd64 | |
dkml_target_abi: linux_x86_64 | |
testable: true | |
- platform: linux/arm64 | |
dkml_target_abi: linux_arm64 | |
# Can't run arm64 on Intel machines without an emulator | |
testable: false | |
- platform: linux/386 | |
dkml_target_abi: linux_x86 | |
testable: true | |
name: ${{ matrix.dkml_target_abi }} | |
steps: | |
- name: Validation | |
run: zip --version | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# We aren't use cross-compilation. Instead we have multiple platforms | |
# with QEMU emulation providing a native environment. An alternative | |
# is to use CMake to build Ninja with a cross-compiler. | |
- name: Build ${{ matrix.platform }} and export to filesystem | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: ${{ matrix.platform }} | |
file: ci/cmake-build-static/Dockerfile | |
outputs: type=local,dest=out | |
- name: Display binary format | |
run: file out/usr/local/cmake/bin/cmake | |
- name: Test binary outside container | |
if: matrix.testable | |
run: out/usr/local/cmake/bin/cmake --version | |
- name: Bundle cmake-${{ matrix.dkml_target_abi }}.zip | |
run: X=$(pwd) && cd out/usr/local && zip -y -r $X/cmake-${{ matrix.dkml_target_abi }} cmake | |
- name: Upload cmake archive | |
uses: actions/upload-artifact@v4 | |
with: | |
retention-days: 30 | |
name: cmake-${{ matrix.dkml_target_abi }} | |
path: cmake-${{ matrix.dkml_target_abi }}.zip | |
rearchive-as-zip: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/cmake-') | |
strategy: | |
matrix: | |
include: | |
- abi: darwin_universal | |
cksum256: a988e2a69c1d105987f12782ee0fa80d6be941b3e1a68b4bd6a661f0fdb56d75 | |
cmake_majminpat_ver: 3.25.2 | |
cmake_base_suffix: macos10.10-universal | |
name: ${{ matrix.abi }} | |
steps: | |
- name: Download and repack | |
run: | | |
curl -Lo cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v${{matrix.cmake_majminpat_ver}}/cmake-${{matrix.cmake_majminpat_ver}}-${{matrix.cmake_base_suffix}}.tar.gz | |
install -d dist && cd dist | |
tar xfz ../cmake.tar.gz | |
zip -y -r ../cmake-${{ matrix.abi }} * | |
- name: Upload cmake zip | |
uses: actions/upload-artifact@v4 | |
with: | |
retention-days: 30 | |
name: cmake-${{ matrix.abi }} | |
path: cmake-${{ matrix.abi }}.zip | |
publish: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
needs: | |
- build-static | |
- rearchive-as-zip | |
if: startsWith(github.ref, 'refs/tags/cmake-') | |
steps: | |
- name: Download CMake archives | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: cmake-* | |
merge-multiple: true | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
cmake-linux_x86_64.zip | |
cmake-linux_x86.zip | |
cmake-linux_arm64.zip | |
cmake-darwin_universal.zip |