-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (86 loc) · 2.47 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
name: 'Build'
on:
push:
branches: '**'
tags: 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches: 'main'
# workflow_dispatch:
# inputs:
# verbose_build:
# description: 'verbose build process'
# type: boolean
# required: true
# default: false
permissions:
contents: read
jobs:
build:
name: 'Build & Test'
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- ubuntu-20.04
- macos-12
- macos-11
dc:
- dmd-latest
- ldc-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ matrix.dc }}
- name: 'Restore dub packages cache'
id: dub-packages-restore
uses: actions/cache/restore@v4
with:
path: |
~/.dub
key: dub-packages-${{ matrix.os }}-${{ matrix.dc }}-${{ hashFiles('dub.selections.json') }}
- name: 'dub build/lint/test'
run: |
dub_configuration=application
if [[ -x /usr/bin/xcodebuild ]]; then
/usr/bin/xcodebuild -version
xcode_version="$(/usr/bin/xcodebuild -version | awk '/Xcode/ { print int($2) }')"
if [[ $xcode_version -eq 15 ]]; then
dub_configuration="application-xcode$xcode_version"
else
dub_configuration="application-xcode-older"
fi
fi
# if [[ "${{ inputs.verbose_build }}" = "true" ]]; then
# uname -a
# $DC --version
# fi
dub build --compiler=$DC --build=release-debug --config=$dub_configuration # --verbose
dub lint --compiler=$DC --config=$dub_configuration # --verbose
dub test --compiler=$DC --config=$dub_configuration # --verbose
- name: 'Cache dub packages'
uses: actions/cache/save@v4
with:
path: |
~/.dub
key: ${{ steps.dub-packages-restore.outputs.cache-primary-key }}
- name: 'Upload binary'
uses: actions/upload-artifact@v3
with:
name: myrc-${{ matrix.os }}-${{ matrix.dc }}
path: myrc
start-release:
name: 'Schedule release'
needs: [build]
if: ${{ github.ref_type == 'tag' }}
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
steps:
- uses: actions/checkout@v4
- run: gh workflow run release.yml -f version=MYTAG
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}