diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index a5cbb02a10..f14a7e3308 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -102,45 +102,50 @@ jobs: path: smoke-test-kit retention-days: 5 - # Ubuntu_snap: - # name: Snap package - # runs-on: ubuntu-latest - - # steps: - # - name: Git checkout - # uses: actions/checkout@v2 - - # - name: Set PLATFORM - # if: ${{ github.event.inputs.platform != '' }} - # run: echo "PLATFORM=${{ github.event.inputs.platform }}" >> $GITHUB_ENV - - # - name: Set SNAP_PICK - # if: ${{ github.event.inputs.snap_pick != '' }} - # run: echo "SNAP_PICK=${{ github.event.inputs.snap_pick }}" >> $GITHUB_ENV - - # - name: Generate snapcraft file - # run: linux/create_snapcraft_yaml.sh -packages=$SNAP_PICK $PLATFORM - - # - name: Print snapcraft file - # run: cat snap/snapcraft.yaml - - # - name: Run snapcraft - # uses: snapcore/action-build@v1.1.2 - # id: build - - # - name: Save Artifact - # uses: actions/upload-artifact@v2 - # with: - # name: 'Snap package' - # path: ${{ steps.build.outputs.snap }} - - # - name: Upload Artifact to the Snap Store - # if: ${{ github.event.inputs.upload }} - # uses: snapcore/action-publish@v1 - # with: - # store_login: ${{ secrets.STORE_LOGIN }} - # snap: ${{ steps.build.outputs.snap }} - # release: edge + Ubuntu_snap: + name: Snap package + # Since we build the snap with --destructive-mode, the runner version must match the snap core version + runs-on: ubuntu-20.04 + + steps: + - name: Git checkout + uses: actions/checkout@v2 + + - name: Set PLATFORM + if: ${{ github.event.inputs.platform != '' }} + run: echo "PLATFORM=${{ github.event.inputs.platform }}" >> $GITHUB_ENV + + - name: Set SNAP_PICK + if: ${{ github.event.inputs.snap_pick != '' }} + run: echo "SNAP_PICK=${{ github.event.inputs.snap_pick }}" >> $GITHUB_ENV + + - name: Generate snapcraft file + run: linux/create_snapcraft_yaml.sh -packages=$SNAP_PICK $PLATFORM + + - name: Print snapcraft file + run: cat snap/snapcraft.yaml + + - name: Run snapcraft + uses: MSoegtropIMC/action-snapcraft-build@v1.1.2-dm + id: build + + - name: Dump snapcraft logs + if: ${{ always() }} + run: cat /home/runner/.local/state/snapcraft/log/* + + - name: Save Artifact + uses: actions/upload-artifact@v2 + with: + name: 'Snap package' + path: ${{ steps.build.outputs.snap }} + + - name: Upload Artifact to the Snap Store + if: ${{ github.event.inputs.upload }} + uses: snapcore/action-publish@v1 + with: + store_login: ${{ secrets.STORE_LOGIN }} + snap: ${{ steps.build.outputs.snap }} + release: edge # We run this one always because the Ubuntu_platform job # has a matrix and contains the flaky dev job @@ -148,38 +153,38 @@ jobs: # # In any case the job will fail fast if it can't download # the snap or the smoke test - # Ubuntu_smoke: - # name: Snap package smoke test - # if: ${{ always() }} - # needs: [Ubuntu_platform, Ubuntu_snap] - # runs-on: ubuntu-latest - - # steps: - - # - name: Set SNAP_PICK - # if: ${{ github.event.inputs.snap_pick != '' }} - # run: echo "SNAP_PICK=${{ github.event.inputs.snap_pick }}" >> $GITHUB_ENV - - # - name: Download Artifact - # uses: actions/download-artifact@v2 - # id: download-snap - # with: - # name: 'Snap package' - - # - name: 'Download smoke test kit' - # uses: actions/download-artifact@v2 - # id: download-smoke - # with: - # name: 'Smoke Test Kit ${{ env.SNAP_PICK }}' - - # - name: 'Install Snap' - # run: | - # sudo snap install --dangerous ${{ steps.download-snap.outputs.download-path }}/coq-prover_*.snap - # sudo snap alias coq-prover.coqc coqc - - # - name: 'Run Smoke Test Kit' - # run: | - # cd ${{steps.download-smoke.outputs.download-path}} - # chmod a+x ./run-smoke-test.sh - # ./run-smoke-test.sh - \ No newline at end of file + + Ubuntu_smoke: + name: Snap package smoke test + if: ${{ always() }} + needs: [Ubuntu_platform, Ubuntu_snap] + runs-on: ubuntu-latest + + steps: + + - name: Set SNAP_PICK + if: ${{ github.event.inputs.snap_pick != '' }} + run: echo "SNAP_PICK=${{ github.event.inputs.snap_pick }}" >> $GITHUB_ENV + + - name: Download Artifact + uses: actions/download-artifact@v2 + id: download-snap + with: + name: 'Snap package' + + - name: 'Download smoke test kit' + uses: actions/download-artifact@v2 + id: download-smoke + with: + name: 'Smoke Test Kit ${{ env.SNAP_PICK }}' + + - name: 'Install Snap' + run: | + sudo snap install --dangerous ${{ steps.download-snap.outputs.download-path }}/coq-prover_*.snap + sudo snap alias coq-prover.coqc coqc + + - name: 'Run Smoke Test Kit' + run: | + cd ${{steps.download-smoke.outputs.download-path}} + chmod a+x ./run-smoke-test.sh + ./run-smoke-test.sh diff --git a/linux/example_build_snap_lxd.sh b/linux/example_build_snap_lxd.sh new file mode 100755 index 0000000000..2ad4a29bbd --- /dev/null +++ b/linux/example_build_snap_lxd.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# This is an example for building a snap locally using LXD as virtualization solution +# Run this script from the Coq platform root folder via linux/build_snap.sh + +# This assumes you did +# sudo snap install lxd +# sudo lxd init --minimal + +linux/create_snapcraft_yaml.sh -packages="8.17~2023.03+beta1" -extent=b -parallel=p -jobs=4 -large=e -switch=k -set-switch=y +SNAPCRAFT_BUILD_ENVIRONMENT=lxd snapcraft clean +SNAPCRAFT_BUILD_ENVIRONMENT=lxd SNAPCRAFT_BUILD_ENVIRONMENT_CPU=6 SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=12G snapcraft snap diff --git a/linux/snap/coq_wrapper b/linux/snap/coq_wrapper index 63d3b99e8e..144e48b948 100755 --- a/linux/snap/coq_wrapper +++ b/linux/snap/coq_wrapper @@ -6,12 +6,15 @@ export COQBIN="$(cd $(dirname $0); pwd)" export COQLIB="$(cd $(dirname $0)/../lib/coq/; pwd)" +COQSTUBLIBS="$(cd $(dirname $0)/../lib/stublibs/; pwd)" SELF="$(basename $1)" shift # drop $1 # this path also contains coq extra utilities like gappa export PATH="$COQBIN:$PATH" +# this folder contains shared libraries like libz3.so +export LD_LIBRARY_PATH="$COQSTUBLIBS:$LD_LIBRARY_PATH" if [ "$SELF" == "bash" -o "$SELF" == "sh" ]; then # for debugging the snap exec $SELF "$@" diff --git a/linux/snap/snapcraft.yaml.in b/linux/snap/snapcraft.yaml.in index f7540e41ce..5265bd42db 100644 --- a/linux/snap/snapcraft.yaml.in +++ b/linux/snap/snapcraft.yaml.in @@ -1,5 +1,5 @@ name: coq-prover -base: core18 +base: core20 version: '@@PLATFORM_RELEASE@@' summary: Coq description: | @@ -11,7 +11,7 @@ confinement: strict parts: coq: plugin: nil - build-packages: [build-essential, curl, m4, unzip, git] + build-packages: [build-essential, curl, m4, unzip, git, libstdc++-7-dev] stage-packages: [make, libmpfr6, libgmp10] source: . source-type: local @@ -76,7 +76,8 @@ apps: - unity7 - wayland - x11 - extensions: [gnome-3-28] + # See https://snapcraft.io/docs/supported-extensions for a core/extension version matrix + extensions: [gnome-3-38] coqtop: plugs: [home] command-chain: [ coq-platform/bin/coq_wrapper ] diff --git a/shell_scripts/init_machine_type.sh b/shell_scripts/init_machine_type.sh index f764e2a1be..f2d266ddf7 100755 --- a/shell_scripts/init_machine_type.sh +++ b/shell_scripts/init_machine_type.sh @@ -25,7 +25,7 @@ case $(uname -m) in HYPHEN32= HYPHEN64=-64 ;; - arm64) + arm64|aarch64) BITSIZE=64 HYPHEN32= HYPHEN64=-64