-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI based testing, with related fix.
Fix missing version for the dune dependency.
- Loading branch information
Showing
2 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Build, test, and lint | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
build-and-test: | ||
|
||
services: | ||
mariadb: | ||
image: mariadb:latest | ||
ports: ["3306:3306"] | ||
env: | ||
MARIADB_USER: testuser | ||
MARIADB_PASSWORD: testpw | ||
MARIADB_DATABASE: testdb | ||
MARIADB_RANDOM_ROOT_PASSWORD: 1 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
# ubuntu-20.04 has the same MariaDB client library options as latest | ||
# macos-latest does not work since we're using a service container | ||
ocaml-compiler: | ||
- 5 | ||
- 4.07 | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Check out source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up OCaml | ||
uses: ocaml/setup-ocaml@v3 | ||
with: | ||
ocaml-compiler: ${{ matrix.ocaml-compiler }} | ||
|
||
- name: Restore cached dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
key: ${{ runner.os }}-ocaml-${{ matrix.ocaml-compiler }}-deps-${{ hashFiles('*.opam') }} | ||
path: ~/.opam | ||
|
||
- name: Install dependencies | ||
run: opam install . --deps-only -t | ||
|
||
- name: Build | ||
run: opam exec -- dune build | ||
|
||
- name: Run tests | ||
run: opam exec -- dune runtest | ||
env: | ||
OCAML_MARIADB_HOST: 127.0.0.1 | ||
OCAML_MARIADB_PORT: 3306 | ||
OCAML_MARIADB_USER: testuser | ||
OCAML_MARIADB_PASS: testpw | ||
OCAML_MARIADB_DB: testdb | ||
OCAML_MARIADB_QUERY: "SELECT 'hello ' || ?" | ||
|
||
lint-opam: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up OCaml | ||
uses: ocaml/setup-ocaml@v3 | ||
with: | ||
ocaml-compiler: 5 | ||
|
||
- name: Lint OPAM package descriptions | ||
uses: ocaml/setup-ocaml/lint-opam@v3 |
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