Skip to content

Create diskuvbox releases #105

Create diskuvbox releases

Create diskuvbox releases #105

Workflow file for this run

# Maintainer note: This .yml file is used as the simple example of setup-dkml.yml@v1. Keep it simple and documented!
name: Create diskuvbox releases
env:
OPAM_PACKAGE: "diskuvbox"
EXECUTABLE_NAME: "diskuvbox"
DKML_COMPILER: "" # You can override the dkml-compiler package version. Example: 4.12.1-v1.0.2
CACHE_PREFIX: "v1"
# Secondary switch 'two' used to install opam-installer for Dune-ified crosscompiling builds
SECONDARY_SWITCH: "true"
# Trigger whenever there is a git push to main/master branch, or whenever a version tag is pushed
on:
push:
branches:
- "main"
tags:
- "[0-9]+.*"
- "v*"
# ... or trigger manually from GitHub web interface
workflow_dispatch:
# ... or prime the caches every Wednesday at 18:00 UTC
schedule:
- cron: 0 18 * * WED
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- gh_os: windows-2019
abi_pattern: win32-windows_x86
dkml_host_abi: windows_x86
- gh_os: windows-2019
abi_pattern: win32-windows_x86_64
dkml_host_abi: windows_x86_64
- gh_os: ubuntu-latest
abi_pattern: manylinux2014-linux_x86
dkml_host_abi: linux_x86
- gh_os: ubuntu-latest
abi_pattern: manylinux2014-linux_x86_64
dkml_host_abi: linux_x86_64
- gh_os: macos-latest
abi_pattern: macos-darwin_all
dkml_host_abi: darwin_x86_64
runs-on: ${{ matrix.gh_os }}
name: build / ${{ matrix.abi_pattern }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Cache cross-compilation tools
uses: actions/cache@v3
with:
path: .ci/cross
key:
"${{ runner.os }}-cross-${{ hashFiles('ci/*.sh') }}"
# The Setup DKML action will create the environment variables:
# opam_root, exe_ext, dkml_host_abi, abi_pattern (and many more)
- name: Setup DKML on a Windows host
if: startsWith(matrix.dkml_host_abi, 'windows_')
uses: ./ci/setup-dkml/gh-windows/pre
with:
DKML_COMPILER: ${{ env.DKML_COMPILER }}
CACHE_PREFIX: ${{ env.CACHE_PREFIX }}
SECONDARY_SWITCH: ${{ env.SECONDARY_SWITCH }}
- name: Setup DKML on a Darwin host
if: startsWith(matrix.dkml_host_abi, 'darwin_')
uses: ./ci/setup-dkml/gh-darwin/pre
with:
DKML_COMPILER: ${{ env.DKML_COMPILER }}
CACHE_PREFIX: ${{ env.CACHE_PREFIX }}
SECONDARY_SWITCH: ${{ env.SECONDARY_SWITCH }}
- name: Setup DKML on a Linux host
if: startsWith(matrix.dkml_host_abi, 'linux_')
uses: ./ci/setup-dkml/gh-linux/pre
with:
DKML_COMPILER: ${{ env.DKML_COMPILER }}
CACHE_PREFIX: ${{ env.CACHE_PREFIX }}
SECONDARY_SWITCH: ${{ env.SECONDARY_SWITCH }}
- name: Build and test the package 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 }}
- name: Build and test the package 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 }}
- name: Teardown DKML on a Windows host
if: startsWith(matrix.dkml_host_abi, 'windows_')
uses: ./ci/setup-dkml/gh-windows/post
- name: Teardown DKML on a Darwin host
if: startsWith(matrix.dkml_host_abi, 'darwin_')
uses: ./ci/setup-dkml/gh-darwin/post
- name: Teardown DKML on a Linux host
if: startsWith(matrix.dkml_host_abi, 'linux_')
uses: ./ci/setup-dkml/gh-linux/post
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.dkml_host_abi }}
path: dist/
#--------
# Release
#--------
release:
runs-on: ubuntu-latest
permissions:
contents: write # Needed for softprops/action-gh-release@v1
# Wait until `build` complete
needs:
- build
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: dist
- name: Restructure multi-ABI directories
run: ci/prepare-release.sh
- name: Release (only when Git tag pushed)
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
_release/*