Skip to content

TMP

TMP #431

Workflow file for this run

name: main
on:
- pull_request
- push
jobs:
windows:
strategy:
fail-fast: false
runs-on: windows-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Set up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 4.14.x
opam-repositories: |
local: opam_win_repo
default: https://github.com/ocaml/opam-repository.git
- name: Download and bundle libcurl
shell: bash
env:
SHELLOPTS: igncr
PATH: C:\msys64\usr\bin:$PATH
run: |
bash ci/static-dl \
--url https://curl.se/windows/dl-8.9.1_1/curl-8.9.1_1-win64-mingw.zip \
--hash f7bc9e21490d942c937dfe7bfcb9a2e29a490665c8b51e8ea0cdc171ac08c5de \
--out /tmp/curl.zip
mkdir /tmp/curl
unzip /tmp/curl.zip -d /tmp/curl
cp /tmp/curl/*/bin/libcurl-x64.dll build/cs-api-${{ steps.build_version.outputs.value }}-windows/libcurl-4.dll
- name: Set build version
id: build_version
shell: bash
env:
SHELLOPTS: igncr
run: |
echo "value=$(bash ci/get_version.bash "${{ github.ref_type }}" "${{ github.ref_name }}")" >> $GITHUB_OUTPUT
- name: Using version ${{ steps.build_version.outputs.value }}
run: |
echo "Version number: ${{ steps.build_version.outputs.value }}"
- name: Pin the dependencies
run: opam pin add --no-action --kind path --locked --lock-suffix win.locked .
- name: Install the dependencies
run: opam install --deps-only --with-test --locked --lock-suffix win.locked cs_api_client
- name: Insert the version number
shell: bash
env:
SHELLOPTS: igncr
run: bash ci/subst.bash "${{ steps.build_version.outputs.value }}"
- name: Build the executable and run the tests
run: opam exec -- dune build @all @runtest
- name: Run --version
run: _build/install/default/bin/cs-api.exe --version
- name: Copy the artifacts to a directory (in powershell)
run: |
New-Item -ItemType Directory -ErrorAction SilentlyContinue build/cs-api-${{ steps.build_version.outputs.value }}-windows
Copy-Item _build/install/default/bin/cs-api.exe build/cs-api-${{ steps.build_version.outputs.value }}-windows/
- name: Upload the compiled binary
uses: actions/upload-artifact@v4
with:
name: cs-api-${{ steps.build_version.outputs.value }}-windows
path: build/*
if-no-files-found: error
linux:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set build version
id: build_version
run: |
echo "value=$(./ci/get_version.bash "${{ github.ref_type }}" "${{ github.ref_name }}")" >> $GITHUB_OUTPUT
- name: Using version ${{ steps.build_version.outputs.value }}
run: |
echo "Version number: ${{ steps.build_version.outputs.value }}"
- name: Build the executable
uses: docker/build-push-action@v6
with:
build-args: |
OPAM_BASE=opam-centos-7
OCAML_VERSION=4.14.2
VERSION=${{ steps.build_version.outputs.value }}
target: main
load: true
tags: cs-api
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run the tests
run: docker run --rm cs-api opam exec -- dune build @all @fmt @runtest
- name: Copy the artifacts to a directory
run: |
mkdir --parents "build/cs-api-${{ steps.build_version.outputs.value }}"-linux
docker create --name cs-api cs-api
docker cp cs-api:/home/main/build/cs-api "build/cs-api-${{ steps.build_version.outputs.value }}"-linux
- name: Upload the compiled binary
uses: actions/upload-artifact@v4
with:
name: cs-api-${{ steps.build_version.outputs.value }}-linux
path: build/*
if-no-files-found: error