Skip to content

Commit 4717912

Browse files
authored
Merge pull request #5121 from L-TChen/nightly-release
[ workflow, close #4589 ] Release nightly builds officially
2 parents 14311f6 + f83f8cb commit 4717912

5 files changed

Lines changed: 226 additions & 112 deletions

File tree

‎.github/check_agda.sh‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ export PATH=$PWD/bin:$PATH
77

88
if [[ "$OSTYPE" == "darwin"* ]]; then
99
# See https://gitlab.haskell.org/ghc/ghc/-/issues/17418
10+
chmod +w "${PWD}"/lib/*
1011
xattr -rc "${PWD}/bin"
12+
xattr -rc "${PWD}/lib"
13+
chmod -w "${PWD}"/lib/*
1114
fi
1215

13-
echo "The nightly version of Agda is"
1416
agda --version
1517

16-
echo "Checking if Agda nightly is runnable on your system..."
17-
find ./data/lib/prim -name "*.agda" -exec agda -v3 {} \;
18+
echo "\n$(tput bold)Checking if Agda nightly is runnable on your system...$(tput sgr0)"
19+
find ./data/lib/prim -name "*.agda" -exec agda -v2 {} \;
1820

1921
if [ $? -eq 0 ]; then
20-
printf "\n🎉$(tput bold) Agda appears to work.\n"
22+
printf "\n🎉$(tput bold) Agda is working.\n"
2123
printf "Copy the following lines to your shell profile to access the nightly build, e.g. ~/.bashrc or ~/.zshrc$(tput sgr0)\n\n"
2224
printf 'export Agda_datadir=%q\n' "${PWD}/data"
2325
printf 'export PATH=%q:${PATH}\n' "${PWD}/bin"
2426
else
2527
echo "Agda is not working. Bad luck." >&2
2628
exit 1
2729
fi
28-
29-

‎.github/workflows/deploy.yml‎

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
name: Deploy
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build, Test, and Benchmark"]
6+
branches: [master]
7+
types:
8+
- completed
9+
defaults:
10+
run:
11+
shell: bash
12+
jobs:
13+
auto-cancel:
14+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
15+
runs-on: Ubuntu-latest
16+
steps:
17+
- uses: styfle/[email protected]
18+
with:
19+
access_token: ${{ github.token }}
20+
build:
21+
needs: auto-cancel
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
os: [windows-latest, macos-latest, ubuntu-latest]
26+
ghc-ver: [8.10.3]
27+
cabal-ver: [3.2]
28+
29+
env:
30+
ARGS: "--enable-library-stripping --disable-executable-profiling --disable-library-profiling"
31+
# Liang-Ting Chen (2021-01-01):
32+
# Cabal cannot compile statically with text-icu (required by the flag `enable-cluster-counting`),
33+
# see https://github.com/4e6/text-icu-static-example
34+
LINUX_ARGS: "--ghc-options=-split-sections --enable-static --enable-executable-static"
35+
# Liang-Ting Chen (2021-01-01):
36+
# The option `split-sections` is ignored on macOS, see https://gitlab.haskell.org/ghc/ghc/-/issues/11445 for details.
37+
MACOS_ARGS: "--flags=enable-cluster-counting"
38+
WIN64_ARGS: "--ghc-options=-split-sections --flags=enable-cluster-counting"
39+
outputs:
40+
sha: ${{ steps.vars.outputs.sha }}
41+
runs-on: ${{ matrix.os }}
42+
steps:
43+
- name: Check out the master branch
44+
uses: actions/checkout@v2
45+
- name: Set up platform-dependent variables
46+
id: vars
47+
run: |
48+
sha=`echo $(git rev-parse --short=7 HEAD)`
49+
nightly=`echo Agda-nightly`
50+
51+
echo ::set-output name=sha::${sha}
52+
echo ::set-output name=nightly::${nightly}
53+
54+
if [[ "$OSTYPE" == "msys"* ]]; then
55+
echo "::set-output name=args::${ARGS} ${WIN64_ARGS}"
56+
filename="${nightly}-win64.zip"
57+
echo ::set-output name=exe::agda.exe
58+
echo ::set-output name=filename::${filename}
59+
echo ::set-output name=content-type::application/zip
60+
echo "::set-output name=compress-cmd::7z a ${filename} ${nightly} -bb -mx=9"
61+
elif [[ "$OSTYPE" == "darwin"* ]]; then
62+
echo "::set-output name=args::${ARGS} ${MACOS_ARGS}"
63+
filename="${nightly}-macOS.tar.xz"
64+
echo ::set-output name=exe::agda
65+
echo "::set-output name=filename::${filename}"
66+
echo "::set-output name=content-type::application/x-xz"
67+
echo "::set-output name=compress-cmd::tar -a -cvf ${filename} ${nightly}"
68+
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
69+
echo "::set-output name=args::${ARGS} ${MACOS_ARGS}"
70+
filename="${nightly}-linux.tar.xz"
71+
echo ::set-output name=exe::agda
72+
echo "::set-output name=filename::${filename}"
73+
echo "::set-output name=content-type::application/x-xz"
74+
echo "::set-output name=compress-cmd::tar -a -cvf ${filename} ${nightly}"
75+
echo "::set-output name=args::${ARGS} ${LINUX_ARGS}"
76+
fi
77+
- name: Display build variables
78+
run: |
79+
echo nightly=${{ steps.vars.outputs.nightly }}
80+
echo compress-cmd=${{ steps.vars.outputs.compress-cmd }}
81+
echo filename=${{ steps.vars.outputs.filename }}
82+
echo content-type=${{ steps.vars.outputs.content-type }}
83+
echo args=${{ steps.vars.outputs.args }}
84+
85+
- uses: haskell/actions/setup@v1
86+
id: setup-haskell
87+
with:
88+
ghc-version: ${{ matrix.ghc-ver }}
89+
cabal-version: ${{ matrix.cabal-ver }}
90+
91+
- name: Add the path to icu4c to the cabal configuration (macOS)
92+
if: ${{ runner.os == 'macOS' }}
93+
run: |
94+
echo "extra-lib-dirs: /usr/local/opt/icu4c/lib">> ~/.cabal/config
95+
echo "extra-include-dirs: /usr/local/opt/icu4c/include" >> ~/.cabal/config
96+
97+
- name: Install the icu4c library (Windows)
98+
if: ${{ runner.os == 'Windows' }}
99+
env:
100+
ICU_URL: 'https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-Win64-MSVC2017.zip'
101+
ICU_DIR: '/c/icu4c'
102+
ICU_FILE: 'icu4c.zip'
103+
run: |
104+
curl -sSLo ${ICU_FILE} ${ICU_URL}
105+
7z e ${ICU_FILE} -o${ICU_DIR} && rm ${ICU_FILE}
106+
mkdir -p ${ICU_DIR}/include/unicode && mv ${ICU_DIR}/*.h ${ICU_DIR}/include/unicode
107+
108+
echo "extra-lib-dirs: $(cygpath -w ${ICU_DIR})">> ${APPDATA}/cabal/config
109+
echo "extra-include-dirs: $(cygpath -w ${ICU_DIR}/include)" >> ${APPDATA}/cabal/config
110+
111+
- name: Configure the build plan
112+
run: |
113+
cabal configure ${{ steps.vars.outputs.args }}
114+
115+
- uses: actions/cache@v2
116+
name: Cache dependencies
117+
id: cache
118+
with:
119+
path: |
120+
${{ steps.setup-haskell.outputs.cabal-store }}
121+
# A unique cache is used for each stack.yaml.
122+
key: nightly-${{ runner.os }}-ghc-${{ matrix.ghc-ver }}-cabal-${{ hashFiles('**/plan.json') }}
123+
124+
- name: Build dependencies
125+
if: ${{ !steps.cache.outputs.cache-hit }}
126+
run: cabal build exe:agda exe:agda-mode --only-dependencies -v0
127+
128+
- name: Build Agda
129+
uses: nick-invision/retry@v2
130+
# Liang-Ting (2020-12-8):
131+
# Due to a ghc bug on Windows, it is necessary to build Agda twice (or more)
132+
# See:
133+
# - https://github.com/agda/agda/issues/4543
134+
# - https://gitlab.haskell.org/ghc/ghc/-/issues/18634
135+
with:
136+
max_attempts: 3
137+
timeout_minutes: 60
138+
retry_on: error
139+
command: cabal build exe:agda exe:agda-mode
140+
141+
- name: Move artefacts to ${{ steps.vars.outputs.nightly }}
142+
# TODO: Move this part to Makefile
143+
run: |
144+
mkdir -p ${{ steps.vars.outputs.nightly }}/bin
145+
cp -a src/data ${{ steps.vars.outputs.nightly }}
146+
147+
if [[ "$OSTYPE" == "msys"* ]]; then
148+
find dist-newstyle/build \( -name 'agda.exe' -o -name 'agda-mode.exe' \) -type f -exec cp {} ${{ steps.vars.outputs.nightly }}/bin \;
149+
cp -a .github/*.bat ${{ steps.vars.outputs.nightly }}
150+
cp /c/icu4c/icu*.dll ${{ steps.vars.outputs.nightly }}/bin
151+
C:/ProgramData/Chocolatey/bin/strip.exe ${{ steps.vars.outputs.nightly }}/bin/*
152+
else
153+
find dist-newstyle/build \( -name 'agda' -o -name 'agda-mode' \) -type f -exec cp {} ${{ steps.vars.outputs.nightly }}/bin \;
154+
strip ${{ steps.vars.outputs.nightly }}/bin/*
155+
cp -a .github/*.sh ${{ steps.vars.outputs.nightly }}
156+
if [[ "$OSTYPE" == "darwin"* ]]; then
157+
# Change the path to the dynamic library icu4c to the run-time search path:
158+
#
159+
# 1. the same directory of executable, i.e. @executable_path
160+
# 2. @executable_path/../lib
161+
# 3. the default location of system-wide icu4c installed by homebrew, ie. /usr/local/opt/icu4c/lib
162+
#
163+
mkdir ${{ steps.vars.outputs.nightly }}/lib
164+
cp /usr/local/opt/icu4c/lib/libicuuc.67.dylib /usr/local/opt/icu4c/lib/libicui18n.67.dylib /usr/local/opt/icu4c/lib/libicudata.67.dylib ${{ steps.vars.outputs.nightly }}/lib
165+
install_name_tool -change /usr/local/opt/icu4c/lib/libicuuc.67.dylib @rpath/libicuuc.67.dylib ${{ steps.vars.outputs.nightly }}/bin/agda
166+
install_name_tool -change /usr/local/opt/icu4c/lib/libicui18n.67.dylib @rpath/libicui18n.67.dylib ${{ steps.vars.outputs.nightly }}/bin/agda
167+
install_name_tool -add_rpath @executable_path -add_rpath @executable_path/../lib -add_rpath /usr/local/opt/icu4c/lib ${{ steps.vars.outputs.nightly }}/bin/agda
168+
otool -L ${{ steps.vars.outputs.nightly }}/bin/agda
169+
fi
170+
fi
171+
file ${{ steps.vars.outputs.nightly }}/bin/agda
172+
- name: Compress the Agda executable
173+
# UPX does not support macOS Big Sur.
174+
# Liang-Ting Chen (2020-01-04):
175+
# Executables compressed by UPX are not usable on macOS 11 (Big Sur),
176+
#  see https://github.com/upx/upx/issues/424
177+
if: ${{ runner.os != 'macOS' }}
178+
uses: svenstaro/upx-action@v2
179+
with:
180+
file: ${{ steps.vars.outputs.nightly }}/bin/${{ steps.vars.outputs.exe }}
181+
strip: false
182+
- name: Display the version information
183+
run: |
184+
${{ steps.vars.outputs.nightly }}/bin/agda --version
185+
- name: Pack artefacts
186+
run: |
187+
${{ steps.vars.outputs.compress-cmd }}
188+
- uses: actions/upload-artifact@v2
189+
with:
190+
path: ${{ steps.vars.outputs.filename }}
191+
name: ${{ steps.vars.outputs.filename }}
192+
if-no-files-found: error
193+
retention-days: 3
194+
deploy: # release a nightly build if triggered on master }}
195+
if: ${{ github.ref == 'refs/heads/master' }}
196+
needs: build
197+
runs-on: ubuntu-latest
198+
steps:
199+
- uses: actions/checkout@v2
200+
- uses: actions/download-artifact@v2
201+
with:
202+
path: artifacts
203+
- name: Delete the nightly tag if any
204+
uses: dev-drprasad/[email protected]
205+
with:
206+
delete_release: true
207+
tag_name: 'nightly'
208+
env:
209+
GITHUB_TOKEN: ${{ github.token }}
210+
- name: Create a nightly release and upload artifacts as release assets
211+
env:
212+
GITHUB_TOKEN: ${{ github.token }}
213+
run: |
214+
assets=()
215+
for asset in artifacts/**/*; do
216+
assets+=("-a" "$asset")
217+
done
218+
hub release create "${assets[@]}" -m "Nightly Build (${{ needs.build.outputs.sha }}@master)" 'nightly'

‎.github/workflows/nightly.yml‎

Lines changed: 0 additions & 103 deletions
This file was deleted.

‎.github/workflows/test.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- '.github/workflows/cabal.yml'
1212
- '.github/workflows/haddock.yml'
1313
- '.github/workflows/lint.yml'
14-
- '.github/workflows/nightly.yml'
14+
- '.github/workflows/deploy.yml'
1515
- '.github/workflows/stack.yml'
1616
- '.github/workflows/user_manual.yml'
1717
- '.github/workflows/whitespace.yml'

‎README.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ Agda 2
44
[![Hackage version](https://img.shields.io/hackage/v/Agda.svg?label=Hackage)](http://hackage.haskell.org/package/Agda)
55
[![Stackage version](https://www.stackage.org/package/Agda/badge/lts?label=Stackage)](https://www.stackage.org/package/Agda)
66
[![Travis Status](https://travis-ci.org/agda/agda.svg?branch=master)](https://travis-ci.org/agda/agda)
7-
![Test](https://github.com/agda/agda/workflows/Build,%20Test,%20and%20Benchmark/badge.svg?branch=master)
7+
[![Test](https://github.com/agda/agda/workflows/Build,%20Test,%20and%20Benchmark/badge.svg?branch=master)](https://github.com/agda/agda/actions?query=workflow%3A%22Build%2C+Test%2C+and+Benchmark%22)
88
[![Stack Build Status via GH Actions](https://github.com/agda/agda/workflows/stack%20build/badge.svg)](https://github.com/agda/agda/actions?query=workflow%3A%22stack+build%22)
9-
[![nightly build](https://github.com/agda/agda/workflows/nightly%20build/badge.svg?branch=master&event=schedule)](https://github.com/agda/agda/actions?query=workflow%3A%22nightly+build%22+event%3Aschedule)
109
[![Documentation Status](https://readthedocs.org/projects/agda/badge/?version=latest)](http://agda.readthedocs.io/en/latest/?badge=latest)
1110
[![Agda Zulip](https://img.shields.io/badge/zulip-join_chat-brightgreen.svg)](https://agda.zulipchat.com)
1211

0 commit comments

Comments
 (0)