Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHA: Cleanup custom swig usage #2200

Merged
merged 2 commits into from
Nov 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/actions/setup-swig/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Set up SWIG
description: |
Download and build SWIG and set the SWIG environment variable to the path of
the SWIG executable.

inputs:
swig_version:
description: 'Swig version to build'
required: false
default: '4.1.1'

runs:
using: "composite"
steps:
- name: Download and build SWIG
run: scripts/downloadAndBuildSwig.sh
shell: bash

- run: echo "SWIG=${AMICI_DIR}/ThirdParty/swig-${{ inputs.swig_version }}/install/bin/swig" >> $GITHUB_ENV
shell: bash
8 changes: 3 additions & 5 deletions .github/workflows/deploy_branch.yml
Original file line number Diff line number Diff line change
@@ -21,12 +21,10 @@ jobs:
with:
fetch-depth: 20

- run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV
- run: echo "SWIG=${AMICI_DIR}/ThirdParty/swig-4.0.1/install/bin/swig" >> $GITHUB_ENV
- name: Set up SWIG
uses: ./.github/actions/setup-swig

- name: Build swig4
run: |
sudo scripts/downloadAndBuildSwig.sh
- run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV

- name: Create AMICI sdist
run: |
8 changes: 3 additions & 5 deletions .github/workflows/deploy_release.yml
Original file line number Diff line number Diff line change
@@ -24,12 +24,10 @@ jobs:
with:
fetch-depth: 20

- run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV
- run: echo "SWIG=${AMICI_DIR}/ThirdParty/swig-4.0.1/install/bin/swig" >> $GITHUB_ENV
- name: Set up SWIG
uses: ./.github/actions/setup-swig

- name: Build swig4
run: |
sudo scripts/downloadAndBuildSwig.sh
- run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV

- name: sdist
run: |
5 changes: 1 addition & 4 deletions .github/workflows/test_doc.yml
Original file line number Diff line number Diff line change
@@ -68,7 +68,6 @@ jobs:
- run: git fetch --prune --unshallow

- run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV
- run: echo "SWIG=${AMICI_DIR}/ThirdParty/swig-4.1.1/install/bin/swig" >> $GITHUB_ENV

- name: Build doxygen
run: |
@@ -85,9 +84,7 @@ jobs:
pandoc \
python3-venv \

- name: Build swig
run: |
sudo scripts/downloadAndBuildSwig.sh
- uses: ./.github/actions/setup-swig

- name: sphinx
run: |
6 changes: 4 additions & 2 deletions scripts/downloadAndBuildSwig.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env bash
# Download and build SWIG
set -e
#
# Usage: downloadAndBuildSwig.sh [swig_version]
set -euo pipefail

SCRIPT_PATH=$(dirname "$BASH_SOURCE")
AMICI_PATH=$(cd "$SCRIPT_PATH/.." && pwd)

swig_version=4.1.1
swig_version="${1:-"4.1.1"}"
SWIG_ARCHIVE="swig-${swig_version}.tar.gz"
SWIG_URL="http://downloads.sourceforge.net/project/swig/swig/swig-${swig_version}/${SWIG_ARCHIVE}"
SWIG_DIR="swig-${swig_version}"