-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (80 loc) · 3.3 KB
/
ninja-build-static.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
##########################################################################
# File: dkcoder\.github\workflows\ninja-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/ #
# #
##########################################################################
name: Publish ninja-build as a static binary
on:
push:
jobs:
build:
runs-on: ubuntu-latest
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: 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/ninja-build-static/Dockerfile
outputs: type=local,dest=out
- name: Display binary format
run: file out/usr/local/src/ninja-build/ninja
- name: Test binary outside container
if: matrix.testable
run: out/usr/local/src/ninja-build/ninja --version
- name: Rename ninja binary to ninja-${{ matrix.dkml_target_abi }}
run: mv out/usr/local/src/ninja-build/ninja ninja-${{ matrix.dkml_target_abi }}
- name: Upload ninja binary
uses: actions/upload-artifact@v4
with:
retention-days: 30
name: ninja-${{ matrix.dkml_target_abi }}
path: ninja-${{ matrix.dkml_target_abi }}
publish:
permissions:
contents: write
runs-on: ubuntu-latest
needs: build
# We never want the DkCoder version numbers to conflict with the Ninja releases.
# So use tags that are real Ninja versions. Example: ninja-1.12.1
if: startsWith(github.ref, 'refs/tags/ninja-')
steps:
- name: Download ninja binaries
uses: actions/download-artifact@v4
with:
pattern: ninja-*
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
ninja-linux_x86_64
ninja-linux_x86
ninja-linux_arm64