Skip to content

Maintenance 202604 #150

Maintenance 202604

Maintenance 202604 #150

Workflow file for this run

name: CI
on:
pull_request:
push:
branches: main
tags: ["**"]
workflow_dispatch:
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
env:
MYSQL_DATABASE: test
MYSQL_ROOT_PASSWORD: password
services:
database:
image: mariadb:10.6
env:
MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }}
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_ROOT_PASSWORD }}
ports: ['3306:3306']
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
matrix:
ocaml-compiler:
- "4.14.3"
- "5.2.1"
- "5.3.0"
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: true
- name: Install system dependencies
run: sudo apt-get update -y && sudo apt-get install -y libmariadb-dev
- name: Install dependencies
run: opam install --deps-only --with-test --with-doc -y .
- name: Build
run: make build
- name: Run tests
env:
DATABASE_URL: mariadb://root:${{ env.MYSQL_ROOT_PASSWORD }}@127.0.0.1:3306/${{ env.MYSQL_DATABASE }}
run: make test
- uses: actions/upload-artifact@v6
if: failure()
with:
name: tests-${{ matrix.ocaml-compiler }}
path: _build/default/test/_build/_tests/
- name: Notify about failure
if: failure()
uses: ./.github/actions/notify-failure
with:
webhook: ${{ secrets.ECON_TEAMS_WEBHOOK }}
lint-doc:
runs-on: ubuntu-latest
steps:
- name: Checkout tree
uses: actions/checkout@v6
- name: Install system dependencies
run: sudo apt-get update -y && sudo apt-get install -y libmariadb-dev
- name: Set-up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 5.3.0
opam-pin: true
dune-cache: true
- uses: ocaml/setup-ocaml/lint-doc@v3
- uses: actions/upload-artifact@v6
with:
name: documentation
path: _build/default/_doc/_html
- name: Notify about failure
if: failure()
uses: ./.github/actions/notify-failure
with:
webhook: ${{ secrets.ECON_TEAMS_WEBHOOK }}
lint-fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout tree
uses: actions/checkout@v6
- name: Set-up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 5.3.0
- uses: ocaml/setup-ocaml/lint-fmt@v3
- name: Notify about failure
if: failure()
uses: ./.github/actions/notify-failure
with:
webhook: ${{ secrets.ECON_TEAMS_WEBHOOK }}
lint-opam:
runs-on: ubuntu-latest
steps:
- name: Checkout tree
uses: actions/checkout@v6
- name: Set-up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 5.3.0
- uses: ocaml/setup-ocaml/lint-opam@v3
- name: Notify about failure
if: failure()
uses: ./.github/actions/notify-failure
with:
webhook: ${{ secrets.ECON_TEAMS_WEBHOOK }}
deploy-doc:
name: Deploy documentation
runs-on: ubuntu-latest
needs: [lint-doc]
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deploy-doc.outputs.page_url }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Download documentation artifact
uses: actions/download-artifact@v8
with:
name: documentation
path: documentation
- name: Deploy odoc to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ github.token }}
publish_dir: documentation
- name: Notify about failure
if: failure()
uses: ./.github/actions/notify-failure
with:
webhook: ${{ secrets.ECON_TEAMS_WEBHOOK }}
release:
name: Release a new version
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Extract version changelog
run: sed -nr "/^## .?v?${GITHUB_REF_NAME}/,/^## /p" CHANGELOG.md | sed '1d;2d;$d' > changes.md
- name: Create release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
body_path: changes.md
- name: Notify about failure
if: failure()
uses: ./.github/actions/notify-failure
with:
webhook: ${{ secrets.ECON_TEAMS_WEBHOOK }}