-
Notifications
You must be signed in to change notification settings - Fork 0
226 lines (210 loc) · 9.16 KB
/
deploy.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
######################################################
## ##
## !!!! Autogenerated YAML file, do not edit !!!! ##
## ##
## Edit source in /src/github/workflows/ instead! ##
## ##
######################################################
defaults:
run:
shell: bash
jobs:
auto-cancel:
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion
== 'success' }}
runs-on: Ubuntu-latest
steps:
- uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
build:
env:
ARGS: --disable-executable-profiling --disable-library-profiling
LINUX_ARGS: --enable-executable-static --enable-split-sections
MACOS_ARGS: --flags=enable-cluster-counting
WIN64_ARGS: --flags=enable-cluster-counting --enable-split-sections
if: ${{ always() }}
needs: auto-cancel
outputs:
sha: ${{ steps.vars.outputs.sha }}
runs-on: ${{ matrix.os }}
steps:
- name: Check out the master branch
uses: actions/checkout@v3
- id: vars
name: Set up platform-dependent variables
run: |
sha="$(git rev-parse --short=7 HEAD)"
nightly=Agda-nightly
echo sha="${sha}" >> ${GITHUB_OUTPUT}
echo nightly="${nightly}" >> ${GITHUB_OUTPUT}
if [[ "$OSTYPE" == "msys"* ]]; then
filename="${nightly}-win64.zip"
echo args="${ARGS} ${WIN64_ARGS}" >> ${GITHUB_OUTPUT}
echo compress-cmd="7z a ${filename} ${nightly} -bb -mx=9" >> ${GITHUB_OUTPUT}
echo content-type="application/zip" >> ${GITHUB_OUTPUT}
echo exe="agda.exe" >> ${GITHUB_OUTPUT}
echo filename="${filename}" >> ${GITHUB_OUTPUT}
elif [[ "$OSTYPE" == "darwin"* ]]; then
filename="${nightly}-macOS.tar.xz"
echo args="${ARGS} ${MACOS_ARGS}" >> ${GITHUB_OUTPUT}
echo compress-cmd="tar -a -cvf ${filename} ${nightly}" >> ${GITHUB_OUTPUT}
echo content-type="application/x-xz" >> ${GITHUB_OUTPUT}
echo exe="agda" >> ${GITHUB_OUTPUT}
echo filename="${filename}" >> ${GITHUB_OUTPUT}
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
filename="${nightly}-linux.tar.xz"
echo args="${ARGS} ${LINUX_ARGS}" >> ${GITHUB_OUTPUT}
echo compress-cmd="tar -a -cvf ${filename} ${nightly}" >> ${GITHUB_OUTPUT}
echo content-type="application/x-xz" >> ${GITHUB_OUTPUT}
echo exe="agda" >> ${GITHUB_OUTPUT}
echo filename="${filename}" >> ${GITHUB_OUTPUT}
fi
- name: Display build variables
run: |
echo args = ${{ steps.vars.outputs.args }}
echo compress-cmd = ${{ steps.vars.outputs.compress-cmd }}
echo content-type = ${{ steps.vars.outputs.content-type }}
echo filename = ${{ steps.vars.outputs.filename }}
echo nightly = ${{ steps.vars.outputs.nightly }}
- id: setup-haskell
uses: haskell/actions/setup@v2
with:
cabal-version: ${{ matrix.cabal-ver }}
ghc-version: ${{ matrix.ghc-ver }}
- name: Environment settings based on the Haskell setup
run: |
GHC_VER=$(ghc --numeric-version)
CABAL_VER=$(cabal --numeric-version)
echo "GHC_VER = ${GHC_VER}"
echo "CABAL_VER = ${CABAL_VER}"
echo "GHC_VER=${GHC_VER}" >> "${GITHUB_ENV}"
echo "CABAL_VER=${CABAL_VER}" >> "${GITHUB_ENV}"
- if: ${{ runner.os == 'Windows' }}
name: Install the ICU library (Windows)
run: |
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
pacman -v --noconfirm -Sy mingw-w64-x86_64-pkg-config mingw-w64-x86_64-icu
echo "C:\msys64\mingw64\bin" | Out-File -FilePath "$env:GITHUB_PATH" -Append
shell: pwsh
- if: ${{ runner.os == 'macOS' }}
name: Set up for the ICU library (macOS)
run: |
ICU4C=$(brew --prefix)/opt/icu4c
# echo "${ICU4C}/bin" >> "${GITHUB_PATH}" ## Only needed for uconv
ICU_DIR=${ICU4C}/lib
echo "ICU_DIR=${ICU_DIR}"
echo "ICU_DIR=${ICU_DIR}" >> "${GITHUB_ENV}"
echo "PKG_CONFIG_PATH=${ICU_DIR}/pkgconfig" >> "${GITHUB_ENV}"
- name: Determine the ICU version
run: |
ICU_VER=$(pkg-config --modversion icu-i18n)
echo "ICU_VER=${ICU_VER}"
echo "ICU_VER=${ICU_VER}" >> "${GITHUB_ENV}"
ICU_MAJOR_VER=$(cut -d '.' -f 1 <<< "${ICU_VER}")
echo "ICU_MAJOR_VER=${ICU_MAJOR_VER}"
echo "ICU_MAJOR_VER=${ICU_MAJOR_VER}" >> "${GITHUB_ENV}"
- name: Configure the build plan
run: |
cabal configure ${{ steps.vars.outputs.args }}
cabal build --dry-run
- id: cache
name: Cache dependencies
uses: actions/cache@v3
with:
key: deploy.yml-${{ runner.os }}-ghc-${{ env.GHC_VER }}-cabal-${{ env.CABAL_VER
}}-${{ hashFiles('**/plan.json') }}
path: ${{ steps.setup-haskell.outputs.cabal-store }}
restore-keys: deploy.yml-${{ runner.os }}-ghc-${{ env.GHC_VER }}-cabal-${{
env.CABAL_VER }}-
- if: ${{ !steps.cache.outputs.cache-hit }}
name: Build dependencies
run: cabal build exe:agda exe:agda-mode --only-dependencies
- name: Build Agda
run: cabal build exe:agda exe:agda-mode
- env:
DLL: /c/msys64/mingw64/bin/libicu*.dll
name: Move artefacts to ${{ steps.vars.outputs.nightly }}
run: |
nightly="${{ steps.vars.outputs.nightly }}"
mkdir -p "${nightly}"/bin
cp -a src/data "${nightly}"
if [[ "$OSTYPE" == "msys"* ]]; then
find dist-newstyle/build \( -name 'agda.exe' -o -name 'agda-mode.exe' \) -type f -exec cp {} "${nightly}"/bin \;
cp -a .github/*.bat "${nightly}"
cp ${DLL} "${nightly}"/bin/
C:/ProgramData/Chocolatey/bin/strip.exe "${nightly}"/bin/*
else
find dist-newstyle/build \( -name 'agda' -o -name 'agda-mode' \) -type f -exec cp {} "${nightly}"/bin \;
strip "${nightly}"/bin/*
cp -a .github/*.sh "${nightly}"
if [[ "$OSTYPE" == "darwin"* ]]; then
# Change the path to the dynamic library icu4c to the run-time search path:
#
# 1. the same directory of executable, i.e. @executable_path
# 2. @executable_path/../lib
# 3. the default location of system-wide icu4c installed by homebrew, ie. /usr/local/opt/icu4c/lib
#
mkdir "${nightly}"/lib
cp ${ICU_DIR}/libicuuc.${ICU_MAJOR_VER}.dylib ${ICU_DIR}/libicui18n.${ICU_MAJOR_VER}.dylib ${ICU_DIR}/libicudata.${ICU_MAJOR_VER}.dylib "${nightly}"/lib
install_name_tool -change ${ICU_DIR}/libicuuc.${ICU_MAJOR_VER}.dylib @rpath/libicuuc.${ICU_MAJOR_VER}.dylib "${nightly}"/bin/agda
install_name_tool -change ${ICU_DIR}/libicui18n.${ICU_MAJOR_VER}.dylib @rpath/libicui18n.${ICU_MAJOR_VER}.dylib "${nightly}"/bin/agda
install_name_tool -add_rpath @executable_path -add_rpath @executable_path/../lib -add_rpath ${ICU_DIR} "${nightly}"/bin/agda
otool -L "${nightly}"/bin/agda
fi
fi
file ${{ steps.vars.outputs.nightly }}/bin/agda
- if: ${{ runner.os != 'macOS' }}
name: Compress the Agda executable
uses: svenstaro/upx-action@v2
with:
file: ${{ steps.vars.outputs.nightly }}/bin/${{ steps.vars.outputs.exe }}
strip: false
- name: Display the version information
run: |
${{ steps.vars.outputs.nightly }}/bin/agda --version
- name: Pack artefacts
run: |
${{ steps.vars.outputs.compress-cmd }}
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: ${{ steps.vars.outputs.filename }}
path: ${{ steps.vars.outputs.filename }}
retention-days: 3
strategy:
fail-fast: false
matrix:
cabal-ver:
- '3.8'
ghc-ver:
- '9.4'
os:
- windows-latest
- macos-latest
- ubuntu-20.04
deploy:
if: ${{ github.ref == 'refs/heads/master' }}
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
path: artifacts
- env:
GITHUB_TOKEN: ${{ github.token }}
name: Create/replace the nightly release and upload artifacts as release assets
run: |
gh release delete 'nightly' --repo agda/agda --cleanup-tag --yes || true
ls -R artifacts
gh release create 'nightly' artifacts/**/* --repo agda/agda --generate-notes --title "Nightly Build (${{ needs.build.outputs.sha }}@master)"
name: Deploy
'on':
workflow_dispatch: null
workflow_run:
branches:
- master
types:
- completed
workflows:
- Build, Test, and Benchmark