Skip to content

Commit

Permalink
Add option to use mysys2 instead of cygwin
Browse files Browse the repository at this point in the history
Github runners come with mysys2 installed (This is what is used when you
call `shell: bash` on a windows runner.) Using mysys2 means we can avoid
the rather costly cygwin install costs during builds.
  • Loading branch information
bennettgoble committed Apr 8, 2024
1 parent 2af2781 commit 9a5a255
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
strategy:
matrix:
os: [windows-2022, macos-latest, ubuntu-latest]
cygwin: [false]
include:
- os: windows-2022
cygwin: true
runs-on: ${{ matrix.os }}
env:
AUTOBUILD_CONFIGURATION: default
Expand All @@ -30,6 +34,7 @@ jobs:
- uses: ./
with:
artifact-name: autobuild-${{ matrix.os }}
cygwin: ${{ matrix.cygwin }}
checkout: false

- shell: bash
Expand All @@ -38,20 +43,23 @@ jobs:
- uses: ./
with:
artifact-name: autobuild-scm-${{ matrix.os }}
cygwin: ${{ matrix.cygwin }}
checkout: false
file: autobuild-scm.xml

# Test git-based autobuild install
- uses: ./
with:
artifact-name: autobuild-git-${{ matrix.os }}
cygwin: ${{ matrix.cygwin }}
autobuild-version: main
checkout: false

# Test alternative compression-format
- uses: ./
with:
artifact-name: autobuild-tbz2-${{ matrix.os }}
cygwin: ${{ matrix.cygwin }}
archive-format: tbz2
checkout: false
- name: Check bz2 package
Expand All @@ -66,9 +74,10 @@ jobs:
- uses: ./
with:
artifact-name: autobuild-py310-${{ matrix.os }}
cygwin: ${{ matrix.cygwin }}
setup-python: false
- name: Check python version
shell: bash
run: |
ver="$(python --version)"
[[ "$ver" == "Python 3.10."* ]] || exit "Expected python 3.10, got $ver"
[[ "$ver" == "Python 3.10."* ]] || exit "Expected python 3.10, got $ver"
20 changes: 17 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ inputs:
type: string
description: Version of autobuild to install
default: 3.*
cygwin:
type: boolean
description: Install and use cygwin
default: "false"
mysys2-packages:
type: string
description: Additional mysys2 packages to install
cygwin-packages:
type: string
description: Additional cygwin packages to install
Expand Down Expand Up @@ -137,22 +144,28 @@ runs:
if [[ $VERSION =~ ^[0-9] ]]; then
pip install "autobuild==$VERSION"
else
pip install "autobuild @ git+https://github.com/secondlife/autobuild@$VERSION"
pip install "autobuild @ git+https://github.com/secondlife/autobuild@$VERSION"
fi
- name: Setup cygwin
if: ${{ runner.os == 'Windows' }}
if: ${{ runner.os == 'Windows' && inputs.cygwin != 'false' }}
uses: secondlife/setup-cygwin@v3
with:
packages: ${{ inputs.cygwin-packages }}

- name: Setup mysys2
if: ${{ runner.os == 'Windows' && fromJSON(inputs.mysys2-packages) }}
shell: bash
run: pacman -Sy --noconfirm ${{ inputs.mysys2-packages }}

- name: Determine shell
id: shell
shell: bash
env:
WINDOWS: ${{ runner.os == 'Windows' }}
CYGWIN: ${{ inputs.cygwin != 'false' }}
run: |
if [[ $WINDOWS == 'true' ]]; then
if [[ $WINDOWS == 'true' && $CYGWIN == 'true' ]]; then
echo "shell=C:\cygwin64\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'" >> $GITHUB_OUTPUT
else
echo "shell=bash" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -187,6 +200,7 @@ runs:
AUTOBUILD_VCS_URL: ${{ github.repositoryUrl }}
BUILD_ID: ${{ inputs.build-id }}
CONFIGURATION: ${{ inputs.configuration }}
MSYS2_ARG_CONV_EXCL: "*" # Disable MSYS2 path conversion
PLATFORM: ${{ inputs.platform }}
SHORT_SHA: ${{ steps.sha.outputs.short }}
WINDOWS: ${{ runner.os == 'Windows' }}
Expand Down

0 comments on commit 9a5a255

Please sign in to comment.