forked from oomek/attractplus
-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (125 loc) · 5.9 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
name: Build Linux (x86_64/armv7/aarch64) / MacOS
on: [push, pull_request]
jobs:
buildAM:
name: ${{ matrix.platform.name }} ${{ matrix.config.name }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform:
- { name: Linux x64 KMS, os: ubuntu-20.04, amflags: USE_DRM=1 }
- { name: Linux x64 X11, os: ubuntu-20.04 }
- { name: MacOS, os: macos-12, amflags: prefix=.., flags: -DSFML_USE_SYSTEM_DEPS=1 }
- { name: armv7, os: ubuntu-20.04, archos: buster, shell: bash, amflags: USE_DRM=1 USE_MMAL=1}
- { name: aarch64, os: ubuntu-20.04, archos: buster, shell: bash, amflags: USE_DRM=1}
config:
- { name: shared, amflags: STATIC=0 }
- { name: static, amflags: STATIC=1 }
exclude:
- platform: { os: ubuntu-20.04 }
config: { name: shared }
- platform: { os: macos-12 }
config: { name: static }
- platform: { archos: buster }
config: { name: shared }
steps:
- name: AM+ - Checkout
uses: actions/checkout@v4
with:
path: am
- name: Prepare
id: vars
run: |
which nproc && nbproc=$(nproc) || nbproc=$(getconf _NPROCESSORS_ONLN)
echo "nbproc=${nbproc}" >> $GITHUB_OUTPUT
fe_version=
[[ ${GITHUB_REF} =~ ^refs/tags/* ]] && fe_version="${GITHUB_REF#refs/*/}"
echo "fe_version=${fe_version}" >> $GITHUB_OUTPUT
- name: Install Linux Dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install pkgconf libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libavformat-dev libfontconfig1-dev libfreetype6-dev libswscale-dev libswresample-dev libarchive-dev libjpeg-dev libglu1-mesa-dev libegl1-mesa-dev libdrm-dev libcurl4-gnutls-dev libboost-system-dev libboost-filesystem-dev
- name: Install MacOS brew
if: runner.os == 'macOS'
run: |
brew install pkg-config ffmpeg libarchive libvorbis flac jpeg-turbo boost
- name: Build AM+ (ARM)
if: matrix.platform.name == 'armv7' || matrix.platform.name == 'aarch64'
uses: uraimo/[email protected]
with:
arch: ${{ matrix.platform.name }}
distro: ${{ matrix.platform.archos }}
githubToken: ${{ github.token }}
dockerRunArgs: |
--volume "${GITHUB_WORKSPACE}/am:/am"
install: |
apt-get update -y -q
apt-get install -y -q build-essential cmake pkgconf libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libavformat-dev libfontconfig1-dev libfreetype6-dev libswscale-dev libswresample-dev libarchive-dev libjpeg-dev libglu1-mesa-dev libgbm-dev libdrm-dev libegl1-mesa-dev libcurl4-gnutls-dev libboost-filesystem-dev libboost-system-dev
run: |
make -C am -j${{ steps.vars.outputs.nbproc }} VERBOSE=1 FE_VERSION=${{ steps.vars.outputs.fe_version }} ${{matrix.platform.amflags}} ${{matrix.config.amflags}} ${{env.cross_toolchain}}
#~ - name: MacOS switch to GCC
#~ if: runner.os == 'macOS'
#~ run: |
#~ echo "CC=/usr/local/bin/gcc-10" >> $GITHUB_ENV
#~ echo "CXX=/usr/local/bin/g++-10" >> $GITHUB_ENV
#~ echo "AR=/usr/local/bin/ar-10" >> $GITHUB_ENV
- name: Build AM+
run: |
make -C am -j${{ steps.vars.outputs.nbproc }} VERBOSE=1 FE_VERSION=${{ steps.vars.outputs.fe_version }} ${{matrix.platform.amflags}} ${{matrix.config.amflags}} ${{env.cross_toolchain}}
- name: Prepare artifacts
if: runner.os != 'macOS'
run: |
mkdir -p "${GITHUB_WORKSPACE}"/artifacts
for e in "${GITHUB_WORKSPACE}"/am/*.exe ; do
echo "Gathering dll infos for $e ..."
which mingw-ldd || continue
for dll in $(mingw-ldd "$e" --dll-lookup-dirs /usr/lib/mxe/usr/x86_64-w64-mingw32.shared/bin/ "${GITHUB_WORKSPACE}"/sfml/install/lib/ | grep -v 'not found$' | tr -d ' ' | cut -d '>' -f 2) ; do
cp "$dll" "${GITHUB_WORKSPACE}"/artifacts/
done
done
find "${GITHUB_WORKSPACE}"/am/obj/sfml/install/lib/ -name "*.dll" -o -name "*.so" -o -name "*.dylib" -exec cp -v {} "${GITHUB_WORKSPACE}"/artifacts/ \;
cp am/attract* "${GITHUB_WORKSPACE}"/artifacts/
cp -R am/config/* "${GITHUB_WORKSPACE}"/artifacts/
7z a "attract-${{matrix.platform.name}}-${{matrix.config.name}}.7z" ./artifacts/*
- name: Prepare macOS artifacts
if: runner.os == 'macOS'
run: |
git -C am/ fetch --unshallow
mkdir -p "${GITHUB_WORKSPACE}"/artifacts
bash am/util/osx/appbuilder.sh
7z a "attract-${{matrix.platform.name}}-${{matrix.config.name}}.7z" ./artifacts/*
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{matrix.platform.name}}-${{matrix.config.name}}
path: attract-*.7z
Release:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
name: Release to github
needs: buildAM
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare artifacts
id: prepare_artifacts
run: |
tag="${GITHUB_REF#refs/*/}"
echo "current_tag=${tag}" >> $GITHUB_OUTPUT
mkdir -p "${GITHUB_WORKSPACE}"/artifacts_for_release
find "${GITHUB_WORKSPACE}"/artifacts/ -name "*.7z" | while read f ; do
p="$(basename "$f")"
cp -v "$f" "${GITHUB_WORKSPACE}/artifacts_for_release/attract-${GITHUB_REF#refs/*/}-${p#attract-}"
done
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Attract Mode Plus ${{ steps.prepare_artifacts.outputs.current_tag }}
draft: true
prerelease: false
files: artifacts_for_release/attract-*.7z