Skip to content

Commit 3a04699

Browse files
committed
Trying to setup builds so one select custom sasmodels and sasdata branch
Cleaned up becuse some files were comitted accidently Updated workflow Test workflow to see if the approach works. Not meant to be pushed to the main branch Update test workflow Removing test workflow
1 parent 909c6a5 commit 3a04699

1 file changed

Lines changed: 62 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@ name: CI
22

33
on:
44
workflow_call:
5+
inputs:
6+
sasmodels_ref:
7+
description: 'Branch or tag for sasmodels (default: master)'
8+
required: false
9+
type: string
10+
sasdata_ref:
11+
description: 'Branch or tag for sasdata (default: master)'
12+
required: false
13+
type: string
14+
workflow_dispatch:
15+
inputs:
16+
sasmodels_ref:
17+
description: 'Branch or tag for sasmodels (default: master)'
18+
required: false
19+
type: string
20+
sasdata_ref:
21+
description: 'Branch or tag for sasdata (default: master)'
22+
required: false
23+
type: string
524
pull_request:
625
push:
726

@@ -37,6 +56,47 @@ jobs:
3756
with:
3857
msg: '[pre-commit.ci lite] apply automatic fixes for ruff linting errors'
3958

59+
set-dependency-refs:
60+
needs: [ruff]
61+
name: Set dependency refs
62+
runs-on: ubuntu-latest
63+
outputs:
64+
dependency-matrix-json: ${{ steps.set-refs.outputs.dependency_matrix }}
65+
steps:
66+
- name: Set up Python
67+
uses: actions/setup-python@v6
68+
with:
69+
python-version: 3.12
70+
71+
- name: Set dependency refs and generate matrix
72+
id: set-refs
73+
run: |
74+
# Get refs from inputs (workflow_call or workflow_dispatch) or default to master
75+
SASMODELS_REF="${{ inputs.sasmodels_ref || 'master' }}"
76+
SASDATA_REF="${{ inputs.sasdata_ref || 'master' }}"
77+
echo "Using sasmodels ref: $SASMODELS_REF"
78+
echo "Using sasdata ref: $SASDATA_REF"
79+
80+
# Generate dependency matrix as JSON using Python for proper escaping
81+
python3 << 'PYTHON_SCRIPT'
82+
import json
83+
import os
84+
85+
sasmodels_ref = os.environ.get('SASMODELS_REF', 'master')
86+
sasdata_ref = os.environ.get('SASDATA_REF', 'master')
87+
88+
dependency_matrix = [
89+
{"name": "sasdata", "url": "https://github.com/SasView/sasdata.git", "ref": sasdata_ref},
90+
{"name": "sasmodels", "url": "https://github.com/SasView/sasmodels.git", "ref": sasmodels_ref}
91+
]
92+
93+
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
94+
f.write(f"dependency_matrix={json.dumps(dependency_matrix)}\n")
95+
PYTHON_SCRIPT
96+
env:
97+
SASMODELS_REF: ${{ inputs.sasmodels_ref || 'master' }}
98+
SASDATA_REF: ${{ inputs.sasdata_ref || 'master' }}
99+
40100
matrix:
41101
needs: [ruff]
42102
name: Generate test matrix
@@ -68,17 +128,13 @@ jobs:
68128

69129

70130
build-dependencies:
71-
needs: [ruff]
131+
needs: [ruff, set-dependency-refs]
72132
runs-on: ubuntu-latest
73133

74134
strategy:
75135
fail-fast: false
76136
matrix:
77-
dependency:
78-
# the ref can be a branch or a tag
79-
- { name: "sasdata", url: "https://github.com/SasView/sasdata.git", ref: "master" }
80-
- { name: "sasmodels", url: "https://github.com/SasView/sasmodels.git", ref: "master" }
81-
# - { name: "bumps", url: "https://github.com/bumps/bumps.git", ref: "v1.0.3" }
137+
dependency: ${{ fromJson(needs.set-dependency-refs.outputs.dependency-matrix-json) }}
82138

83139
name: Build wheel ${{ matrix.dependency.name }}
84140

0 commit comments

Comments
 (0)