Skip to content

Commit 3a4d3fa

Browse files
Merge pull request #3 from punchagan/gha-opam-test
Add GitHub Action to opam install a pre-defined set of packages
2 parents 59b9d35 + 4f7819f commit 3a4d3fa

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/test.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
schedule:
9+
- cron: "30 0 * * *"
10+
11+
jobs:
12+
test-setup:
13+
env:
14+
OCAML_VARIANT: ocaml-variants.5.2.0+ox
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
# For info on the OS versions, architecture, etc., see
19+
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
20+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-latest]
21+
runs-on: ${{ matrix.os }}
22+
steps:
23+
- name: Checkout the repository
24+
uses: actions/checkout@v4
25+
26+
- name: Get hash of the ocaml-variant opam file
27+
id: hash-opam-file
28+
run: |
29+
HASH=$(shasum -a 256 packages/ocaml-variants/${OCAML_VARIANT}/opam | awk '{print $1}')
30+
echo "hash=${HASH}" >> "$GITHUB_OUTPUT"
31+
32+
- uses: ocaml/setup-ocaml@v3
33+
with:
34+
# Invalidate cache when opam file for the ocaml-variant changes
35+
cache-prefix: ${{ steps.hash-opam-file.outputs.hash }}
36+
ocaml-compiler: ${{ env.OCAML_VARIANT }}
37+
opam-pin: false
38+
opam-repositories: |
39+
oxcaml: .
40+
default: https://github.com/ocaml/opam-repository.git
41+
42+
- name: opam install packages
43+
run: |
44+
opam --version
45+
opam repository list
46+
opam list
47+
opam install ocamlformat merlin ocaml-lsp-server utop parallel core_unix
48+
opam list

0 commit comments

Comments
 (0)