Enhance error handling in runRescriptDep function #44
This file contains hidden or 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 CLI | |
on: | |
push: | |
branches: [ main ] | |
tags: | |
- 'cli-v*' | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
workflow_call: | |
inputs: | |
artifacts-for-extension: | |
required: false | |
type: boolean | |
default: false | |
permissions: | |
contents: read | |
actions: read | |
jobs: | |
build-macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up OCaml | |
uses: ocaml/setup-ocaml@v2 | |
with: | |
ocaml-compiler: 5.3.0 | |
dune-cache: false | |
- name: Get version | |
id: get_version | |
run: | | |
if [[ $GITHUB_REF == refs/tags/cli-v* ]]; then | |
echo "VERSION=${GITHUB_REF#refs/tags/cli-v}" >> $GITHUB_OUTPUT | |
else | |
echo "VERSION=latest" >> $GITHUB_OUTPUT | |
fi | |
- name: Install dependencies | |
run: opam install . --deps-only --with-test | |
- name: Build project | |
run: opam exec -- dune build | |
- name: Create executable directory | |
run: mkdir -p dist | |
- name: Copy executable | |
run: cp _build/default/bin/main.exe dist/rescriptdep | |
- name: Set executable permissions | |
run: chmod +x dist/rescriptdep | |
- name: Create tar archive | |
run: | | |
cd dist | |
tar -czf rescriptdep-darwin-x64-${{ steps.get_version.outputs.VERSION }}.tar.gz rescriptdep | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rescriptdep-darwin-x64-${{ steps.get_version.outputs.VERSION }} | |
path: dist/rescriptdep-darwin-x64-${{ steps.get_version.outputs.VERSION }}.tar.gz | |
retention-days: 7 | |
build-linux: | |
runs-on: ubuntu-latest | |
container: | |
image: ocaml/opam:alpine-ocaml-5.3 | |
options: --user root | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get version | |
id: get_version | |
run: | | |
if [[ $GITHUB_REF == refs/tags/cli-v* ]]; then | |
echo "VERSION=${GITHUB_REF#refs/tags/cli-v}" >> $GITHUB_OUTPUT | |
else | |
echo "VERSION=latest" >> $GITHUB_OUTPUT | |
fi | |
- name: Install system dependencies | |
run: | | |
apk add --no-cache linux-headers build-base musl-dev | |
- name: Initialize opam | |
run: | | |
opam init --disable-sandboxing -y | |
opam switch list | |
- name: Install OCaml dependencies | |
run: | | |
eval $(opam env) | |
opam install . --deps-only --with-test -y | |
- name: Build project | |
run: | | |
eval $(opam env) | |
opam exec -- dune build --profile static | |
- name: Create executable directory | |
run: mkdir -p dist | |
- name: Copy executable | |
run: cp _build/default/bin/main.exe dist/rescriptdep | |
- name: Set executable permissions | |
run: chmod +x dist/rescriptdep | |
- name: Create tar archive | |
run: | | |
cd dist | |
tar -czf rescriptdep-linux-x64-${{ steps.get_version.outputs.VERSION }}.tar.gz rescriptdep | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rescriptdep-linux-x64-${{ steps.get_version.outputs.VERSION }} | |
path: dist/rescriptdep-linux-x64-${{ steps.get_version.outputs.VERSION }}.tar.gz | |
retention-days: 7 |