Skip to content

Commit

Permalink
Add initial support for opam 2.2 on Windows
Browse files Browse the repository at this point in the history
Co-authored-by: Kate <kit-ty-kate@outlook.com>
Co-authored-by: Sora Morimoto <sora@morimoto.io>
Co-authored-by: David Allsopp <david.allsopp@metastack.com>
  • Loading branch information
4 people committed Jun 10, 2024
1 parent 970719e commit d73c4bc
Show file tree
Hide file tree
Showing 18 changed files with 129 additions and 550 deletions.
17 changes: 3 additions & 14 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,12 @@ jobs:
os:
- macos-latest
- ubuntu-latest
- windows-latest
ocaml-compiler:
- "5.2"
allow-prerelease-opam:
- false
include:
- os: windows-latest
ocaml-compiler: ocaml-variants.5.2.0+options,ocaml-option-mingw
allow-prerelease-opam: false
opam-repositories: |
windows-5.0: https://github.com/dra27/opam-repository.git#windows-5.0
sunset: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset
default: https://github.com/ocaml/opam-repository.git
- os: ubuntu-latest
ocaml-compiler: ocaml-variants.5.2.0+options,ocaml-option-flambda
allow-prerelease-opam: true

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

Expand All @@ -75,8 +66,6 @@ jobs:
uses: ./
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
allow-prerelease-opam: ${{ matrix.allow-prerelease-opam }}
dune-cache: ${{ runner.os != 'Windows' }}
opam-repositories: ${{ matrix.opam-repositories }}
allow-prerelease-opam: true

- run: opam depext --install uri
- run: opam install uri
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to

## [unreleased]

### Added

- Add initial support for opam 2.2 on Windows.

## [2.2.10]

### Changed
Expand Down
49 changes: 0 additions & 49 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,55 +59,6 @@ jobs:
uses: actions/deploy-pages@v4
```
## Using several conditional setup steps
```yml
steps:
- name: Checkout tree
uses: actions/checkout@v4

- name: Set-up OCaml on Windows
uses: ocaml/setup-ocaml@v2
if: runner.os == 'Windows'
with:
opam-repositories: |
sunset: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset
default: https://github.com/ocaml/opam-repository.git
- name: Set-up OCaml on Unix
uses: ocaml/setup-ocaml@v2
if: runner.os != 'Windows'
with:
opam-repositories: |
default: https://github.com/ocaml/opam-repository.git
```
## Using a custom step to choose between the values
```yml
steps:
- name: Checkout tree
uses: actions/checkout@v4

- name: Set opam repository url
id: repository
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
echo "::set-output name=url::https://github.com/ocaml-opam/opam-repository-mingw.git#sunset"
elif [ "$RUNNER_OS" == "macOS" ]; then
echo "::set-output name=url::https://github.com/custom/opam-repository.git#macOS"
else
echo "::set-output name=url::https://github.com/ocaml/opam-repository.git"
fi
- name: Set-up OCaml with repository ${{ steps.repository.outputs.url }}
uses: ocaml/setup-ocaml@v2
with:
opam-repositories: |
default: ${{ steps.repository.outputs.url }}
```
## Using glob patterns to filter local packages
Consult the
Expand Down
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,16 @@ steps:

## Inputs

| Name | Required | Description | Type | Default |
| ------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- |
| `ocaml-compiler` | Yes | The OCaml compiler packages to initialise. Consult the [supported version syntax](#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](https://github.com/actions/toolkit/tree/main/packages/glob) 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` |
| Name | Required | Description | Type | Default |
| ------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------ | -------- |
| `ocaml-compiler` | Yes | The OCaml compiler packages to initialise. Consult the [supported version syntax](#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-local-packages` | No | The local packages to be used by `opam-pin`. Consult the [`@actions/glob` documentation](https://github.com/actions/toolkit/tree/main/packages/glob) 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

Expand All @@ -122,12 +120,11 @@ more detailed examples please refer to the

Examples:

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

## Advanced Configurations

Expand Down
10 changes: 1 addition & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,8 @@ inputs:
description: Enable the automation feature for opam pin.
required: false
default: "true"
opam-depext:
description: Enable the automation feature for opam depext.
required: false
default: "true"
opam-depext-flags:
description: The flags for the opam depext command.
required: false
default: ""
opam-local-packages:
description: The local packages to be used by `opam-pin` or `opam-depext`.
description: The local packages to be used by `opam-pin`.
required: false
default: "*.opam"
opam-disable-sandboxing:
Expand Down
Loading

0 comments on commit d73c4bc

Please sign in to comment.