Skip to content

Commit

Permalink
./dk dkml.workflow.compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonah Beckford committed Sep 3, 2023
1 parent ad86f16 commit f3bdd2b
Show file tree
Hide file tree
Showing 22 changed files with 64 additions and 19,208 deletions.
99 changes: 62 additions & 37 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
name: Opam Regular - Build and Test

env:
OPAM_PACKAGE: "your_example"
EXECUTABLE_NAME: "your_example"
DKML_COMPILER: "" # You can override the dkml-compiler package version. Example: 4.12.1-v1.0.2
##########################################################################
# File: dktool/cmake/scripts/dkml/workflow/compilers-github-workflows-dkml.in.yml#
# #
# Copyright 2023 Diskuv, Inc. #
# #
# Licensed under the Open Software License version 3.0 #
# (the "License"); you may not use this file except in compliance #
# with the License. You may obtain a copy of the License at #
# #
# https://opensource.org/license/osl-3-0-php/ #
# #
##########################################################################

# Updating
# --------
#
# 1. Delete this file.
# 2. Run dk with your original arguments:
# ./dk dkml.workflow.compilers
# or get help to come up with new arguments:
# ./dk dkml.workflow.compilers HELP

name: Build with DkML compiler

on:
# trigger on any push
push:
branches:
- main
- v*
- feature-*
tags:
- '[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+'
# ... or trigger manually from GitHub web interface
workflow_dispatch:

Expand Down Expand Up @@ -46,56 +57,70 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

# The Setup DKML action will create the environment variables:
# opam_root, exe_ext, dkml_host_abi, abi_pattern (and many more)
- name: Cache DkML compilers code
uses: actions/cache@v3
id: cache-dkml-compilers
with:
path: .ci/dkml-compilers
key: ${{ runner.os }}

- name: Setup DKML on a Windows host
- name: Checkout DkML compilers code
if: steps.cache-dkml-compilers.outputs.cache-hit != 'true'
# For help: ./dk dkml.workflow.compilers HELP
run: ./dk dkml.workflow.compilers CI GitHub

# The .ci/dkml-compilers "pre" actions will create the environment variables:
# opam_root, exe_ext, dkml_host_abi, abi_pattern (and many more)
#
- name: Setup DkML compilers on a Windows host
if: startsWith(matrix.dkml_host_abi, 'windows_')
uses: ./ci/setup-dkml/gh-windows/pre
uses: ./.ci/dkml-compilers/gh-windows/pre
with:
DKML_COMPILER: ${{ env.DKML_COMPILER }}

- name: Setup DKML on a Darwin host
if: startsWith(matrix.dkml_host_abi, 'darwin_')
uses: ./ci/setup-dkml/gh-darwin/pre
CACHE_PREFIX: ${{ env.CACHE_PREFIX }}
- name: Setup DkML compilers on a Linux host
if: startsWith(matrix.dkml_host_abi, 'linux_')
uses: ./.ci/dkml-compilers/gh-linux/pre
with:
DKML_COMPILER: ${{ env.DKML_COMPILER }}

- name: Setup DKML on a Linux host
if: startsWith(matrix.dkml_host_abi, 'linux_')
uses: ./ci/setup-dkml/gh-linux/pre
CACHE_PREFIX: ${{ env.CACHE_PREFIX }}
- name: Setup DkML compilers on a Darwin host
if: startsWith(matrix.dkml_host_abi, 'darwin_')
uses: ./.ci/dkml-compilers/gh-darwin/pre
with:
DKML_COMPILER: ${{ env.DKML_COMPILER }}
CACHE_PREFIX: ${{ env.CACHE_PREFIX }}

# BOILERPLATE START: setup-dkml for Opam Regular workflow
# This section is for your own build logic which you should place in
# ci/build-test.sh or a similar file

- name: Build and test the package on Windows host
- name: Build and test on Windows host
if: startsWith(matrix.dkml_host_abi, 'windows_')
shell: msys2 {0}
run: ci/build-test.sh --opam-package ${{ env.OPAM_PACKAGE }} --executable-name ${{ env.EXECUTABLE_NAME }}
run: ci/build-test.sh

- name: Build and test the package on non-Windows host
- name: Build and test on non-Windows host
if: "!startsWith(matrix.dkml_host_abi, 'windows_')"
run: ci/build-test.sh --opam-package ${{ env.OPAM_PACKAGE }} --executable-name ${{ env.EXECUTABLE_NAME }}
run: ci/build-test.sh

- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.dkml_host_abi }}
path: dist/

# BOILERPLATE END: setup-dkml for Opam Regular workflow
# The .ci/dkml-compilers "post" actions will finalize caching, etc.

- name: Teardown DKML on a Windows host
- name: Teardown DkML compilers on a Windows host
if: startsWith(matrix.dkml_host_abi, 'windows_')
uses: ./ci/setup-dkml/gh-windows/post
uses: ./.ci/dkml-compilers/gh-windows/post

- name: Teardown DKML on a Darwin host
- name: Teardown DkML compilers on a Darwin host
if: startsWith(matrix.dkml_host_abi, 'darwin_')
uses: ./ci/setup-dkml/gh-darwin/post
uses: ./.ci/dkml-compilers/gh-darwin/post

- name: Teardown DKML on a Linux host
- name: Teardown DkML compilers on a Linux host
if: startsWith(matrix.dkml_host_abi, 'linux_')
uses: ./ci/setup-dkml/gh-linux/post
uses: ./.ci/dkml-compilers/gh-linux/post

#--------
# Release
Expand Down
16 changes: 2 additions & 14 deletions ci/build-test.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
#!/bin/sh
set -euf

usage() {
echo "'--opam-package OPAM_PACKAGE.opam --executable-name EXECUTABLE_NAME' where you have a (executable (public_name EXECUTABLE_NAME) ...) in some 'dune' file" >&2
exit 3
}
OPTION=$1
shift
[ "$OPTION" = "--opam-package" ] || usage
OPAM_PACKAGE=$1
shift
OPTION=$1
shift
[ "$OPTION" = "--executable-name" ] || usage
EXECUTABLE_NAME=$1
shift
OPAM_PACKAGE=your_example
EXECUTABLE_NAME=your_example

# shellcheck disable=SC2154
echo "
Expand Down
72 changes: 0 additions & 72 deletions ci/setup-dkml/gh-darwin/post/action.yml

This file was deleted.

17 changes: 0 additions & 17 deletions ci/setup-dkml/gh-darwin/post/dune

This file was deleted.

Loading

0 comments on commit f3bdd2b

Please sign in to comment.