Try to make it easier to use this action

1. Move the `uses` for `setup-msys2/setup-msys2` inside our action.
   Note, composite actions do not support conditional steps yet, and to
   workaround that I had to fork setup-msys2 and suppress the error when
   run on Linux or Mac OS
2. `bash-or-msys2` got renamed to `lispsh`, this way workflows can
   simply refer to that when in need to use Lisp-related tools like
   `ros`, or `qlot`

PS. The tests workflow was updated to reflect the above mentioned tests.
This commit is contained in:
Matteo Landi 2021-10-27 07:16:26 +02:00
parent e0ec9dde9f
commit b615572a53
2 changed files with 31 additions and 32 deletions

View file

@ -7,7 +7,7 @@ on:
- cron: "0 0 * * SUN"
jobs:
qlot-exec-ros-install:
tests:
# We want to run on external PRs, but not on our own internal PRs as
# they'll be run by the push to the branch.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
@ -16,37 +16,19 @@ jobs:
matrix:
include:
- os: ubuntu-latest
shell: bash
lisp: sbcl-bin
- os: macos-latest
shell: bash
lisp: sbcl-bin
- os: windows-latest
shell: msys2 {0}
lisp: sbcl-bin
defaults:
run:
shell: ${{ matrix.shell }}
shell: lispsh {0}
env:
LISP: ${{ matrix.lisp }}
name: build with ${{ matrix.lisp }} on ${{ matrix.os }}
name: test with ${{ matrix.lisp }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: msys2/setup-msys2@v2
if: runner.os == 'Windows'
with:
# Roswell was added to msys2 just _recently_, so the following makes
# sure packages metadata is up to date. Otherwise...
#
# $ pacman -S mingw-w64-x86_64-roswell
# error: target not found: mingw-w64-x86_64-roswell
# Error: Process completed with exit code 1
update: true
# Msys2 has its own PATH, and the following setting enables standard
# PATH manipulation expressions like the one shown below, to succeed:
#
# $ echo /usr/local/bin >> $GITHUB_PATH
path-type: inherit
- uses: actions/checkout@v2
with:
# The repo already contains the qlot and qlot.lock files, and since
@ -67,4 +49,5 @@ jobs:
# https://github.com/roswell/roswell/issues/497
asdf-version: 3.3.5.3
qlot-version: latest
- run: ros config
- run: qlot exec ros install 40ants/gh-pages

View file

@ -23,7 +23,23 @@ inputs:
runs:
using: composite
steps:
- name: Create bash-or-msys2
# Switch back to setup-msys2/setup-msys2@v2 if / when the following PR is
# merged: https://github.com/msys2/setup-msys2/pull/172
- uses: iamFIREcracker/setup-msys2@dont-fail-if-not-windows-with-assets
with:
# Roswell was added to msys2 just _recently_, so the following makes
# sure packages metadata is up to date. Otherwise...
#
# $ pacman -S mingw-w64-x86_64-roswell
# error: target not found: mingw-w64-x86_64-roswell
# Error: Process completed with exit code 1
update: true
# Msys2 has its own PATH, and the following setting enables standard
# PATH manipulation expressions like the one shown below, to succeed:
#
# $ echo /usr/local/bin >> $GITHUB_PATH
path-type: inherit
- name: Create lispsh
shell: bash
run: |
# All the steps below, should work without problems on Linux, Mac OS,
@ -35,18 +51,18 @@ runs:
# here: https://github.com/actions/runner/issues/835), so the
# workaround I came up with is:
#
# 1. Symlink bash/msys2 to a known location, i.e. bash-or-msys2
# 2. Use bash-or-msys2 as shell parameter
# 1. Symlink bash/msys2 to a known location, i.e. lispsh
# 2. Use lispsh as shell parameter
#
# It's not ideal, but the alternative is to duplicate most of the steps
# below, and have some of them with `shell: bash`, and others with
# `shell: msys2 {0}`.
if [[ "$RUNNER_OS" == "Windows" ]]; then
powershell New-Item -ItemType SymbolicLink \
-Path "D:/a/_temp/setup-msys2/bash-or-msys2.cmd" \
-Path "D:/a/_temp/setup-msys2/lispsh.cmd" \
-Target "D:/a/_temp/setup-msys2/msys2.cmd"
else
sudo ln -sf $(which bash) /usr/local/bin/bash-or-msys2
sudo ln -sf $(which bash) /usr/local/bin/lispsh
fi
- name: Set up Environment
shell: bash
@ -139,7 +155,7 @@ runs:
env | sort -u
echo ::endgroup::
- name: Install Roswell
shell: bash-or-msys2 {0}
shell: lispsh {0}
run: |
echo ::group::Installing Roswell dependencies
if [[ "$RUNNER_OS" == "Linux" ]]; then
@ -166,14 +182,14 @@ runs:
echo ::endgroup::
- name: Upgrade Quicklisp dists
shell: bash-or-msys2 {0}
shell: lispsh {0}
run: |
# The parent workflow might have caching enabled for Roswell and all
# the other Lisp files in general, so it's better to tell Quicklisp
# to update all its dists.
ros -e "(ql:update-all-dists :prompt nil)"
- name: Upgrade ASDF to the Latest Version
shell: bash-or-msys2 {0}
shell: lispsh {0}
run: |
if [[ "${{ inputs.asdf-version }}" != "latest" ]]; then
echo ::group::Installing ASDF ${{ inputs.asdf-version }}
@ -184,7 +200,7 @@ runs:
fi
echo ::endgroup::
- name: Install Qlot
shell: bash-or-msys2 {0}
shell: lispsh {0}
run: |
if [[ "${{ inputs.qlot-version }}" != "latest" ]]; then
echo ::group::Installing Qlot ${{ inputs.qlot-version }}
@ -196,7 +212,7 @@ runs:
echo .qlot/bin >> $GITHUB_PATH
echo ::endgroup::
- name: Create Qlot Environment
shell: bash-or-msys2 {0}
shell: lispsh {0}
run: |
echo ::group::Create Qlot Environment
@ -225,7 +241,7 @@ runs:
# all possible roswell scripts, if the system
# has them in the roswell/ subdirectory:
- name: Install ASDF System
shell: bash-or-msys2 {0}
shell: lispsh {0}
run: |
echo ::group::Install ASDF System
if [[ -n "${{ inputs.asdf-system }}" ]]; then