forked from homebridge/ffmpeg-for-homebridge
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (79 loc) · 2.99 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
# build.yml: Build FFmpeg binaries.
#
name: 'Build FFmpeg'
on:
workflow_dispatch:
jobs:
build:
name: 'Build FFmpeg'
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
matrix:
name: [
alpine-arm32v7,
]
include:
# Build for arm v7 32-bit Linux environments.
- name: alpine-arm32v7
os: ubuntu-latest
BASE_IMAGE: arm32v7/alpine:latest
DOCKERFILE: linux
EMULATE_ARCH: arm
TARGET_ARCH: arm32v7
TARGET_OS: alpine
steps:
- uses: actions/checkout@v3
- name: 'Caching workspace.'
id: cache
uses: actions/cache@v3
with:
path: build
key: ${{ matrix.name }}-cache
# Docker image build.
- name: 'Docker: creating the build image.'
if: runner.os == 'Linux'
run: |
# Configure QEMU to register handlers for our target architectures.
docker run --rm --privileged multiarch/qemu-user-static:register --reset
# Build the image that will become our build environment.
docker build --build-arg BASE_IMAGE=${{ matrix.BASE_IMAGE }} --build-arg EMULATE_ARCH=${{ matrix.EMULATE_ARCH }} -f Dockerfile.${{ matrix.DOCKERFILE }} -t ffmpeg-builder-${{ matrix.name }} .
# Docker image build.
- name: 'Docker: building the FFmpeg binary.'
if: runner.os == 'Linux'
run: |
mkdir -p build
# Start the build environment for our requested target.
docker run -v $(pwd)/build:/build -e TARGET_OS=${{ matrix.TARGET_OS }} -e TARGET_BUILD_ARCH=${{ matrix.TARGET_ARCH }} ffmpeg-builder-${{ matrix.name }}
# Fix any permissions issues that may have arisen due to containerization.
sudo chown -R $USER:$USER build
# macOS Builds.
- name: 'macOS: building the FFmpeg binary.'
if: runner.os == 'macOS'
run: |
mkdir -p build
# Execute the build script.
cd build && SKIPINSTALL=yes VERBOSE=yes ../build-ffmpeg --build --enable-gpl-and-non-free
# Package our binaries for non-Windows operating systems.
- name: 'Linux and macOS: packaging the binary.'
if: matrix.DOCKERFILE != 'windows'
run: |
mkdir -p package/usr/local/bin/
# Emulate the filesystem hierarchy so it's easily discoverable in a user's path environment variable.
cp build/workspace/bin/ffmpeg package/usr/local/bin/ffmpeg
# Now we package it all up.
tar -C package -zcvf ffmpeg-${{ matrix.name }}.tar.gz .
# Package our binaries for Windows.
- name: 'Windows: packaging the binary.'
if: matrix.DOCKERFILE == 'windows'
run: |
# Copy the binary we're looking for and we are done.
cp build/ffmpeg.exe .
# Upload the packaged asset as an artifact.
- name: 'Uploading the packaged asset.'
uses: actions/upload-artifact@v3
with:
name: ffmpeg-${{ matrix.name }}
path: |
ffmpeg-${{ matrix.name }}.tar.gz
ffmpeg.exe