Skip to content

Commit

Permalink
ci - first setup (#28)
Browse files Browse the repository at this point in the history
* dune-project - add missing deps
* ci - first setup
* jsoo - make jsoo/unit_test/dune optional
* ci - give-up on matrix-check now
* ci neat - fix name: check -> quick-check
  • Loading branch information
haochenx authored Feb 16, 2023
1 parent 3175612 commit 218ac2f
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/matrix-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# name: Matrix-Check

# on:
# push:
# branches: [main]
# pull_request:
# types: [opened, synchronize, reopened, ready_for_review]

# jobs:
# matrix-check:
# strategy:
# fail-fast: false
# matrix:
# os:
# - ubuntu-latest
# ocaml-version:
# - 4.08.1
# - 4.13.1
# - 4.14.0
# - 5.0.0
# node-version:
# # - lts/fermium # v14 Maintenance LTS
# - lts/gallium # v16 Active LTS
# # - lts/hydrogen # v18 Active LTS

# if: github.event.pull_request.draft == false
# runs-on: ${{ matrix.os }}

# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# with:
# submodules: recursive
# fetch-depth: 2

# - name: Use OCaml ${{ matrix.ocaml-version }}
# uses: ocaml/setup-ocaml@v2
# with:
# ocaml-compiler: ${{ matrix.ocaml-version }}

# - name: Cache OPAM switch
# id: cache-switch
# uses: actions/cache@v3
# with:
# path: _opam
# key: v1-${{ runner.os }}-${{ matrix.ocaml-version }}-opam-switch

# - name: Check OCaml version and workspace info
# run: ./scripts/ci_print_env.sh

# - name: Install dependencies
# run: opam install -y . --deps-only --with-test

# - name: Perform dune build
# run: opam exec -- dune build

# - name: Perform dune runtest
# run: opam exec -- dune runtest
43 changes: 43 additions & 0 deletions .github/workflows/quick-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Quick-Check

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]

jobs:
quick-check:
strategy:
fail-fast: false
matrix:
ocaml-version:
- 4.13.1
runs-on: ubuntu-latest
container:
image: ghcr.io/kxcteam/ocaml-general:${{ matrix.ocaml-version }}
timeout-minutes: 25

steps:
- name: Checkout code
uses: actions/checkout@v3

# https://github.blog/2022-04-12-git-security-vulnerability-announced/
- name: Set safe directory
run: git config --global --add safe.directory $GITHUB_WORKSPACE

- name: Initialize submodules
run: git submodule update --init

- name: Check OCaml version and workspace info
run: ./scripts/ci_print_env.sh

- name: Install OPAM dependencies
run: |
opam install -y . --deps-only --with-test || (opam update && opam install -y . --deps-only --with-test)
- name: Perform dune build
run: opam exec -- dune build

- name: Perform dune runtest
run: opam exec -- dune runtest
4 changes: 4 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
(synopsis "KXC maintained common utilities")
(description "Common OCaml utilities maintained by Kotoi-Xie Consultancy")
(depends
(ppx_optcomp :build)
(ppx_deriving :build)

(alcotest :with-test)
(qtest :with-test)

(ocaml (>= 4.11.0))))
1 change: 1 addition & 0 deletions jsoo/unit_test/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(executables
(names jsoo_unit_tests)
(optional)
(libraries
alcotest qcheck
kxclib kxclib_jsoo
Expand Down
2 changes: 2 additions & 0 deletions kxclib.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ homepage: "https://github.com/kxcteam/kxclib-ocaml"
bug-reports: "https://github.com/kxcteam/kxclib-ocaml/issues"
depends: [
"dune" {>= "3.0"}
"ppx_optcomp" {build}
"ppx_deriving" {build}
"alcotest" {with-test}
"qtest" {with-test}
"ocaml" {>= "4.11.0"}
Expand Down
12 changes: 12 additions & 0 deletions scripts/ci_print_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
echo ">>> uname -a"
uname -a

echo && echo ">>> OCaml --version"
opam exec -- ocamlc --version

echo && echo ">>> git status"
git show HEAD^..HEAD --stat || git show HEAD --stat

echo && echo ">>> git ls-files"
git ls-files

0 comments on commit 218ac2f

Please sign in to comment.