Skip to content

use string preprocessor and remove functions #116

use string preprocessor and remove functions

use string preprocessor and remove functions #116

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.x]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use OCaml ${{ matrix.ocaml-version }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: true
opam-pin: true
opam-depext: false
- name: Install system dependencies
run: sudo apt-get update -y && sudo apt-get install -y libmariadb-dev
- name: Pin current guardian
run: |
opam pin add -yn guardian .
OPAMSOLVERTIMEOUT=180 opam depext --with-test --with-doc -y guardian
- name: Install dependencies
run: opam install --deps-only --with-test --with-doc -y .
- name: Build
run: |
make build
- name: Check formatting
run: |
opam install -y ocamlformat
make format
- name: Run tests
env:
DATABASE_URL: mariadb://root:${{ env.MYSQL_ROOT_PASSWORD }}@127.0.0.1:3306/${{ env.MYSQL_DATABASE }}
run: make test
- name: Build documentation
run: |
make doc
- uses: actions/upload-artifact@v3
with:
name: documentation
path: _build/default/_doc/_html
- uses: actions/upload-artifact@v3
if: failure()
with:
name: tests
path: _build/default/test/_build/_tests/
- 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: [build]
if: github.ref_name == 'main'
environment:
name: github-pages
url: ${{ steps.deploy-doc.outputs.page_url }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: Deploy odoc to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
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@v3
- 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@v1
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 }}