Skip to content

Commit

Permalink
Merge pull request #355 from MSoegtropIMC/fix-snap
Browse files Browse the repository at this point in the history
Snap: enabled snap + smoke test
  • Loading branch information
MSoegtropIMC authored Aug 2, 2023
2 parents 608b792 + b646050 commit d5cb694
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 78 deletions.
153 changes: 79 additions & 74 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,84 +102,89 @@ 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
# but here we really only need the SNAP_PICK one
#
# 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


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
12 changes: 12 additions & 0 deletions linux/example_build_snap_lxd.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions linux/snap/coq_wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"
Expand Down
7 changes: 4 additions & 3 deletions linux/snap/snapcraft.yaml.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: coq-prover
base: core18
base: core20
version: '@@PLATFORM_RELEASE@@'
summary: Coq
description: |
Expand All @@ -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
Expand Down Expand Up @@ -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 ]
Expand Down
2 changes: 1 addition & 1 deletion shell_scripts/init_machine_type.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ case $(uname -m) in
HYPHEN32=
HYPHEN64=-64
;;
arm64)
arm64|aarch64)
BITSIZE=64
HYPHEN32=
HYPHEN64=-64
Expand Down

0 comments on commit d5cb694

Please sign in to comment.