2.2.0 winget #43
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
name: Package opam releases | |
on: | |
workflow_dispatch: | |
# BEWARE: The `workflow_dispatch/inputs/*/default` attribute does not behave like `workflow_call/inputs/*/default`. | |
# Specifically the defaults are not populated in github.event.inputs. It only | |
# influences the web UI. | |
# Either way, we use the idiom ${{ github.event.inputs.NAME || 'the default' }} | |
# to read a default **in addition** to the web UI default specified here. | |
inputs: | |
test-filter: | |
type: choice | |
description: "Which tests are used" | |
required: false | |
default: all-tests | |
options: | |
- "all-tests" | |
- "no-tests" | |
- "no-direct-tests" | |
- "no-vagrant-tests" | |
DISKUV_OPAM_REPOSITORY: | |
description: The tag for https://github.com/diskuv/diskuv-opam-repository.git. Use "main" to get the latest diskuv repository | |
type: string | |
DKML_COMPILER: | |
type: string | |
description: "Git branch, tag or commit for dkml-base-compiler" | |
DKML_COMPONENT_OPAM: | |
type: string | |
description: "Git branch, tag or commit for dkml-component-*-opam" | |
push: | |
branches: | |
- "main" | |
- "eval-*" | |
tags: | |
- v* | |
- "[0-9]+.*" | |
env: | |
DISKUV_OPAM_REPOSITORY: ${{ github.event.inputs.DISKUV_OPAM_REPOSITORY }} | |
DKML_COMPILER: ${{ github.event.inputs.DKML_COMPILER }} | |
jobs: | |
release-notes: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Semver versions | |
run: | | |
# From refs/tags/v0.4.0-prerel91_r1_no_test -> 0.4.0 | |
# From refs/tags/v0.4.0+something -> 0.4.0 | |
MAJMINPAT=$(printf "%s" '${{ github.ref }}' | sed 's#refs/tags/##; s#^v##; s#-.*##; s#+.*##') | |
# From refs/tags/v0.4.0-prerel91_r1_no_test -> 0.4.0-prerel91 | |
# From refs/tags/v0.4.0+something -> 0.4.0 | |
MAJMINPATPRE=$(printf "%s" '${{ github.ref }}' | sed 's#refs/tags/##; s#^v##; s#\(-prerel[0-9]*\).*#\1#; s#+.*##') | |
echo "MAJMINPAT=$MAJMINPAT" >> $GITHUB_ENV | |
echo "MAJMINPATPRE=$MAJMINPATPRE" >> $GITHUB_ENV | |
printf 'Major.Minor.Patch = \e[1;34m%s\e[0m\n' "$MAJMINPAT" | |
printf 'Major.Minor.Patch[-Prerelease] = \e[1;34m%s\e[0m\n' "$MAJMINPATPRE" | |
- name: View release notes | |
# | opam-darwin_x86_64-i-$MAJMINPAT.tar.gz | No | Unsigned macOS on Intel binary distribution | | |
# | opam-linux_x86_64-i-$MAJMINPAT.tar.gz | No | Linux distribution compatible with CentOS 7, CentOS 8, Fedora 32+, Mageia 8+, ... | | |
# | opam-linux_x86-i-$MAJMINPAT.tar.gz | No | ... openSUSE 15.3+, Photon OS 4.0+ (3.0+ with updates), Ubuntu 20.04+Linux | | |
run: | | |
notes=contributors/changes/v${MAJMINPAT}.md | |
cat > footer.md <<EOF | |
## Asset Listing | |
| Syntax | Supported? | Description | | |
| --------------------------------------------- | ---------- | ----------------------------------------------------------------------------------- | | |
| setup-opam-windows_x86_64-$MAJMINPAT.exe | Yes | 64-bit opam installer. **You should download+install this** | | |
| setup-opam-windows_x86-$MAJMINPAT.exe | Partial | 32-bit opam on 64-bit Windows. | | |
| uninstall-opam-windows_x86_64-$MAJMINPAT.exe | Yes | 64-bit opam uninstaller. Use this if support@ tells you | | |
| uninstall-opam-windows_x86-$MAJMINPAT.exe | Partial | 32-bit opam uninstaller | | |
| unsigned-opam-windows_x86_64-i-$MAJMINPAT.exe | Yes | Unsigned installer. Use when you want to verify you can reproduce the installer ... | | |
| unsigned-opam-windows_x86-i-$MAJMINPAT.exe | Partial | ... directly from source code. Reproducibility is not yet 100% | | |
| opam-windows_x86-i-$MAJMINPAT.sfx | No | Self-extracting executable header used when creating signed installers from ... | | |
| opam-windows_x86_64-i-$MAJMINPAT.sfx | No | ... the pk7zip contents of the unsigned Windows installers | | |
| *-u-$MAJMINPAT.* | No | Uninstallers for all the above | | |
EOF | |
echo > emptyline | |
if [ -e "$notes" ]; then | |
RELEASEDATE=$(date -u +%Y-%m-%d) | |
cat "$notes" emptyline footer.md | sed "s/@@YYYYMMDD@@/$RELEASEDATE/" > notes.md | |
else | |
cp footer.md notes.md | |
fi | |
cat notes.md # Just for troubleshooting | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: release-notes | |
path: notes.md | |
build: | |
strategy: | |
matrix: | |
include: # | |
- gh_os: windows-2019 | |
abi_pattern: win32-windows_x86 | |
dkml_host_abi: windows_x86 | |
bits: "32" | |
- gh_os: windows-2019 | |
abi_pattern: win32-windows_x86_64 | |
dkml_host_abi: windows_x86_64 | |
bits: "64" | |
# - gh_os: ubuntu-latest | |
# abi_pattern: manylinux2014-linux_x86 | |
# dkml_host_abi: linux_x86 | |
# bits: "32" | |
# - gh_os: ubuntu-latest | |
# abi_pattern: manylinux2014-linux_x86_64 | |
# dkml_host_abi: linux_x86_64 | |
# bits: "64" | |
# - gh_os: macos-latest | |
# abi_pattern: macos-darwin_all | |
# dkml_host_abi: darwin_x86_64 | |
# bits: "64" | |
runs-on: ${{ matrix.gh_os }} | |
name: build / ${{ matrix.abi_pattern }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Cache DkML compilers code | |
uses: actions/cache@v3 | |
id: cache-dkml-compilers | |
with: | |
path: .ci/dkml-compilers | |
key: ${{ runner.os }} | |
- 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/dkml-compilers/gh-windows/pre | |
with: | |
DKML_COMPILER: ${{ env.DKML_COMPILER }} | |
CACHE_PREFIX: ${{ env.CACHE_PREFIX }} | |
DISKUV_OPAM_REPOSITORY: ${{ env.DISKUV_OPAM_REPOSITORY }} | |
- 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 }} | |
CACHE_PREFIX: ${{ env.CACHE_PREFIX }} | |
DISKUV_OPAM_REPOSITORY: ${{ env.DISKUV_OPAM_REPOSITORY }} | |
- 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 }} | |
DISKUV_OPAM_REPOSITORY: ${{ env.DISKUV_OPAM_REPOSITORY }} | |
# 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 on Windows host | |
if: startsWith(matrix.dkml_host_abi, 'windows_') | |
shell: msys2 {0} | |
env: | |
# [bits] is not populated by .ci/dkml-compilers pre actions | |
bits: ${{ matrix.bits }} | |
run: ci/build-test.sh | |
- name: Build and test on non-Windows host | |
if: "!startsWith(matrix.dkml_host_abi, 'windows_')" | |
env: | |
# [bits] is not populated by .ci/dkml-compilers pre actions | |
bits: ${{ matrix.bits }} | |
run: sh ci/build-test.sh | |
# Upload | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.dkml_host_abi }} | |
path: dist/ | |
# The .ci/dkml-compilers "post" actions will finalize caching, etc. | |
- name: Teardown DkML compilers on a Windows host | |
if: startsWith(matrix.dkml_host_abi, 'windows_') | |
uses: ./.ci/dkml-compilers/gh-windows/post | |
- name: Teardown DkML compilers on a Darwin host | |
if: startsWith(matrix.dkml_host_abi, 'darwin_') | |
uses: ./.ci/dkml-compilers/gh-darwin/post | |
- name: Teardown DkML compilers on a Linux host | |
if: startsWith(matrix.dkml_host_abi, 'linux_') | |
uses: ./.ci/dkml-compilers/gh-linux/post | |
#-------- | |
# Testing | |
#-------- | |
# Direct testing is simply using GitHub virtual machine to run the setup. | |
# | |
# Pros and Cons | |
# Because GitHub virtual machine already has Visual Studio and several other | |
# tools, it doesn't exercise all the paths that vagrant-testing covers. | |
# However, it is quicker and it can find issues with conflicting Cygwin | |
# (or any other of the many programs that are installed on a GitHub machine). | |
# In addition, windows-2019 (somewhat older Windows) and windows-latest (2022, or | |
# which is the latest) is tested ... Vagrant is closer to windows-latest | |
# as of Apr 2022. | |
# | |
# Matrix | |
# Instead of all 4 combinations of (2019,latest) x (32bit,64bit), we half | |
# the matrix so save compute cycles. | |
# | |
# Tricky Issues | |
# [Git installer hangs] | |
# | |
# The move for both windows-2019 and windows-latest from | |
# Image Release: https://github.com/actions/virtual-environments/releases/tag/win19%2F20220606.1 | |
# to: | |
# Image Release: https://github.com/actions/virtual-environments/releases/tag/win19%2F20220614.0 | |
# causes the Git for Windows 2.36.0 installer to hang. | |
# | |
# Root cause? It is likely antivirus | |
# (https://github.com/git-for-windows/msys2-runtime/pull/37) or a slightly | |
# different UAC environment. | |
# | |
# Mitigation: Pre-install Git for Windows from Chocolatey. Also Vagrant still | |
# tests the Git installer successfully. | |
direct-testing: | |
continue-on-error: true | |
# WAS: Disabled until "Tricky Issues" is fixed | |
# if: false | |
# if: | | |
# github.event.inputs.test-filter != 'no-tests' && | |
# github.event.inputs.test-filter != 'no-direct-tests' && | |
# !endsWith(github.ref_name, '_no_test') | |
timeout-minutes: 90 # 1.5 hours | |
# Wait for build | |
needs: | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-2019 | |
dkml_host_abi: windows_x86 | |
- os: windows-latest | |
dkml_host_abi: windows_x86_64 | |
runs-on: ${{ matrix.os }} | |
name: direct / ${{ matrix.os }} ${{ matrix.dkml_host_abi }} | |
steps: | |
- name: Download and unpack ${{ matrix.dkml_host_abi }} artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ matrix.dkml_host_abi }} | |
path: dist | |
- name: Test the installer (Windows) | |
env: | |
# Fix PATH so that C:\Program Files\Git\usr\bin\cygpath.exe is gone | |
PATH: "C:\\Program Files\\PowerShell\\7;\ | |
C:\\ProgramData\\chocolatey\\bin;\ | |
C:\\Program Files (x86)\\NSIS\\;\ | |
C:\\tools\\zstd;\ | |
C:\\Program Files\\dotnet;\ | |
C:\\Windows\\system32;\ | |
C:\\Windows;\ | |
C:\\Windows\\System32\\Wbem;\ | |
C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;\ | |
C:\\Program Files\\Docker;\ | |
C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit" | |
# If we don't change the shell then msys2/setup-msys2@v2 will conflict with | |
# the dkml-component-unixutils' MSYS2 ... you get: | |
# *** fatal error - cygheap base mismatch detected - 0x180348408/0x180349408. | |
# This problem is probably due to using incompatible versions of the cygwin DLL. | |
shell: pwsh | |
run: | | |
$setups = Get-ChildItem -Path dist -Filter "unsigned-*-i-*.exe" | |
foreach ($setup in $setups) | |
{ | |
Write-Host "Running $($setup.FullName) ..." | |
& $setup.FullName -v -v --color=always | |
if ($LastExitCode -ne 0) { throw "setup failed! Exited with $LastExitCode" } | |
& "$env:LOCALAPPDATA\Programs\opam\bin\opam.exe" --version | |
if ($LastExitCode -ne 0) { throw "opam.exe --version failed! Exited with $LastExitCode" } | |
& "$env:LOCALAPPDATA\Programs\opam\bin\opam.exe" init -a --no-git-location --cygwin-internal-install windows-initial https://github.com/dra27/opam-repository.git#windows-initial | |
if ($LastExitCode -ne 0) { throw "opam.exe init failed! Exited with $LastExitCode" } | |
& "$env:LOCALAPPDATA\Programs\opam\bin\opam.exe" var | |
if ($LastExitCode -ne 0) { throw "opam.exe var failed! Exited with $LastExitCode" } | |
} | |
$uninstalls = Get-ChildItem -Path dist -Filter "unsigned-*-u-*.exe" | |
foreach ($uninstall in $uninstalls) | |
{ | |
Write-Host "Running $($uninstall.FullName) ..." | |
& $uninstall.FullName -v -v --color=always | |
if ($LastExitCode -ne 0) { throw "uninstall failed! Exited with $LastExitCode" } | |
} | |
#-------- | |
# Release | |
#-------- | |
# | |
# We need Release to run even if the tests are disabled with _no_test tag | |
# or through a test-filter. That means we cannot put a dependency on | |
# the tests. | |
# With no dependency on tests, we can create a Release even if tests fail. | |
# But that is OK because the Release is just a Pre-release. | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # Needed for softprops/action-gh-release@v1 | |
# Wait until `build` and `release-notes` complete | |
needs: | |
- build | |
- release-notes | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
path: dist | |
- name: Remove setup artifacts | |
run: rm -rf setup-* | |
working-directory: dist | |
- name: Restructure multi-ABI directories | |
run: | | |
_release="$(pwd)/_release" | |
install -d "$_release" | |
# Special case: Release notes are not part of multi-ABI | |
mv dist/release-notes release-notes | |
cd dist | |
find . -mindepth 1 -maxdepth 1 -type d | while read -r distname; do | |
rsync -av $distname/ "$_release" | |
done | |
- name: Display files to be distributed | |
run: ls -R | |
working-directory: _release | |
- name: Release (only when Git tag pushed) | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
prerelease: true # becomes a real release after it is signed externally | |
body_path: release-notes/notes.md | |
files: | | |
_release/* | |
- name: Remove unneeded artifacts from GitHub Storage | |
uses: geekyeggo/delete-artifact@v1 | |
with: | |
failOnError: false | |
name: | | |
setup-dkml-macos-darwin_all | |
setup-dkml-manylinux2014-linux_x86 | |
setup-dkml-manylinux2014-linux_x86_64 | |
setup-dkml-win32-windows_x86 | |
setup-dkml-win32-windows_x86_64 |