GithubHelp home page GithubHelp logo

ocaml / setup-ocaml Goto Github PK

View Code? Open in Web Editor NEW
188.0 8.0 35.0 44.9 MB

GitHub Action for the OCaml programming language

Home Page: https://ocaml.org/

License: MIT License

TypeScript 96.14% JavaScript 2.60% Shell 1.27%
ocaml github-actions

setup-ocaml's Introduction

Set up OCaml

Main workflow CodeQL

STATUS: STABLE

Set up an OCaml and opam environment in GitHub Actions and add to PATH.

Usage

Example workflow

Consult the Hello World OCaml Action that uses Dune and opam to build a simple library.

It's possible to feed different values to the input depending on the platform of the runner. The syntax of GitHub's workflows is flexible enough to offer several methods to do this.

name: Builds, tests & co

on:
  pull_request:
  push:
  schedule:
    # Prime the caches every Monday
    - cron: 0 1 * * MON

permissions: read-all

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        os:
          - macos-latest
          - ubuntu-latest
          - windows-latest
        ocaml-compiler:
          - "5.1"

    runs-on: ${{ matrix.os }}

    steps:
      - name: Checkout tree
        uses: actions/checkout@v4

      - name: Set-up OCaml ${{ matrix.ocaml-compiler }}
        uses: ocaml/setup-ocaml@v2
        with:
          ocaml-compiler: ${{ matrix.ocaml-compiler }}

      - run: opam install . --deps-only --with-test

      - run: opam exec -- dune build

      - run: opam exec -- dune runtest

Versioning

The actions are downloaded and run from the GitHub graph of repositories. The workflow references an action using a ref.

Note

Binding to a major version is the latest of that major version (e.g. v2 = 2.*) Major versions should guarantee compatibility. A major version can add net new capabilities but should not break existing input compatibility or break existing workflows.

- name: Set-up OCaml ${{ matrix.ocaml-compiler }}
  uses: ocaml/setup-ocaml@v2
  #                      ^^^
  with:
    ocaml-compiler: ${{ matrix.ocaml-compiler }}

Warning

Do not reference master since that is the latest code and can be carrying breaking changes of the next major version.

Major version binding allows you to take advantage of bug fixes, critical functionality and security fixes. The master branch has the latest code and is unstable to bind to since changes get committed to the master and released by creating a tag.

steps:
  # Reference the major version of a release (most recommended)
  - uses: ocaml/setup-ocaml@v2
  # Reference a specific commit (most strict)
  - uses: ocaml/setup-ocaml@<SHA>
  # Reference a semver version of a release (not recommended)
  - uses: ocaml/[email protected]
  # Reference a branch (most dangerous - do not do this)
  - uses: ocaml/setup-ocaml@master

Inputs

Name Required Description Type Default
ocaml-compiler Yes The OCaml compiler packages to initialise. Consult the supported version syntax section. string
opam-repositories No The name and URL pair of the repository to fetch the packages from. string
opam-pin No Enable the automation feature for opam pin. bool true
opam-depext No Enable the automation feature for opam depext. bool true
opam-depext-flags No The flags for the opam depext command. The flags must be separated by the comma. string
opam-local-packages No The local packages to be used by opam-pin or opam-depext. Consult the @actions/glob documentation package for supported patterns. string *.opam
opam-disable-sandboxing No Disable the opam sandboxing feature. bool false
dune-cache No Enable the dune cache feature. This feature requires dune 2.8.5 or later on the Windows runners. bool false
cache-prefix No The prefix of the cache keys. string v1
allow-prerelease-opam No Allow to use a pre-release version of opam. bool false

Supported version syntax

The ocaml-compiler input supports the Semantic Versioning Specification, for more detailed examples please refer to the documentation.

Note

With the naughty exception of 4.02.2, point releases are meant to be strictly compatible, so once we (OCaml dev team) release a new point release, upgrading should be a no-brainer.

Examples:

  • Exact package name: ocaml-base-compiler.5.1.0, ocaml-variants.4.14.0+mingw64c
  • Combine multiple packages: ocaml-variants.5.1.0+options,ocaml-option-flambda,ocaml-option-musl,ocaml-option-static
  • Minor versions: 4.08, 4.14, 5.1, 5.1.x
  • More specific versions: ~4.02.2, 5.1.0,

Advanced Configurations

Consult the examples page for more complex patterns.

Extends

STATUS: EXPERIMENTAL

Note

All extends are recommended to be used in separate jobs run on ubuntu-latest.

Automatically updating the actions with Dependabot

Consult the Configuring Dependabot version updates page and set .github/dependabot.yml as described below to allow Dependabot to update the actions automatically.

version: 2
updates:
  - package-ecosystem: github-actions
    directory: /
    schedule:
      interval: weekly

Note

Renovate is also available for free as a third-party tool, which is much more flexible than Dependabot - depending on the project and your preferences. If you just want to automate GitHub Actions updates, Dependabot is good enough.

Roadmap

This action aims to provide an OS-neutral interface to opam, and so will not add features that only work on one operating system. It will also track the latest stable release of opam.

Support

Please feel free to post to the discuss.ocaml.org forum with any questions you have about this action.

Previous discussions include:

setup-ocaml's People

Contributors

aantron avatar avsm avatar dependabot[bot] avatar dra27 avatar favonia avatar giltho avatar hikaruegashira avatar ivg avatar khady avatar leostera avatar misterda avatar phated avatar psafont avatar rivy avatar smorimoto avatar tmattio avatar toku-sa-n avatar tyoverby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

setup-ocaml's Issues

Question: docker

I'm have a deep knowledge in various CIs but it seems that setup-ocaml have issues with compilation speed (caching) and it should be possible to fix using custom docker image. Can yo mention in README either

  1. using ocaml-setup + docker is not possible and some reasons about it
  2. how to use docker + ocaml-setup (or at least a link to a decent tutorial). I have issues with googling tutorial that I can understand. Although my intuition says that if using ocaml-setup+docker would be possible, you mentioned that in a README

List of supported Ubuntu versions?

Hi! Thank you for creating and maintaining this great project!

It would be great to see the list of Ubuntu versions that are currently supported (I hope I didn't miss it).
Right now I only see ubuntu-latest which is Ubuntu 18.04 at the time of writing, but what about 16.04 and 20.04?

Perhaps seeing the versions of the other OSes would be also useful.

Custom compiler options for ocaml >= 4.12

Trying to specify an ocaml-version of 4.12.0+flambda in the action does not work (whereas 4.11.2+flambda works).

As far as I know, it's because opam has changed a bit how compiler options are handled since ocaml 4.12, more specifically, whereas before there was packages for the ocaml compiler such as 4.11.2+flambda or 4.11.2+32bit, they are no longer present for 4.12.0, instead being replace by a package 4.12.0+options as well as individual packages for each configuration option. The recommended (or at least one) way to create such switches is now:

opam switch create test ocaml-variants.4.12.0+options ocaml-option-32bit

However, since when one uses the setup-ocaml action, one does not create the switch manually, what should one specify in ocaml-version to get say, a 4.12.0 compiler with flambda enabled ? (or with the 32-bit option, which although still targeting 64-bit architectures, seems the easiest way to check that sources will compile on 32-bit distributions)

Clearer README

Some brief usage example should come first in the README, along with only keywords like "caching" and "including Windows support." The details of everything setup-ocaml does should come nearly last, in some kind of reference section.

The current README doesn't "sell" the action. A reader coming to the repo doesn't know what using this action really entails from the reader's point of view. Is it difficult? Is it neat?

setup-ocaml started failing on macOS-10.15

Our scheduled github workflow started failing today with the following error:

  ==> Installing mercurial dependency: [email protected]
  ==> Pouring [email protected]
  Error: The `brew link` step did not complete successfully
  The formula built, but is not symlinked into /usr/local
  Could not symlink bin/2to3
  Target /usr/local/bin/2to3
  already exists. You may want to remove it:
    rm '/usr/local/bin/2to3'
  
  To force the link and overwrite all conflicting files:
    brew link --overwrite [email protected]
  
  To list all files that would be deleted:
    brew link --overwrite --dry-run [email protected]
  
  Possible conflicting files are:
  /usr/local/bin/2to3 -> /Library/Frameworks/Python.framework/Versions/2.7/bin/2to3

It was working fine yesterday. Workflow file: https://github.com/kind2-mc/kind2/blob/develop/.github/workflows/kind2-nightly.yml#L79

Support opam lock file

I'm trying to set up a workflow that uses the dependencies specified by an .opam.locked file in the repository instead of using the unlocked .opam file directly. However this silently doesn't work correctly since the opam-pin input of the action causes the local package to be pinned unlocked. A subsequent job step opam install . --deps-only --locked therefore doesn't install the locked dependencies but the pinned unlocked ones, despite the --locked argument.

I think there are currently two workarounds:

  1. Make opam-pin input use lock file using environment variable by adding the following to this action's step:

    env:
      OPAMLOCKED: locked
  2. Disable opam-pin, such that installing with --locked actually uses the lock file? In my case this seems to make the opam-depext substep fail because it's then trying to install the depexts for the package with the same name actually published in opam repository, which is outdated and incompatible with the development version to run the workflow on.

    Even if it were compatible, it wouldn't still install depexts for locked depopts.

Maybe it makes sense to have an opam-locked input to this action (defaulting to false), which would properly make this action consider the opam lock file without having to manipulate the environment and still allow opam-pin and opam-depext substeps to work as expected.
Currently it can be surprising that even by using --locked in a subsequent step, the lock file isn't actually used and the reproducibility of the reproducible build isn't thus checked. Also this subtlety with opam lock files isn't mentioned in the README, so one has to dig deep to realize this.

Add support for ocaml-system

I want to compile and install a C++ application using opam so I need opam but can skip installing OCaml.
It looks like that OCaml versions specified in yml file are passed in opam switch command directly and I can't say system instead of compiler version. Can you clarify this part of README?

Error: utimes: C:\Users\runneradmin\Local Settings\Cache\dune\db\beacon: on windows-latest, 4.04.2 with dune cache enabled

We are hitting a failure when dune-cache = true on windows-latest and compiler version 4.04.2.

You can see the run here: https://github.com/ocaml/omd/pull/241/checks?check_run_id=2701390163

Disabling dune-cache resolves the problem: https://github.com/ocaml/omd/pull/241/checks?check_run_id=2701410082

Perhaps this is just a limitation to document? (I didn't see mention of it in the readme).

Thanks for the excellent work!

something is wrong with SSL certificates on windows ?

Hi,

I got an error with ezcurl only on windows CI, it's here.

I believe you can reproduce it with a simple:

let () =
  match Ezcurl.get ~url:"https://archive.softwareheritage.org/api/1/content/sha1_git:7bdf38d4468c114206c9b6ebd9cf1176e085d346/" () with
  | Error (code, msg) ->
    Format.eprintf "curl error: code `%s` (%s)@." (Curl.strerror code) msg
  | Ok _response ->
    Format.printf "OK@."

set-env and add-path are deprecated warnings

This is something I started getting from GitHub Actions recently:

Run avsm/setup-ocaml@v1
  with:
    ocaml-version: 4.09.1

Warning: The `set-env` command is deprecated and will be disabled soon.
Please upgrade to using Environment Files.
For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

Warning: The `add-path` command is deprecated and will be disabled soon.
Please upgrade to using Environment Files.
For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

`dune: command not found` in runsvc.sh mode

I ran the self-hosted github action as issues-42 mentioned.

I found that it works well in the front end terminal, but if I make it as a backend service by running ./svc.sh start (refer), and if failed with log

Run dune external-lib-deps --missing @@default
/home/piv/actions-runner/_work/_temp/03de7349-c990-4f01-bfb7-2c712b5b273d.sh: line 1: dune: command not found
Error: Process completed with exit code 127.

ubuntu: 404 on depext install

I'm experiencing errors when installing packages on ubuntu (latest and 18.04):

The following command needs to be run through "sudo":
    apt-get install -qq -yy libasound2-dev libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxi-dev libxrandr-dev m4 mesa-common-dev pkg-config xorg-dev
E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/x/xorg-server/xserver-xorg-dev_1.19.6-1ubuntu4.7_amd64.deb  404  Not Found [IP: 52.147.219.192 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
OS package installation failed
Error: Process completed with exit code 1.

More details hre: https://github.com/tjammer/raylib-ocaml/runs/1506085611

It seems similar to this issue actions/runner-images#2155 where they could fix it by running apt-get update before downloading.

Can this be fixed in my workflow file (https://github.com/tjammer/raylib-ocaml/blob/master/.github/workflows/main.yml) or in this Action?

OCaml versions are not set correctly

It seems that setup-ocaml is always using the latest version of OCaml, no matter which version is passed in ocaml-version. See this run for instance: https://github.com/rgrinberg/opium/runs/1465857399

The OCaml version setup by the setup-ocaml is 4.10.1, but the next step, which prints the version of the compiler with opam exec -- ocaml --version, tell us that we're still using 4.11.1.

I don't think I'm doing anything special, apart from caching the ~/opam directory, but the key is set to v1-${{ runner.os }}-opam-${{ matrix.ocaml-version }}-, so it should not have an impact on the OCaml version.

EDIT: I disabled the cache, and the OCaml version is set correctly, so it seems related to caching ~/opam. Since the key depends on the ocaml version, the only difference I see is the use of opam switch set ... vs opam switch create .... Is it possible the former does not set the environment correctly for the next steps?

setup-ocaml does not work with switches anymore

If I correctly understand the message "Current switch has been selected based on the current directory.", the reason my workflow started failing when I updated this action to version v2 is because there's some sort of fancy magic that this action is doing to cache/pin the specified switch in the current directory. This means that I can't use opam switch to manage compilation across multiple versions of OCaml because opam install will always select the directory switch rather than the environment one, making it impossible to install packages on the new switch without doing something kludgy like cd /tmp. Please add an option to disable this behavior and make v2 behave like v1 with regard to switches, and also clearly label somewhere this counterintuitive inability to install packages to the current global switch.

Compile msvc64 variant but pick a specific compiler

Hello,

I need to get an OCaml version (I am not picky here, any version can make it) which would be compiled with the same msvc64 as the current Python version selected in my GitHub Actions. The msvc64c version (almost) doesn't break right away, before flexlink fails reading object files compiled with the msvc64 used by Python.

To put some context, I am compiling a Python library wrapped around an OCaml library, I have been doing quite some manual processing in the past to get it done with Windows, so I know it ends up working, but the challenge now is to get it functional in GitHub Actions.

What would be the proper way to setup the environment before the ./configure script is run? It is actually a bit hard to find the compiler, but it seems it is here for Python 3.9:

'C:\\Program\ Files\ (x86)\\Microsoft\ Visual\ Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe'

Running setup-ocaml locally with nektos/act

Hi, I'm trying to use setup-ocaml with https://github.com/nektos/act which lets me run GH Actions locally. However, I get the following error message for the "Retrieve the opam cache" part:

::error::Parameter token or opts.auth is required

Here is the full output:

$ act
[Build/build-1] ๐Ÿงช  Matrix: map[ocaml-compiler:4.12.0 os:ubuntu-20.04]
[Build/build-1] ๐Ÿš€  Start image=catthehacker/ubuntu:act-20.04
[Build/build-1]   ๐Ÿณ  docker run image=catthehacker/ubuntu:act-20.04 platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Build/build-1]   ๐Ÿณ  docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root
[Build/build-1]   ๐Ÿณ  docker cp src=/Users/anton/zilliqa/scilla-tla/. dst=/Users/anton/zilliqa/scilla-tla
[Build/build-1]   ๐Ÿณ  docker exec cmd=[mkdir -p /Users/anton/zilliqa/scilla-tla] user=
[Build/build-1] โญ  Run Checkout code
[Build/build-1]   โœ…  Success - Checkout code
[Build/build-1] โญ  Run Use OCaml ${{ matrix.ocaml-version }}
INFO[0001]   โ˜  git clone 'https://github.com/ocaml/setup-ocaml' # ref=v2
[Build/build-1]   ๐Ÿณ  docker cp src=/Users/anton/.cache/act/ocaml-setup-ocaml@v2/ dst=/var/run/act/actions/ocaml-setup-ocaml@v2/
[Build/build-1]   ๐Ÿณ  docker exec cmd=[mkdir -p /var/run/act/actions/ocaml-setup-ocaml@v2/] user=
[Build/build-1]   ๐Ÿณ  docker exec cmd=[node /var/run/act/actions/ocaml-setup-ocaml@v2/dist/index.js] user=
[Build/build-1]   โ“  ::group::Retrieve the opam cache
[Build/build-1]   โ—  ::error::Parameter token or opts.auth is required
[Build/build-1]   โŒ  Failure - Use OCaml ${{ matrix.ocaml-version }}
Error: exit with `FAILURE`: 1

PS Sorry if this is not the right place for this issue.

pin the version of opam installed

We currently have various versions of opam installed as we depend on the host package manager. We could simply publish the installed version of opam as an output key in the workflow, in case that matters.

Beta versions of the compiler support could be improved

With the following workflow file: https://github.com/ocaml/merlin/blob/56e0601ad40995421ae9e3537158af30559fb65f/.github/workflows/main.yml

 ocaml-compiler:
          - 4.13.0~beta1

Is not understood as a valid compiler version and will instead expect it to be a package name, which makes opam fail with:

> Install OCaml
  /opt/hostedtoolcache/opam/2.0.9/x86_64/opam switch create . --no-install --packages 4.13.0~beta1
  opam: option `--packages': invalid element in list (`4.13.0~beta1'): Invalid
        character in package name "4.13.0~beta1"
  am switch [OPTION]... [COMMAND] [ARG]...
  Try `opam switch --help' or `opam --help' for more information.
  Error: The process '/opt/hostedtoolcache/opam/2.0.9/x86_64/opam' failed with exit code 2

This is a valid version string for opam and expliciting ocaml-base-compiler.4.13.0~beta1 shouldn't be required.

Install depexts before creating the switch

When using the v2 of the action, and an ocaml-version (or rather a list of base packages for a switch) that targets 32bits executables (e.g. 4.11.2+32bit, or ocaml-variants.4.12.0+options,ocaml-option-32bit), the build of the compiler fails (see https://github.com/Gbury/dolmen/pull/62/checks?check_run_id=2235477332 ).

From what I can tell, this is because in such a case, we need to install gcc-mutlilib (which is correctly listed as a depext of ocaml-option-32bit) before creating the switch, since the compilation of the compiler (and thus the creation of the switch) requires it. That means that in the list of steps mentioned here, there would be a need to run opam depext before creating the switch (in addition to the current process where it is run last), which I presume would mean requiring opam >= 2.1 with depext builtin, since before creating the switch we won't be able to install depext via opam.

Weird error on MacOSX: dune: cannot execute binary file

(of course I choose to try github-actions for the first time when all that crazy stuff seems to be happening with MacOS, and I don't have a mac to try at home :) )

A job that works on Ubuntu, after installing things with opam fails with:

>  Run opam exec -- dune --version
/Users/runner/.opam/4.09.1/bin/dune: /Users/runner/.opam/4.09.1/bin/dune: cannot execute binary file
Error: Process completed with exit code 126.

https://github.com/smondet/TZComet/runs/1398043114?check_suite_focus=true

support dependency caching

We can't do action caching right now since the Windows/cygwin/fdopen one fails when using an opam local switch. Once local switches work there, it should be possible to create an _opam directory and cache that for the dependencies.

Bad checksum error, with and without opam update

I posted an issue to opam repository about problems installing dependencies in the context of a github action after using setup-ocaml.

I'm not sure if it is an issue with opam or with this action, so I just wanted to put the issue here as well: ocaml/opam-repository#19474.

If this isn't the correct place for it, let me know and I will close the issue. Thanks!

Reduce setup time

This is a super helpful utility to have in the ecosystem. However, I notice that setup actions for other languages such as Java and Rust are several orders of magnitude faster (they are in the order of seconds, while we are often pushing 10 minutes or so).

I wonder if there is anything essential about the way opam is distributed that prevents us being able to match those speeds, or if we just need to study their actions from clever tricks.

Option to add binaries to path

It would be nice if I could set some variable to true to have the opam environment added to path, so I don't need to opam exec everything. (It might be the case that running opam env >> $GITHUB_ENV is enough?)

[wish] Control the name of the OPAM switch

Some devs find it useful to build in a dedicated switch, and as such their Dune workspace requires a switch with a particular name (e.g. wacoq).

v1 creates a switch named after the OCaml version, and v2 creates switch . (current directory). Would be nice to have a config option for that.

README should document cygwin interaction on Windows

IMHO, the readme should document the answers to the following questions:
If I want to use cygwin and setup-ocaml on Windows, what's the workflow? In particular:

  • Do I install cygwin separately, e.g., with egor-tensin/setup-cygwin?
  • If so, does it matter whether I do it before or after setup-ocaml?
  • If not, how do I get additional cygwin packages installed?
  • If not, where do I find the path to cygwin's bash?

Compiler warnings leading to build failure

I observe that builds that succeed locally often fail when using the GitHub CI because of stricter warnings. I am not sure what is causing this - are the builds initiated by this action tuned in some way that a generic dune build is not? Or is opam the source of it? Because I usually just use dune to build locally.

Looking at it again, this looks like an issue between macOS and Linux. I see the local build failures on a Linux machine but not on macOS. So this is unrelated to the CI. Closing this.

Action fails after the recent release

##[debug]Evaluating condition for step: 'Set up OCaml'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Set up OCaml
##[debug]Loading inputs
##[debug]Evaluating: env.OPAM_COMP
##[debug]Evaluating Index:
##[debug]..Evaluating env:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'OPAM_COMP'
##[debug]=> '4.11.1'
##[debug]Result: '4.11.1'
##[debug]Loading env
Run avsm/setup-ocaml@v1
  with:
    ocaml-version: 4.11.1
  env:
    HEAD_REF: ci572279844
    RUN_URL: https://github.com/canonical/multipass-private/actions/runs/572279844
    BUILD_DIR: ../build
    MACOSX_DEPLOYMENT_TARGET: 10.14
    OPAM_COMP: 4.11.1
    OPAMVERBOSE: 1
    OPAMYES: 1
    HOMEBREW_NO_AUTO_UPDATE: 1
    QT_VERSION: 5.12.10
    PKG_CONFIG_PATH: /Users/cibot/actions-runner/_work/multipass-private/Qt/5.12.10/clang_64/lib/pkgconfig
    Qt5_Dir: /Users/cibot/actions-runner/_work/multipass-private/Qt/5.12.10/clang_64
    Qt5_DIR: /Users/cibot/actions-runner/_work/multipass-private/Qt/5.12.10/clang_64
    QT_PLUGIN_PATH: /Users/cibot/actions-runner/_work/multipass-private/Qt/5.12.10/clang_64/plugins
    QML2_IMPORT_PATH: /Users/cibot/actions-runner/_work/multipass-private/Qt/5.12.10/clang_64/qml
/usr/local/bin/brew install opam
Warning: opam 2.0.8 is already installed and up-to-date.
To reinstall 2.0.8, run:
  brew reinstall opam
/usr/local/bin/opam init --bare -yav https://github.com/ocaml/opam-repository.git

User configuration:
  ~/.bash_profile is already up-to-date.
[NOTE] Make sure that ~/.bash_profile is well sourced in your ~/.bashrc.

/Users/cibot/actions-runner/_work/_actions/avsm/setup-ocaml/v1/dist/install-ocaml-unix.sh 4.11.1
++ opam info -f version ocaml --color=never
+ CURRENT_OCAML=4.11.1
+ '[' 4.11.1 '!=' 4.11.1 ']'
+ opam switch set 4.11.1
Error: Error: The process '/Users/cibot/actions-runner/_work/_actions/avsm/setup-ocaml/v1/dist/install-ocaml-unix.sh' failed with exit code 5
##[debug]Node Action run completed with exit code 1
##[debug]OPAMJOBS='4'
##[debug]OPAMYES='1'
##[debug]Finishing: Set up OCaml

Any plan to support CentOS ?

I'm trying to add self-hosted runners in a CentOS, according to the source code:

  await exec(
    "sudo apt-get -y install bubblewrap ocaml-native-compilers ocaml-compiler-libs musl-tools"
  );

It seems that we only support Ubuntu at this moment.

PS: I've tried to config the opam and ocaml in my CentOS and remove the following part:

      - name: Use OCaml ${{ matrix.ocaml-version }}
        uses: avsm/setup-ocaml@v1
        with:
          ocaml-version: ${{ matrix.ocaml-version }}

Then I got another error:

 Run opam pin add hello.dev . --no-action0s
  shell: /usr/bin/bash -e {0}
Run opam pin add hello.dev . --no-action
  opam pin add hello.dev . --no-action
  shell: /usr/bin/bash -e {0}
Package hello does not exist, create as a NEW package? [Y/n] n
##[error]Process completed with exit code 10.

And now my wordflow.yml would be:

name: Main workflow

on:  
  - push

jobs:
  build:
    strategy:
      fail-fast: false    

    runs-on: self-hosted

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - run: opam pin add hello.dev . --no-action

      - run: opam depext hello --yes --with-doc --with-test

      - run: opam install . --deps-only --with-doc --with-test

      - run: opam exec -- dune build

      - run: opam exec -- dune runtest

Macos CI failure

We experience Macos CI failures in Merlin using setup-ocaml with the following error:

 /Users/runner/work/_actions/avsm/setup-ocaml/v1/dist/install-ocaml-unix.sh 4.12.0
+ opam switch set 4.12.0
Continue? [Y/n] y
Format upgrade done.
# Run eval $(opam env) to update the current shell environment
/usr/local/bin/opam install -y depext
[NOTE] Package depext is already installed (current version is transition).
Error:  depext unmet availability conditions, e.g. 'opam-version >= "2.0.0~beta5" & opam-version < "2.1"'
Error: Error: The process '/usr/local/bin/opam' failed with exit code 5

We changed nothing to the project or the workflow file, just re-running a previously working CI cause it to fail.

Our workflow file is here: https://github.com/ocaml/merlin/actions/runs/1067798569/workflow

steps:
      - uses: actions/checkout@v2
      - name: Cache
        uses: actions/cache@v2
        with:
          path: ~/.opam
          key: ${{ matrix.os }}-${{ matrix.ocaml-version }}-${{ hashFiles('*.opam') }}-build
      - name: Set up OCaml ${{ matrix.ocaml-version }}
        uses: avsm/setup-ocaml@v1
        with:
          ocaml-version: ${{ matrix.ocaml-version }}

      - run: opam depext conf-jq --yes # opam depext bug
      - run: opam install . --deps-only --with-test
      - run: opam exec -- dune runtest -p merlin,dot-merlin-reader

The full CI log is here: https://github.com/ocaml/merlin/runs/3192327597
(not sure if this is publicly accessible)

Adding specific cygwin packages?

I'm trying to construct a GHA workflow to automatically construct the windows unison artifact from a suggested recipe. To do so, I need to add some cygwin packages... how would that be done?

My initial thought was to use the cygwin setup executable, but I'm not sure where it is.

Thanks for the work creating this action and, in advance, for the help here!

[Windows] opam refers to paths that are not valid from any default shell

I am trying to debug a failure at https://github.com/mit-plv/fiat-crypto/pull/966/checks?check_run_id=2530006424
opam claims

#=== ERROR while compiling coq-fiat-crypto.dev ================================#
# context              2.0.8 | win32/x86_64 | ocaml-variants.4.11.1+mingw64c | https://coq.inria.fr/opam/extra-dev#2021-05-07 10:10
# path                 ~/.opam/ocaml-variants.4.11.1+mingw64c/.opam-switch/build/coq-fiat-crypto.dev
# command              D:\cygwin\bin\make.exe -j3 EXTERNAL_DEPENDENCIES=1 SKIP_BEDROCK2=1 coq-without-bedrock2 standalone-ocaml
# exit-code            2
# env-file             ~/.opam/log/coq-fiat-crypto-3352-d6d332.env
# output-file          ~/.opam/log/coq-fiat-crypto-3352-d6d332.out
### output ###

but when I cat ~/.opam/log/* from powershell, I get

Line |
   2 |  cat ~/.opam/log/*
     |  ~~~~~~~~~~~~~~~~~
     | Cannot find path 'C:\Users\runneradmin\.opam\log' because it does not exist.

Am I supposed to run opam exec -- cat ~/.opam/log/* instead? The documentation here does not seem to say, so I'll try it. I suspect from the explanation in #71 (comment) that it won't work. I can't set the shell to bash and have that work either, though, as discovered in #71 (comment). So I guess I'm stuck explicitly passing the path to cygwin's bash?

Cygwin tar interferes with cache action on Windows

On Windows, setup-ocaml adds the c:\cygwin\bin directory to the PATH: https://github.com/avsm/setup-ocaml/blob/d3953534ca55051a028ce12a39f9fe4f15035f8d/src/installer.ts#L51

This directory contains a lot of programs that are intended to be used from a Cygwin environment and don't work from the Windows environment. One such program is tar, which causes the cache action to fail (encountered in ocamllabs/vscode-ocaml-platform#501):

Post job cleanup.
c:\cygwin\bin\tar.exe --posix --use-compress-program "zstd -T0" -cf cache.tzst -P -C D:/a/vscode-ocaml-platform/vscode-ocaml-platform --files-from manifest.txt --force-local
/usr/bin/tar: C\:\\cygwin\\home\runneradmin\\.opam: Cannot stat: No such file or directory
/usr/bin/tar: Exiting with failure status due to previous errors
Warning: Tar failed with error: The process 'c:\cygwin\bin\tar.exe' failed with exit code 2

Is there a reason this directory is being added to the PATH? I think only adding c:\cygwin\wrapperbin would be enough.

Support for multiple opam repositories

Hi!

I'm trying v2 version fc46ffd of this action at na4zagin3/satyrographos-repo#309 but it doesn't work well (check_run_id=2645592823) because *.opam files at the project root depends on packages at multiple custom OPAM repos in addition to the OPAM official repo.

As far as I understand, v2 (#66) doesn't support custom OPAM repos at this moment. If so, can it have another input parameter, for example, CUSTOM_REPOSITORIES or OVERLAY_REPOSITORIES, that takes a comma-separated list of <repo-name>=<repo-url> like --repos= option of opam switch create subcommand?

Output from the action v2
Set up OCaml 4.11.1
Warning: Unexpected input(s) 'ocaml-version', valid inputs are ['ocaml-compiler', 'opam-repository', 'opam-pin', 'opam-depext', 'opam-depext-flags', 'opam-local-packages', 'opam-disable-sandboxing', 'dune-cache', 'cache-prefix', 'github-token']
โ–ธ Run avsm/setup-ocaml@v2
โ–ธ Retrieve the opam cache
โ–ธ Install opam
โ–ธ Initialise the opam state
โ–ธ Install OCaml
โ–ธ Save the opam cache
โ–ธ Retrieve the opam download cache
โ–ธ Install depext
โ–ธ Retrieve the dune cache
โ–ธ Install dune
โ–พ Pin local packages
Install system packages required by opam packages
  /opt/hostedtoolcache/opam/2.0.8/x86_64/opam depext snapshot-develop snapshot-stable-0-0-4 snapshot-stable-0-0-5 snapshot-stable-0-0-6 
  # Detecting depexts using vars: arch=x86_64, os=linux, os-distribution=ubuntu, os-family=debian
  [ERROR] No solution for snapshot-develop & snapshot-stable-0-0-4 & snapshot-stable-0-0-5 & snapshot-stable-0-0-6: The following dependencies couldn't be met:
            - snapshot-stable-0-0-5 โ†’ satysfi
                unknown package
  
  
  Command failed: opam list --readonly --external  '--resolve=snapshot-develop,snapshot-stable-0-0-4,snapshot-stable-0-0-5,snapshot-stable-0-0-6,' returned 20
  Error: The process '/opt/hostedtoolcache/opam/2.0.8/x86_64/opam' failed with exit code 20

(Transferred from actions-ml/setup-ocaml#7)

Add the OCaml problem matchers

Can probably get these from the VSCode plugin, but need to check that they work with the OCaml 4.08+ new error message format.

dune fails on macOS when dune-cache is enabled

I am aware that dune-cache is not yet supported on macOS, but would be at least possible to prevent the builds from failing if it is set, e.g., by not setting the option on macOS, or setting it to disabled?

Maybe there is an obvious workaround that I am missing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.