Skip to content

Deploy

Deploy #13

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:
- 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: latest
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:
ghc-ver:
- '9.6'
include:
- ghc-ver: '9.4'
os: ubuntu-20.04
os:
- windows-latest
- macos-latest
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 --notes-start-tag v2.6.3 --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