Skip to content

Deploy

Deploy #3

Workflow file for this run

######################################################
## ##
## !!!! 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:
- if: ${{ runner.os == 'macOS' }}
name: Set up for the ICU library (macOS)
run: |
ICU4C="$(brew --prefix)/opt/icu4c"
echo "${ICU4C}/bin" >> "${GITHUB_PATH}"
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}"
- if: ${{ runner.os != 'Windows' }}
name: Determine the ICU version (Linux, macOS)
run: |
uconv --version
ICU_VER="$(uconv --version | sed -ne 's/uconv v.* ICU \([0-9][0-9.]*\)/\1/p')"
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: 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 }}
- if: ${{ runner.os == 'Windows' }}
name: Setup MSYS path (Windows)
run: |
echo "C:\msys64\mingw64\bin;C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
shell: pwsh
- if: ${{ runner.os == 'Windows' }}
name: Install the icu4c library (Windows)
run: |
pacman -v --noconfirm -Sy mingw-w64-x86_64-pkg-config mingw-w64-x86_64-icu
- name: Configure the build plan
run: |
cabal configure ${{ steps.vars.outputs.args }}
- 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' && github.event_name == 'workflow_run'
}}
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: artifacts
- env:
GITHUB_TOKEN: ${{ github.token }}
name: Delete the nightly tag if any
uses: dev-drprasad/delete-tag-and-release@v0.2.0
with:
delete_release: true
tag_name: nightly
- env:
GITHUB_TOKEN: ${{ github.token }}
name: Create a nightly release and upload artifacts as release assets
run: |
assets=()
for asset in artifacts/**/*; do
assets+=("-a" "$asset")
done
hub release create "${assets[@]}" -m "Nightly Build (${{ needs.build.outputs.sha }}@master)" 'nightly'
name: Deploy
'on':
workflow_dispatch: null
workflow_run:
branches:
- master
types:
- completed
workflows:
- Build, Test, and Benchmark