Skip to content

Commit

Permalink
Use composite actions in workflows (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
apnadkarni authored Dec 23, 2024
1 parent 56b4049 commit 5c461a6
Show file tree
Hide file tree
Showing 4 changed files with 221 additions and 245 deletions.
105 changes: 46 additions & 59 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,53 @@
name: mac
name: MacOS

on:
workflow_dispatch:
inputs:
tcltag: # User input for selecting Tcl tag
tcl-tags: # User input for selecting Tcl tag
description: 'Tcl version'
required: true
type: choice
options:
- '["core-9-0-0"]'
- '["core-8-6-13"]'
- '["main"]'
- '["core-8-6-13", "main"]'
default: '["core-8-6-13", "main"]'
type: choice
osver: # User input for selecting OS
- '["core-8-6-branch"]'
- '["core-8-6-13", "core-9-0-0"]'
- '["core-8-6-13", "core-9-0-0", "main", "core-8-6-branch"]'
default: '["core-8-6-13", "core-9-0-0"]'
runners: # User input for selecting OS
description: 'OS version'
required: true
type: choice
options:
- '["macos-latest"]'
- '["macos-12"]'
- '["macos-13"]'
- '["macos-14"]'
- '["macos-12", "macos-13", "macos-14"]'
default: '["macos-latest"]'
dotest: # Whether tests should be run
- '["macos-13", "macos-14"]'
default: '["macos-13", "macos-14"]'
run-tests: # Whether tests should be run
description: 'Run tests as well'
required: false
default: true
type: boolean
with-dyncall: # Build with dyncall
description: 'Build dyncall version'
required: false
default: true
type: boolean
with-libffi: # Build with libffi
description: 'Build libffi version'
required: false
default: true
type: boolean

jobs:
build:
strategy:
matrix:
os: ${{ fromJSON(github.event.inputs.osver) }}
tclbranch: ${{ fromJSON(github.event.inputs.tcltag) }}
runs-on: ${{ matrix.os }}
runner-os: ${{ fromJSON(github.event.inputs.runners) }}
tcl-tag: ${{ fromJSON(github.event.inputs.tcl-tags) }}
runs-on: ${{ matrix.runner-os }}

steps:

Expand All @@ -44,67 +56,42 @@ jobs:
brew update
- name: Setup Tcl
id: setup-tcl-step
uses: apnadkarni/setup-tcl@v1
id: tcl-setup-step
uses: apnadkarni/tcl-setup@v1
with:
tcl-osver: ${{ matrix.os }}
tcl-branch: ${{ matrix.tclbranch }}
tcl-tag: ${{ matrix.tcl-tag }}

- name: Install libffi
if: inputs.with-libffi
run: |
brew install libffi || true
- name: Checkout tcl-cffi
uses: actions/checkout@v4
with:
submodules: true

- name: Install dyncall
if: inputs.with-dyncall
run: |
cd ${{ runner.temp }}
wget https://dyncall.org/r1.4/dyncall-1.4.tar.gz
tar xf dyncall-1.4.tar.gz
cd dyncall-1.4
mkdir build
cd build
../configure --prefix=$GITHUB_WORKSPACE/external-libs/macos
../configure --prefix=${{ env.TCLEXTRASDIR }}
make
make install
- name: Configure with dyncall
run: |
mkdir build-dyncall
cd build-dyncall
../configure --with-tcl=${{ env.TCLDIR }}/lib LDFLAGS=-L$GITHUB_WORKSPACE/external-libs/macos/lib CPPFLAGS=-I$GITHUB_WORKSPACE/external-libs/macos/include --with-dyncall
- name: Make with dyncall
run: |
cd build-dyncall
make
- name: Test with dyncall
if: github.event.inputs.dotest
run: |
cd build-dyncall
make test
env:
ERROR_ON_FAILURES: 1

- name: Configure with libffi
run: |
mkdir build-libffi
cd build-libffi
../configure --with-tcl=${{ env.TCLDIR }}/lib LDFLAGS="-L/usr/local/opt/libffi/lib -L$HOMEBREW_PREFIX/opt/libffi/lib" CFLAGS="-I/usr/local/opt/libffi/include -I$HOMEBREW_PREFIX/opt/libffi/include" --disable-staticffi
- name: Make with libffi
run: |
cd build-libffi
make
- name: Build with dyncall extension
if: inputs.with-dyncall
uses: apnadkarni/tcl-build-extension@v1
with:
build-subdir: 'build-with-dyncall'
run-tests: ${{ inputs.run-tests }}
config-opts: 'LDFLAGS=-L${{ env.TCLEXTRASDIR }}/lib CPPFLAGS=-I${{ env.TCLEXTRASDIR }}/include --with-dyncall'

- name: Test with libffi
if: github.event.inputs.dotest
run: |
cd build-libffi
make test
env:
ERROR_ON_FAILURES: 1
- name: Build with libffi extension
if: inputs.with-libffi
uses: apnadkarni/tcl-build-extension@v1
with:
build-subdir: 'build-with-libffi'
run-tests: ${{ inputs.run-tests }}
config-opts: 'LDFLAGS="-L/usr/local/opt/libffi/lib -L$HOMEBREW_PREFIX/opt/libffi/lib" CFLAGS="-I/usr/local/opt/libffi/include -I$HOMEBREW_PREFIX/opt/libffi/include" --disable-staticffi'

146 changes: 82 additions & 64 deletions .github/workflows/mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,104 +2,122 @@ name: Mingw

on:
workflow_dispatch:
inputs:
tcl-tags: # User input for selecting Tcl tag
description: 'Tcl version'
required: true
type: choice
options:
- '["core-9-0-0"]'
- '["core-8-6-13"]'
- '["main"]'
- '["core-8-6-branch"]'
- '["core-8-6-13", "core-9-0-0"]'
- '["core-8-6-13", "core-9-0-0", "main", "core-8-6-branch"]'
default: '["core-8-6-13", "core-9-0-0"]'
runners: # User input for selecting OS
description: 'OS version'
required: true
type: choice
options:
- '["windows-latest"]'
- '["windows-2022"]'
- '["windows-2019"]'
- '["windows-2019", "windows-2022"]'
default: '["windows-latest"]'
msystems:
description: 'mingw32 and/or mingw64'
required: false
type: choice
options:
- '["mingw64"]'
- '["mingw32"]'
- '["mingw64", "mingw32"]'
default: '["mingw64", "mingw32"]'
run-tests: # Whether tests should be run
description: 'Run tests as well'
required: false
default: true
type: boolean
with-dyncall: # Build with dyncall
description: 'Build dyncall version'
required: false
default: true
type: boolean
with-libffi: # Build with libffi
description: 'Build libffi version'
required: false
default: true
type: boolean

jobs:
build:
runs-on: windows-latest
strategy:
matrix:
include:
- {os: windows-latest, tclbranch: main, arch: mingw64, cpu: x86_64}
- {os: windows-latest, tclbranch: main, arch: mingw32, cpu: i686}
- {os: windows-latest, tclbranch: core-8-6-13, arch: mingw64, cpu: x86_64}
- {os: windows-latest, tclbranch: core-8-6-13, arch: mingw32, cpu: i686}
runner-os: ${{ fromJSON(github.event.inputs.runners) }}
tcl-tag: ${{ fromJSON(github.event.inputs.tcl-tags) }}
msystem: ${{ fromJSON(github.event.inputs.msystems) }}
runs-on: ${{ matrix.runner-os }}
defaults:
run:
shell: msys2 {0}

steps:
- name: Checkout tcl-cffi
uses: actions/checkout@v4
with:
submodules: true

- name: Set up msys2
- name: Set up msys2 for mingw32
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.arch }}
msystem: ${{ matrix.msystem }}
pacboy: "git: make: gcc:p"
path-type: minimal
release: true
update: false
install: mingw-w64-${{matrix.cpu}}-gcc make
cache: true

- name: Verify toolchain
run: |
gcc -v
make -v
- name: Setup Tcl
id: setup-tcl-step
uses: apnadkarni/setup-tcl@v1
id: tcl-setup-step
uses: apnadkarni/tcl-setup@v1
with:
tcl-osver: ${{ matrix.os }}
tcl-branch: ${{ matrix.tclbranch }}
tcl-toolchain: 'mingw64'
tcl-arch: ${{ matrix.arch }}
tcl-tag: ${{ matrix.tcl-tag }}
toolchain: 'msys2'
target-arch: ${{ matrix.msystem }}

- name: Cache dyncall
id: dyncall-cache
uses: actions/cache@v4
with:
path: C:/dyncall
key: ${{ runner.os }}-dyncall-${{ matrix.arch }}
- name: Install libffi
if: inputs.with-libffi
run: |
pacman --sync --refresh --needed --noconfirm ${MINGW_PACKAGE_PREFIX}-libffi
- name: Install dyncall
if: steps.dyncall-cache.outputs.cache-hit != 'true'
if: inputs.with-dyncall
run: |
wget https://dyncall.org/r1.4/dyncall-1.4.tar.gz
tar xf dyncall-1.4.tar.gz
cd dyncall-1.4
mkdir build
cd build
../configure --prefix=/c/dyncall
../configure --prefix=${{ env.TCLEXTRASDIR }}
make
make install
- name: Install libffi
run: |
pacman --sync --refresh --needed --noconfirm ${MINGW_PACKAGE_PREFIX}-libffi
- name: Configure with dyncall
run: |
mkdir build-dyncall
cd build-dyncall
../configure --with-tcl=${{ env.TCLDIR }}/lib --with-tclinclude=${{ env.TCLDIR }}/include LDFLAGS=-L/c/dyncall/lib CPPFLAGS=-I/c/dyncall/include --with-dyncall
- name: Make with dyncall
run: |
cd build-dyncall
make
- name: Test with dyncall
run: |
cd build-dyncall
make test
env:
ERROR_ON_FAILURES: 1

- name: Configure with libffi
run: |
mkdir build-libffi
cd build-libffi
../configure --with-tcl=${{ env.TCLDIR }}/lib --with-tclinclude=${{ env.TCLDIR }}/include
- name: Build with libffi extension
if: inputs.with-libffi
uses: apnadkarni/tcl-build-extension@v1
with:
toolchain: 'msys2'
build-subdir: 'build-with-libffi'
run-tests: ${{ inputs.run-tests }}

- name: Make with libffi
run: |
cd build-libffi
make
- name: Build with dyncall extension
if: inputs.with-dyncall
uses: apnadkarni/tcl-build-extension@v1
with:
toolchain: 'msys2'
build-subdir: 'build-with-dyncall'
run-tests: ${{ inputs.run-tests }}
config-opts: 'LDFLAGS=-L${{ env.TCLEXTRASDIR }}/lib CPPFLAGS=-I${{ env.TCLEXTRASDIR }}/include --with-dyncall'

- name: Test with libffi
run: |
cd build-libffi
make test
env:
ERROR_ON_FAILURES: 1
Loading

0 comments on commit 5c461a6

Please sign in to comment.