Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
strategy:
matrix:
runs-on: [ubuntu-latest, macos-latest, macos-13]
version: [dev, latest]
runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout code
Expand All @@ -26,6 +27,7 @@ jobs:
- name: Use local setup-dune action
uses: ./
with:
version: ${{ matrix.version }}
automagic: true
directory: graphics
- name: Show dune version
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,19 @@ jobs:

| Key | Meaning | Default value |
| ----------- | ------------------------------------------------------- | ----------------------- |
| `version` | version of dune to use | `dev` |
| `directory` | where is the project that should be built and tested | current directory (`.`) |
| `automagic` | when `true`, triggers `pkg lock`, `build` and `runtest` | `false` |
| `steps` | fine-grain control over the steps to run | empty, use `automagic` |

### Details

The `version` can have the following special values:

- `dev` for the Developer Preview, which is the default at the moment since
dune package management is still an experimental feature,
- `latest` for the latest stable release.

When `steps` is empty, the set of steps to run is set according to `automagic`.
Otherwise `steps` should be the space-separated list of steps to perform
(`automagic` is ignored in that case). The complete list of steps is:
Expand Down
10 changes: 8 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Set up Dune
description: Install Dune (developer preview)
description: Install Dune and optionally build a project with Dune package management
author: Samuel Hym
inputs:
version:
description: 'Which version of the Dune binary to install'
required: false
default: 'dev'
automagic:
description: 'Whether to run automatically all the standard lock, build, test steps'
required: false
Expand Down Expand Up @@ -32,10 +36,12 @@ runs:
with:
path: |
${{ env.DUNE_CACHE_ROOT }}
key: dune-cache-${{ runner.os }}-${{ runner.arch }}
key: dune-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}
- name: Run the main action script
shell: bash
env:
DUNE_CONFIG__PKG_BUILD_PROGRESS: enabled
SETUPDUNEVERSION: ${{ inputs.version }}
SETUPDUNEDIR: ${{ inputs.directory }}
SETUPDUNEAUTOMAGIC: ${{ inputs.automagic }}
SETUPDUNESTEPS: ${{ inputs.steps }}
Expand Down
13 changes: 12 additions & 1 deletion setupdune.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ abort() {
}

install-dune() {
curl -fsSL https://get.dune.build/install | sh
case "$SETUPDUNEVERSION" in
dev)
(set -x; curl -fsSL https://get.dune.build/install | sh)
;;
latest)
(set -x; curl -fsSL https://github.com/ocaml-dune/dune-bin-install/releases/download/v2/install.sh | sh -s -- --install-root "$HOME/.local" --no-update-shell-config)
;;
*)
(set -x; curl -fsSL https://github.com/ocaml-dune/dune-bin-install/releases/download/v2/install.sh | sh -s -- "$SETUPDUNEVERSION" --install-root "$HOME/.local" --no-update-shell-config)
;;
esac
(set -x; dune --version)
}

lock() {
Expand Down
Loading