# SPDX-FileCopyrightText: Copyright 2023 Roland Csaszar # SPDX-License-Identifier: MIT # # Project: OCaml-Buck-2-Examples # File: test.yml # Date: 12.Nov.2023 # # ============================================================================== name: Test on: push: branches: ["main"] pull_request: branches: ["main"] jobs: # windows: # strategy: # matrix: # os: [windows-latest] # dir: [basic_example, ppx_usage_example, inline_test_runners, ocamllex_menhir_example] # ocaml: [ocaml.5.0.0] # runs-on: ${{ matrix.os }} # steps: # - name: Checkout # uses: actions/checkout@v3 # - name: Install Buck 2 # uses: dtolnay/install-buck2@latest # - name: Set-up OCaml # uses: ocaml/setup-ocaml@v2 # with: # ocaml-compiler: ${{ matrix.ocaml }},ocaml-option-mingw # opam-repositories: | # dra27: https://github.com/dra27/opam-repository.git#windows-5.0 # default: https://github.com/fdopen/opam-repository-mingw.git#opam2 # - name: Update Submodules and ocaml-scripts # run: | # git submodule update --init --depth 1 # git clone https://github.com/facebook/ocaml-scripts.git --depth 1 # - name: Install Opam Packages # run: | # opam install menhir ocamlfind menhirLib qcheck-alcotest alcotest ppx_inline_alcotest sedlex # - name: Run dromedary # run: | # cd ${{ matrix.dir }} # opam exec -- python3 ../ocaml-scripts/dromedary.py -o third-party/BUCK # - name: Run Tests # run: | # cd ${{ matrix.dir }} # opam exec -- buck2 run :test unix: strategy: matrix: os: [macos-latest, ubuntu-latest] dir: [basic_example, ppx_usage_example, inline_test_runners, ocamllex_menhir_example] ocaml: [ocaml.5.1.0] runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v3 - name: Set-up OCaml uses: ocaml/setup-ocaml@v2 with: ocaml-compiler: ${{ matrix.ocaml }} opam-disable-sandboxing: true opam-pin: false opam-depext: false - name: Update Submodules and ocaml-scripts run: | git submodule update --init --depth 1 git clone https://github.com/facebook/ocaml-scripts.git --depth 1 - name: Install Opam Packages shell: python run: | import json import subprocess import sys file_names = ["${{ matrix.dir }}/third-party/dromedary.json"] cmd = ["opam", "install", "menhir", "ocamlfind"] for file_name in file_names: with open(file_name, "rt", encoding="utf-8") as fd: package_list = json.load(fd) cmd.extend(package_list["packages"]) subprocess.run(cmd) - name: Run dromedary run: | eval $(opam env --set-switch) cd ${{ matrix.dir }} opam exec -- python3 ../ocaml-scripts/dromedary.py -o third-party/BUCK - name: Install Buck 2 uses: dtolnay/install-buck2@latest - name: Run Tests run: | cd ${{ matrix.dir }} opam exec -- buck2 run :test