Skip to content

Commit

Permalink
Snap: remove support for snap (too much maintenance effort)
Browse files Browse the repository at this point in the history
  • Loading branch information
MSoegtropIMC committed Aug 12, 2024
1 parent 4a04a4d commit 339e44e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 198 deletions.
95 changes: 0 additions & 95 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,13 @@ on:
description: 'Arguments for the platform script:'
required: true
default: '-extent=x -parallel=p -jobs=2 -large=i -compcert=y -unimath=n -set-switch=y'
snap_pick:
description: 'Package pick for the snap package:'
default: 8.18~2023.11
upload:
description: 'Upload artifact to Snap Store? (true/false, default false)'
default: false

###############################################################################
# Platform script options shared among all jobs
###############################################################################
env:
PLATFORM: -extent=x -parallel=p -jobs=2 -large=i -compcert=y -unimath=n -set-switch=y
COQREGTESTING: y
SNAP_PICK: 8.18~2023.11


###############################################################################
Expand Down Expand Up @@ -104,91 +97,3 @@ jobs:
name: 'Smoke Test Kit ${{matrix.variant}}'
path: smoke-test-kit
retention-days: 5

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@v4

- 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/[email protected]
id: build

- name: Dump snapcraft logs
if: ${{ always() }}
run: cat /home/runner/.local/state/snapcraft/log/*

- name: Save Artifact
uses: actions/upload-artifact@v4
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@v4
id: download-snap
with:
name: 'Snap package'

- name: 'Download smoke test kit'
uses: actions/download-artifact@v4
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
sudo snap alias coq-prover.sertop sertop
- name: 'Run Smoke Test Kit'
run: |
cd ${{steps.download-smoke.outputs.download-path}}
chmod a+x ./run-smoke-test.sh
./run-smoke-test.sh
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ for more on how the Platform is related to the Coq release cycle.
The Coq Platform is based on the OCaml package manager **opam** and provides a set
of scripts to compile and/or install opam, Coq and the platform contents on macOS,
Windows and many Linux distributions in a reliable way with consistent results.
In addition **pre-compiled binary packages** or **installers** are provided for **macOS**,
**Windows** and **snap** for Linux (Docker is in preparation).
In addition **pre-compiled binary packages** or **installers** are provided for **macOS** and
**Windows** (Docker is in preparation). Note that snap for Linux is no longer supported
(the maintenance effort was too high).

The Coq Platform supports installing several versions of Coq - also in parallel,
e.g., for porting developments from one version of Coq to another. For the
Expand Down Expand Up @@ -244,7 +245,7 @@ The current Coq 8.13.2 distribution requires 2.3 GByte on macOS.
- for Windows there is an additional wrapper batch script to setup Cygwin as build and working environment
- for Windows there is in addition a classic Windows installer mostly intended for quick installation by beginners
- for macOS a signed (but currently not yet notarized) DMG package is provided, also mostly intended for beginners
- for Linux snap packages are provided via the Snap Store
- note that snap packages for Windows are **not supported** any more
- it is easy to build variants of the provided installers with modified content
- it is supported to install several versions of Coq in parallel - each will create a separate opam switch - this is intended e.g. for porting Coq developments from older versions of Coq
- system prerequisites are installed using opam depext in a system independent manner
Expand Down Expand Up @@ -355,4 +356,4 @@ It is an intended use case of the Coq Platform to create custom variants, e.g.
for projects or lectures, by creating additional files in the [package_picks](package_picks)
folder.

For details, especially on creating custom installers for macOS, Linux/Snap and Windows see [Customized Installers](doc/FAQ-customized-installers.md).
For details, especially on creating custom installers for macOS and Windows see [Customized Installers](doc/FAQ-customized-installers.md).
13 changes: 0 additions & 13 deletions doc/FAQ-customized-installers.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,6 @@ After you created and built a new package pick, you can create a macOS DMG insta

On recent macOS one can't start the application - that is CoqIDE - without signing the installer. One can still use the installed tools from the command line, though. One can even start coqide from the command line even without signing.

## Creating a custom installer for Snap

After you created a new package pick, you can create a Snap package from it as follows:

- First note that for snap it is **not** required to build the switch first - the snap building process will build it inside of the snapcraft VM.
- Navigate to your Coq Platform git folder, e.g. `cd ~/platform`
- Run `linux/create_snapcraft_yaml.sh -packages=my_new_pick -extent=x -parallel=p -jobs=6 -large=i -compcert=y -set-switch=y -switch=k`
- Run `SNAPCRAFT_BUILD_ENVIRONMENT_CPU=12 SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=24G snapcraft snap` - the CPU (thread) count and memory depends on your machine - you should have 2GB per CPU and you should have twice as many CPU threads as the job count you specified initially.
- Building the snap will take a while.
- You can install the snap with `snap install --dangerous coq-prover_2022-09-0_amd64.snap`.
- The snap file name will not depend on your package pick name.
- You can distribute the `.snap` file and people can install it with the above command.

## Creating a custom installer for Windows

After you created and built a new package pick, you can create a Windows installer from it as follows:
Expand Down
90 changes: 4 additions & 86 deletions doc/README_Linux.md
Original file line number Diff line number Diff line change
@@ -1,90 +1,8 @@
This README presents the two standard methods to install the Coq Platform on Linux:
- as a [binary snap package](#installation-using-snap-package),
- [from sources](#installation-by-compiling-from-sources-using-opam), using the platform scripts.
Note that cause of severe and continuing issues with the snap system we had to drop the support for snap binary installers.
A volunteer for maintaining snap or another Linux binary installer system would be welcome.
On Linux currently the only way to install Coq Platform is to build from sources via scrips.

The first method is recommended for beginners and the second one is recommended for experienced users, who may want to use opam to install additional packages, beyond the standard set provided by the Coq Platform.

# Installation using snap package

This method is intended for beginners.

To install the Coq Platform on a Linux machine which has snap already installed -
which is default on Ubuntu since version 16 and some other but not all Linux distributions -
use the following command:

```
sudo snap install coq-prover
```

In case you don't have snap installed yet, please refer to [installing-snapd](https://snapcraft.io/docs/installing-snapd)

The snap URL is https://snapcraft.io/coq-prover.

This install method has been implemented by Enrico Tassi.

**A note to lecturers:** it is easy to create a customized snap packages from an opam switch - see [Customized Installers](FAQ-customized-installers.md)

**A note to serapi users:** please run the command `sudo snap alias coq-prover.sertop sertop` to make `sertop` accessible without the `coq-prover` prefix

## Package name

The name of the package is `coq-prover` since `coq` was considered
unacceptable by the Snap Store admins (too short and non informative).

## Aliases

The snap package can install binaries in the path, but they are all called
`coq-prover.something` and `something` cannot contain `_`,
but it is possible to request short aliases from the snap team.

As per [request](https://forum.snapcraft.io/t/aliases-request-for-coq-prover/21925)
Coq is granted these short aliases:
- **coqide -> coq-prover.coqide**
- **coq_makefile -> coq-prover.coq-makefile**
- **coqtop -> coq-prover.coqtop**
- **coqc -> coq-prover.coqc**
- **coqdep -> coq-prover.coqdep**
- **coqidetop.opt -> coq-prover.coqidetop**

## Using non aliased tools from the command line

If you want to use more than the aliased tools from the command line, you have two options:

- Run `eval $(coq-prover.env)` in your shell. This will set the environment variables `$PATH`, `$COQLIB` and `$LD_LIBRARY_PATH` in the current shell.
- Run `/snap/coq-prover/current/coq-platform/bin/coq-shell.sh`. This will start a new shell context (which can be closed with `exit`) in which the above variables are set.

## Channels and updates

Each package is available on a channel, which is a combination of track and
risk level.
A track is something like `latest` (the default one) or, `major-version` (as
many packages do).
A risk level is something like `stable`, `beta`, `edge`.

By default users install from `latest/stable`.
The CI script uploads to `latest/edge`, then via a web ui the package
maintainer can promote a package from one level to another.

IMPORTANT: snap packages are *automatically* updated. This means that when *we*
make a new release the package installed by a user *silently* upgrades, no
questions asked!

A user can install from `latest/edge` to test the very last upload, but also,
and more interestingly, from `2021.09/stable` to *never* move to a later version without
consent. This last option makes snap package also usable by developers (and
indeed one finds stuff like `node` or `go` distributed via snap).

CAVEAT: track's creation need to be explicitly requested. The store admins are
happy to grant quickly a new track if it follows the same schema of an existing
one.

## See also

- [Channels](https://snapcraft.io/docs/channels)
- [Process for manual store actions (tracks, aliases)](https://forum.snapcraft.io/t/process-for-aliases-auto-connections-and-tracks/455)
- `linux/snap/github_actions` for a script to trigger a CI build for a platform branch also uploading to the Snap Store

# Installation by compiling from sources using opam
# Installation by compiling from sources using scripts / opam

This method is intended for experienced users, who may want to use opam to install additional packages, beyond the standard set provided by the Coq Platform.

Expand Down
8 changes: 8 additions & 0 deletions linux/SNAP NOT SUPPORTED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Please note that the Coq Platform snap is no longer supported - it is pretty much impossible to build.

- With core22 snap removed the possibility to increase the memory size for the multipass build environment above the default of 2GB.
- See https://snapcraft.io/docs/build-providers, search for "These environmental variables are not supported when building a core22 snap." in the above page.

- LXD has been instable since February 2023 (issues with the terminal connection when running longer time on heavily loaded machines like github runners)

- On Github CI we anyway did run snap without VM since a while since no method worked any more

0 comments on commit 339e44e

Please sign in to comment.