Skip to content

Commit

Permalink
Allow workflows to run locally (#1068)
Browse files Browse the repository at this point in the history
* Allow workflows to run locally

For instance, using nektos/act

* Disable sandboxing (we're already in a container)
* Don't wait for user confirmation when installing system packages

* Fix local run

* Disable sandboxing for CI workflow

* Remove apt-get install assume yes setting

This was was a work around bug preventing workflows to run
using nektos/act:

ocaml/setup-ocaml#657

Fixed in setup-ocaml 2.0.14

https://github.com/ocaml/setup-ocaml/releases/tag/v2.0.14

* Do not ask for user confirmation

* Doc run workflows locally with nektos/act

---------

Co-authored-by: Cuihtlauac ALVARADO <cuihtlauac@tarides.com>
  • Loading branch information
cuihtlauac and cuihtlauac committed Apr 25, 2023
1 parent 624cf93 commit 13e4423
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Expand Up @@ -35,6 +35,7 @@ jobs:
dune-cache: ${{ matrix.os != 'macos-latest' }}
opam-repositories: |
pin: git+https://github.com/ocaml/opam-repository#9cf27a6683dc4e56ccf7e35c008198828bd5c267
opam-disable-sandboxing: true

- name: Install system dependencies (Linux)
run: sudo apt-get install libev-dev libonig-dev
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/dummy.yml
Expand Up @@ -13,11 +13,17 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Install Missing System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y rsync
- name: Setup OCaml
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ocaml-base-compiler.4.14.1
opam-repositories: |
pin: git+https://github.com/ocaml/opam-repository#9cf27a6683dc4e56ccf7e35c008198828bd5c267
opam-disable-sandboxing: true

- run: git rev-parse HEAD
1 change: 1 addition & 0 deletions .github/workflows/scrape.yml
Expand Up @@ -31,6 +31,7 @@ jobs:
dune-cache: ${{ matrix.os != 'macos-latest' }}
opam-repositories: |
pin: git+https://github.com/ocaml/opam-repository#9cf27a6683dc4e56ccf7e35c008198828bd5c267
opam-disable-sandboxing: true

- name: Install opam dependencies
run: opam install --deps-only --with-test .
Expand Down
6 changes: 5 additions & 1 deletion HACKING.md
Expand Up @@ -10,7 +10,11 @@ Before starting to hack you need a properly configured development environment.
* OpenSSL: https://www.openssl.org/
* GNU Multiple Precision: https://gmplib.org/

The project [`Dockerfile`](./Dockerfile) contains up-to-date system configuration instructions, as used to ship into production. It is written for the Alpine Linux distribution but is meant to be adapted to other environments such as Ubuntu, macOS+Homebrew or others. The GitHub workflow file [`.github/workflows/ci.yml`](.github/workflows/ci.yml) also contains useful commands for Ubuntu and macOS. Since ocaml.org is mostly written in OCaml, a properly configured OCaml development environment is also required, but is not detailed here. Although Docker is used to ship, it is not a requirement to begin hacking. Currently, ocaml.org doesn't yet compile using OCaml 5, version 4.14 of the language is used.
The project [`Dockerfile`](./Dockerfile) contains up-to-date system configuration instructions, as used to ship into production. It is written for the Alpine Linux distribution but is meant to be adapted to other environments such as Ubuntu, macOS+Homebrew or others. The GitHub workflow file [`.github/workflows/ci.yml`](.github/workflows/ci.yml) also contains useful commands for Ubuntu and macOS. Since ocaml.org is mostly written in OCaml, a properly configured OCaml development environment is also required, but is not detailed here. Although Docker is used to ship, it is not a requirement to begin hacking. Currently, ocaml.org doesn't yet compile using OCaml 5, version 4.14 of the language is used. It is possible to run workflow files in `.github/workflows` using the [nektos/act](https://github.com/nektos/act) tool. For instance, run the following command to run the CI checks run by GitHub on each pull request (where `ghghgh` is replace by an _ad-hoc_ GitHub token, see: https://github.com/nektos/act#github_token)
```
act -s GITHUB_TOKEN=ghghgh .github/workflows/ci.yml -j build
```


The `Makefile` contains many commands that can get you up and running, a typical workflow will be to clone the repository after forking it.

Expand Down

0 comments on commit 13e4423

Please sign in to comment.