Merge pull request #91 from esy-ocaml/prometheansacrifice/ocaml5 #88
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/setup-node@v4 | |
- uses: actions/checkout@v4 | |
- name: Install esy | |
run: npm install -g esy | |
- name: Try to restore install cache | |
uses: actions/cache@v2.1.1 | |
with: | |
path: ~/.esy/source | |
key: source-${{ hashFiles('**/index.json') }} | |
- name: Install | |
run: esy install | |
- name: Print esy cache | |
uses: actions/github-script@v3.0.0 | |
id: print_esy_cache | |
with: | |
script: | | |
const path = require('path') | |
const scriptPath = path.resolve('.github/workflows/print_esy_cache.js') | |
require(scriptPath)(core) | |
- name: Try to restore build cache | |
id: deps-cache | |
uses: actions/cache@v2.1.1 | |
with: | |
path: ${{ steps.print_esy_cache.outputs.esy_cache }} | |
key: build-${{ matrix.os }}-${{ hashFiles('**/index.json') }} | |
restore-keys: build-${{ matrix.os }}- | |
# Here we use a low-level command. In real situation you don't have to | |
# but it is useful in CI as it split the log in GitHub UI. | |
# You can see at a glance if it is your projet or your deps that break. | |
# | |
# We also use --release flag to build less. | |
# This allow us to spot syntax/type error more quickly. | |
- name: Build release dependencies | |
if: steps.deps-cache.outputs.cache-hit != 'true' | |
run: esy build-dependencies --release | |
- name: Build project in release | |
run: esy build --release | |
# Now that our core project build let builds others deps | |
- name: Build dependencies | |
if: steps.deps-cache.outputs.cache-hit != 'true' | |
run: esy build-dependencies | |
- name: Build project | |
run: esy build | |
# Here we cleanup if we have a cache fail because we use restore-keys. | |
# restore-keys take the old store even on cache fail. | |
# So, we have deps we don't care anymore. We prune them. | |
- name: Clean global store | |
if: steps.deps-cache.outputs.cache-hit != 'true' | |
run: esy cleanup . | |
- name: Test | |
run: esy test | |
- name: Build docs | |
run: esy doc |