Skip to content

Commit

Permalink
ci: speed up opam ci (#1229)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro authored Nov 18, 2024
1 parent 61c0243 commit b732f4b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/opam-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,21 @@ jobs:
- ubuntu-latest
# - windows-latest # for some reason windows build is not picking dune 3.5
ocaml-compiler:
- ocaml-variants.5.3.0+trunk
# - ocaml-base-compiler.5.3.0~beta1
- ocaml-base-compiler.5.3.0~beta1

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

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'recursive'
submodules: "recursive"
path: melange

- name: Use Node
uses: actions/setup-node@v4
with:
node-version: 21
node-version: 22

- name: Install Homebrew dependencies
if: ${{ matrix.os == 'macos-latest' }}
Expand All @@ -52,6 +51,15 @@ jobs:
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}

- name: Restore OPAM cache
id: opam-cache
uses: actions/cache/restore@v4
with:
path: |
~/.opam
~/work/melange/melange/_opam
key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('melange/*.opam') }}

- name: Install dependencies
working-directory: melange
run: |
Expand Down Expand Up @@ -79,3 +87,12 @@ jobs:
working-directory: melange-opam-template
run: |
node ./_build/default/src/node/src/Hello.mjs
- name: Save OPAM cache
uses: actions/cache/save@v4
if: steps.opam-cache.outputs.cache-hit != 'true'
with:
path: |
~/.opam
~/work/melange/melange/_opam
key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ hashFiles('melange/*.opam') }}
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ opam-create-switch: ## Create opam switch

.PHONY: opam-install-test
opam-install-test: ## Install test dependencies
opam pin add melange.dev . --with-test -y
opam pin add melange-playground.dev . --with-test -y
opam pin add melange.dev . --with-test -y --no-action
opam pin add melange-playground.dev . --with-test -y --no-action
opam install melange.dev melange-playground.dev -t

.PHONY: opam-install-dev
opam-install-dev: opam-install-test ## Install development dependencies
Expand Down

0 comments on commit b732f4b

Please sign in to comment.