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 3abf2f3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
23 changes: 16 additions & 7 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 @@ -29,29 +33,33 @@ jobs:

- uses: ./
with:
artifact-name: autobuild-${{ matrix.os }}
artifact-name: autobuild-${{ matrix.os }}-${{ matrix.cygwin }}
cygwin: ${{ matrix.cygwin }}
checkout: false

- shell: bash
run: rm -rf stage

- uses: ./
with:
artifact-name: autobuild-scm-${{ matrix.os }}
artifact-name: autobuild-scm-${{ matrix.os }}-${{ matrix.cygwin }}
cygwin: ${{ matrix.cygwin }}
checkout: false
file: autobuild-scm.xml

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

# Test alternative compression-format
- uses: ./
with:
artifact-name: autobuild-tbz2-${{ matrix.os }}
artifact-name: autobuild-tbz2-${{ matrix.os }}-${{ matrix.cygwin }}
cygwin: ${{ matrix.cygwin }}
archive-format: tbz2
checkout: false
- name: Check bz2 package
Expand All @@ -65,10 +73,11 @@ jobs:

- uses: ./
with:
artifact-name: autobuild-py310-${{ matrix.os }}
artifact-name: autobuild-py310-${{ matrix.os }}-${{ matrix.cygwin }}
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' && fromJSON(inputs.cygwin) }}
uses: secondlife/setup-cygwin@v3
with:
packages: ${{ inputs.cygwin-packages }}

- name: Setup mysys2
if: ${{ runner.os == 'Windows' && 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: ${{ fromJSON(inputs.cygwin) }}
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 3abf2f3

Please sign in to comment.