Skip to content

Commit d3d73ac

Browse files
committed
build releases automatically
1 parent 2274ebd commit d3d73ac

File tree

4 files changed

+131
-0
lines changed

4 files changed

+131
-0
lines changed

.github/workflows/releases.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Upload prebuild binaries
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
nightly:
8+
name: Deploy releases
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
# ubuntu / linux must run on kinda old linux for glibc compatibility!
13+
os: [ubuntu-20.04, windows-latest, macos-latest]
14+
arch: [x86_64]
15+
include:
16+
- os: macos-latest
17+
arch: arm64-apple-macos
18+
arch_short: arm64
19+
cross: "1"
20+
# ARM linux needs to download runtime from ldc, which isn't yet supported with setup-dlang
21+
# - os: ubuntu-20.04
22+
# arch: aarch64-linux-gnu
23+
# arch_short: aarch64
24+
# cross: "1"
25+
runs-on: ${{ matrix.os }}
26+
steps:
27+
- uses: actions/checkout@v2
28+
29+
- id: vars
30+
shell: bash
31+
run: |
32+
if [ -z "${{matrix.arch_short}}" ]; then
33+
echo "arch_short=${{matrix.arch}}" >> $GITHUB_OUTPUT
34+
else
35+
echo "arch_short=${{matrix.arch_short}}" >> $GITHUB_OUTPUT
36+
fi
37+
38+
- name: Install D compiler
39+
uses: dlang-community/setup-dlang@v1
40+
with:
41+
compiler: ldc-latest
42+
43+
- name: Run tests
44+
run: dub test
45+
46+
# Linux release
47+
- name: Build Linux release
48+
run: ./ci/build.sh
49+
if: matrix.os == 'ubuntu-20.04'
50+
env:
51+
ARCH: ${{ matrix.arch }}
52+
BUILD: release
53+
CROSS: ${{ matrix.cross }}
54+
55+
- name: Deploy Linux release
56+
if: matrix.os == 'ubuntu-20.04'
57+
uses: WebFreak001/upload-asset@master
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
OS: linux-${{ steps.vars.outputs.arch_short }}
61+
with:
62+
file: ./sdlfmt.tar.xz
63+
mime: application/x-gtar
64+
name: sdlfmt_${TAG}-${OS}.tar.xz
65+
66+
# OSX release
67+
- name: Build OSX release
68+
run: ./ci/build.sh
69+
if: matrix.os == 'macos-latest'
70+
env:
71+
MACOSX_DEPLOYMENT_TARGET: '10.12'
72+
ARCH: ${{ matrix.arch }}
73+
BUILD: release
74+
CROSS: ${{ matrix.cross }}
75+
76+
- name: Deploy OSX release
77+
if: matrix.os == 'macos-latest'
78+
uses: WebFreak001/upload-asset@master
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
OS: osx-${{ steps.vars.outputs.arch_short }}
82+
with:
83+
file: ./sdlfmt.tar.xz
84+
mime: application/x-gtar
85+
name: sdlfmt_${TAG}-${OS}.tar.xz
86+
87+
# Windows release
88+
- name: Build Windows release
89+
run: .\ci\build.bat
90+
if: matrix.os == 'windows-latest'
91+
env:
92+
BUILD: release
93+
ARCH: ${{ matrix.arch }}
94+
CROSS: ${{ matrix.cross }}
95+
96+
- name: Deploy Windows release
97+
if: matrix.os == 'windows-latest'
98+
uses: WebFreak001/upload-asset@master
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
OS: windows-${{ steps.vars.outputs.arch_short }}
102+
with:
103+
file: ./sdlfmt.zip
104+
mime: application/zip
105+
name: sdlfmt_${TAG}-${OS}.zip
106+
107+
- name: cache dependency binaries
108+
uses: WebFreak001/[email protected]
109+
with:
110+
store: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ sdlfmt.dll
99
libsdlfmt.a
1010
sdlfmt.lib
1111
sdlfmt-test-*
12+
sdlfmt.tar.xz
13+
sdlfmt.zip
1214
*.exe
1315
*.pdb
1416
*.o

ci/build.bat

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@echo on
2+
3+
dub build --compiler=ldc2 --build=%BUILD% --arch=%ARCH%
4+
5+
sdlfmt.exe --help
6+
7+
7z a sdlfmt.zip sdlfmt.exe

ci/build.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
set -e
2+
set -x
3+
4+
dub build --compiler=ldc2 --build=$BUILD --arch=$ARCH
5+
strip sdlfmt
6+
if [ "$CROSS" = 1 ]; then
7+
ls sdlfmt
8+
else
9+
./sdlfmt --help
10+
fi
11+
12+
tar cfJ sdlfmt.tar.xz sdlfmt

0 commit comments

Comments
 (0)