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" - cron: "0 0 * * SUN"
jobs: jobs:
qlot-exec-ros-install: tests:
# We want to run on external PRs, but not on our own internal PRs as # 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. # 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 if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
@ -16,37 +16,19 @@ jobs:
matrix: matrix:
include: include:
- os: ubuntu-latest - os: ubuntu-latest
shell: bash
lisp: sbcl-bin lisp: sbcl-bin
- os: macos-latest - os: macos-latest
shell: bash
lisp: sbcl-bin lisp: sbcl-bin
- os: windows-latest - os: windows-latest
shell: msys2 {0}
lisp: sbcl-bin lisp: sbcl-bin
defaults: defaults:
run: run:
shell: ${{ matrix.shell }} shell: lispsh {0}
env: env:
LISP: ${{ matrix.lisp }} LISP: ${{ matrix.lisp }}
name: build with ${{ matrix.lisp }} on ${{ matrix.os }} name: test with ${{ matrix.lisp }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: 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 - uses: actions/checkout@v2
with: with:
# The repo already contains the qlot and qlot.lock files, and since # The repo already contains the qlot and qlot.lock files, and since
@ -67,4 +49,5 @@ jobs:
# https://github.com/roswell/roswell/issues/497 # https://github.com/roswell/roswell/issues/497
asdf-version: 3.3.5.3 asdf-version: 3.3.5.3
qlot-version: latest qlot-version: latest
- run: ros config
- run: qlot exec ros install 40ants/gh-pages - run: qlot exec ros install 40ants/gh-pages

View file

@ -23,7 +23,23 @@ inputs:
runs: runs:
using: composite using: composite
steps: 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 shell: bash
run: | run: |
# All the steps below, should work without problems on Linux, Mac OS, # 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 # here: https://github.com/actions/runner/issues/835), so the
# workaround I came up with is: # workaround I came up with is:
# #
# 1. Symlink bash/msys2 to a known location, i.e. bash-or-msys2 # 1. Symlink bash/msys2 to a known location, i.e. lispsh
# 2. Use bash-or-msys2 as shell parameter # 2. Use lispsh as shell parameter
# #
# It's not ideal, but the alternative is to duplicate most of the steps # 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 # below, and have some of them with `shell: bash`, and others with
# `shell: msys2 {0}`. # `shell: msys2 {0}`.
if [[ "$RUNNER_OS" == "Windows" ]]; then if [[ "$RUNNER_OS" == "Windows" ]]; then
powershell New-Item -ItemType SymbolicLink \ 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" -Target "D:/a/_temp/setup-msys2/msys2.cmd"
else else
sudo ln -sf $(which bash) /usr/local/bin/bash-or-msys2 sudo ln -sf $(which bash) /usr/local/bin/lispsh
fi fi
- name: Set up Environment - name: Set up Environment
shell: bash shell: bash
@ -139,7 +155,7 @@ runs:
env | sort -u env | sort -u
echo ::endgroup:: echo ::endgroup::
- name: Install Roswell - name: Install Roswell
shell: bash-or-msys2 {0} shell: lispsh {0}
run: | run: |
echo ::group::Installing Roswell dependencies echo ::group::Installing Roswell dependencies
if [[ "$RUNNER_OS" == "Linux" ]]; then if [[ "$RUNNER_OS" == "Linux" ]]; then
@ -166,14 +182,14 @@ runs:
echo ::endgroup:: echo ::endgroup::
- name: Upgrade Quicklisp dists - name: Upgrade Quicklisp dists
shell: bash-or-msys2 {0} shell: lispsh {0}
run: | run: |
# The parent workflow might have caching enabled for Roswell and all # The parent workflow might have caching enabled for Roswell and all
# the other Lisp files in general, so it's better to tell Quicklisp # the other Lisp files in general, so it's better to tell Quicklisp
# to update all its dists. # to update all its dists.
ros -e "(ql:update-all-dists :prompt nil)" ros -e "(ql:update-all-dists :prompt nil)"
- name: Upgrade ASDF to the Latest Version - name: Upgrade ASDF to the Latest Version
shell: bash-or-msys2 {0} shell: lispsh {0}
run: | run: |
if [[ "${{ inputs.asdf-version }}" != "latest" ]]; then if [[ "${{ inputs.asdf-version }}" != "latest" ]]; then
echo ::group::Installing ASDF ${{ inputs.asdf-version }} echo ::group::Installing ASDF ${{ inputs.asdf-version }}
@ -184,7 +200,7 @@ runs:
fi fi
echo ::endgroup:: echo ::endgroup::
- name: Install Qlot - name: Install Qlot
shell: bash-or-msys2 {0} shell: lispsh {0}
run: | run: |
if [[ "${{ inputs.qlot-version }}" != "latest" ]]; then if [[ "${{ inputs.qlot-version }}" != "latest" ]]; then
echo ::group::Installing Qlot ${{ inputs.qlot-version }} echo ::group::Installing Qlot ${{ inputs.qlot-version }}
@ -196,7 +212,7 @@ runs:
echo .qlot/bin >> $GITHUB_PATH echo .qlot/bin >> $GITHUB_PATH
echo ::endgroup:: echo ::endgroup::
- name: Create Qlot Environment - name: Create Qlot Environment
shell: bash-or-msys2 {0} shell: lispsh {0}
run: | run: |
echo ::group::Create Qlot Environment echo ::group::Create Qlot Environment
@ -225,7 +241,7 @@ runs:
# all possible roswell scripts, if the system # all possible roswell scripts, if the system
# has them in the roswell/ subdirectory: # has them in the roswell/ subdirectory:
- name: Install ASDF System - name: Install ASDF System
shell: bash-or-msys2 {0} shell: lispsh {0}
run: | run: |
echo ::group::Install ASDF System echo ::group::Install ASDF System
if [[ -n "${{ inputs.asdf-system }}" ]]; then if [[ -n "${{ inputs.asdf-system }}" ]]; then