Skip to content

Commit 78ea0ca

Browse files
committed
Merge branch 'github_action_mac'
2 parents d7ee12f + c725c86 commit 78ea0ca

File tree

19 files changed

+696
-43
lines changed

19 files changed

+696
-43
lines changed

.github/workflows/build.yaml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Build and Test 🧪
2+
3+
on:
4+
# Schedule and workflow_dispatch (manual) only work on default branch
5+
schedule:
6+
- cron: "0 6 * * *" # Fire at 06:00 AM every day
7+
workflow_dispatch:
8+
pull_request:
9+
push:
10+
branches:
11+
- github_action_mac
12+
# - github_action_build # The name of our test branch
13+
# - master
14+
release:
15+
types:
16+
- published
17+
18+
permissions:
19+
contents: read # To read the project source code (git)
20+
# packages: read # To read the docker image from package registry
21+
22+
jobs:
23+
build_swift-t:
24+
name: Swift/T OS=${{ matrix.os }} PY=${{ matrix.python-version }}
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
matrix:
28+
os:
29+
- ubuntu-latest
30+
# - macos-14
31+
32+
# Comma separated list of python versions to test
33+
python-version: ["3.11"] # "3.8", "3.9", "3.10",
34+
35+
mpi:
36+
- mpich
37+
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
42+
# R may need to run before installing sed:
43+
- name: Set up R
44+
uses: r-lib/actions/setup-r@v2
45+
46+
- name: Install deps
47+
run: |
48+
dev/github-actions/setup-deps.sh ${{ matrix.os }}
49+
50+
# # TODO RInside
51+
- name: Install R requirements
52+
run: R -e "install.packages('RInside')"
53+
# # run: Rscript install/R-requirements.R
54+
55+
# - uses: r-lib/actions/setup-r-dependencies@v2
56+
# with:
57+
# extra-packages: any::RInside
58+
59+
60+
- name: Setup Python
61+
uses: actions/setup-python@v5
62+
with:
63+
python-version: ${{ matrix.python-version }}
64+
65+
# - name: Upgrade pip
66+
# run: python -m pip install -U pip
67+
68+
- name: Initialize swift-t settings
69+
run: |
70+
dev/build/init-settings.sh
71+
dev/github-actions/edit-settings.sh
72+
73+
# TODO set swift-t install, R, python, and ??
74+
# sed -i 's/original/new/g' file.txt
75+
# - run:
76+
# - run: sed -i 's/ENABLE_R=0/ENABLE_R=1/g' dev/build/swift-t-settings.sh
77+
78+
- name: build swift-t
79+
run: |
80+
dev/build/build-swift-t.sh -vv
81+
82+
- name: Report Swift/T version info
83+
run: /tmp/swift-t-install/stc/bin/swift-t -v
84+
85+
- name: Check that Swift/T runs
86+
run: /tmp/swift-t-install/stc/bin/swift-t -E 'trace(42);'

.github/workflows/conda.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Conda Build 🐍
2+
3+
# Build the Swift/T Anaconda package
4+
5+
env:
6+
# For Chicago time on log messages:
7+
TZ: CST6CDT
8+
9+
on:
10+
# Schedule and workflow_dispatch (manual) only work on default branch
11+
schedule:
12+
- cron: "0 6 * * *" # Fire at 06:00 AM every day
13+
workflow_dispatch:
14+
pull_request:
15+
push:
16+
branches:
17+
- github_action_mac
18+
# - master
19+
release:
20+
types:
21+
- published
22+
23+
permissions:
24+
contents: read # To read the project source code (git)
25+
26+
jobs:
27+
build_conda_pkg:
28+
name: OS=${{ matrix.os }} PY=${{ matrix.python-version }}
29+
runs-on: ${{ matrix.os }}
30+
strategy:
31+
matrix:
32+
os:
33+
# - ubuntu-latest
34+
- macos-13
35+
# - macos-14 # This is ARM64
36+
# - macos-14-arm64
37+
38+
# Comma separated list of python versions to test
39+
python-version: ["3.11"] # "3.9",
40+
41+
mpi:
42+
- mpich
43+
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
48+
- name: Setup dependencies
49+
run: |
50+
dev/github-actions/check setup-conda.sh ${{ matrix.os }}
51+
52+
- name: Save tool.log
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: tool-log
56+
path: tool.log
57+
58+
- name: Check tool.log
59+
run: |
60+
grep "setup-conda: SUCCESS" tool.log
61+
62+
- name: Build Anaconda package
63+
run: |
64+
dev/github-actions/check dev/jenkins/anaconda.sh
65+
66+
- name: Save anaconda.log
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: anaconda-log
70+
path: anaconda.log
71+
72+
- name: Check anaconda.log
73+
run: |
74+
grep "anaconda.sh: SUCCESS" tool.log
75+
76+
- name: Report Swift/T version info
77+
run: /tmp/swift-t-install/stc/bin/swift-t -v
78+
79+
- name: Check that Swift/T runs
80+
run: /tmp/swift-t-install/stc/bin/swift-t -E 'trace(42);'

dev/build/functions.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ assert()
2626
}
2727

2828
LOG()
29+
# Usage: LOG $LVL MESSAGE...
2930
{
3031
if (( ${#} == 0 ))
3132
then
@@ -125,6 +126,11 @@ check_make()
125126
MAKE_QUIET="--quiet"
126127
fi
127128

129+
if (( VERBOSITY >= $LOG_DEBUG ))
130+
then
131+
echo "using make: " $( which make )
132+
fi
133+
128134
MAKE_V=""
129135
if (( VERBOSITY == $LOG_TRACE ))
130136
then
@@ -136,9 +142,12 @@ make_clean()
136142
{
137143
if (( RUN_MAKE_CLEAN ))
138144
then
139-
if [ -f Makefile ]
145+
if [[ -f Makefile ]]
140146
then
147+
LOG $LOG_DEBUG "make_clean() ..."
141148
make clean
149+
else
150+
LOG $LOG_DEBUG "make_clean(): No Makefile."
142151
fi
143152
fi
144153
}

dev/conda/README.adoc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ toc::[]
1818
We are Anaconda project `swift-t`: +
1919
https://anaconda.org/swift-t
2020

21-
`swift-t`:: Swift/T
22-
`swift-t-r`:: Swift/T and R
21+
`swift-t`::
22+
Swift/T
23+
24+
`swift-t-r`::
25+
Swift/T and R
2326

2427
== End user interface
2528

@@ -39,7 +42,6 @@ These are standard directory names:
3942
* `linux-64`: "Linux on PC": Works
4043
* `osx-64`: "Mac on PC": Works
4144
* `osx-arm64`: "Mac on ARM": Works
42-
+
4345
This plaform skips Ant, the C compiler, and ZSH, and assumes they are on the user system:
4446
* `aarch64`: "Linux on ARM": Works
4547

@@ -145,7 +147,7 @@ Use `dev/conda/upload.sh` to automate this.
145147
== Dependencies
146148

147149
`r-rinside`::
148-
This package does not exist for `linux-aarch-64` +
150+
This package does not exist for `linux-aarch-64`
149151

150152
== M4 usage
151153

dev/conda/build-generic.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,11 @@ then
113113
done
114114
fi
115115

116-
if [[ $PLATFORM =~ osx-* ]]
116+
set -x
117+
if [[ $PLATFORM =~ osx-* ]] && [[ ${GITHUB_ACTION:-0} != 0 ]]
117118
then
119+
# Use this syntax on Mac, unless in GitHub,
120+
# where we install Homebrew gnu-sed
118121
SED_I=( sed -i "''" )
119122
else
120123
SED_I=( sed -i )
@@ -162,4 +165,7 @@ for file in turbine-config.sh; do
162165
ln -sv ../swift-t/turbine/scripts/$file .
163166
done
164167

168+
set -x
169+
ls $PREFIX/bin
170+
165171
echo "BUILD-GENERIC.SH STOP $( date '+%Y-%m-%d %H:%M:%S' )"

dev/conda/conda-platform.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
set -eu
33

44
# CONDA PLATFORM
5+
# Build conda for a given PLATFORM
56
# Dependency files are in the PLATFORM directory
67
# Generated scripts and log files are put in the PLATFORM directory
78
# Arguments:

dev/conda/helpers.zsh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,11 @@
44

55
checksum()
66
{
7-
# Use redirection to suppress filename in md5 output
7+
# Use redirection to suppress filename in program output
88
local PKG=$1
99
if [[ $PLATFORM =~ osx-* ]] {
1010
md5 -r < $PKG
1111
} else {
1212
md5sum < $PKG
1313
}
1414
}
15-
16-
print_environment()
17-
{
18-
}

dev/conda/osx-64/build.sh

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,48 @@ DEV_CONDA=$( cd $RECIPE_DIR/.. ; /bin/pwd -P )
1010
(
1111
set -eu
1212

13-
# Find Java bin directory
14-
echo CONDA_EXE=$CONDA_EXE
15-
CONDA=$( dirname $( dirname $CONDA_EXE ) )
16-
# OpenJDK home should be under MINICONDA/pkgs/openjdk-*
17-
OPENJDK=( $( find $CONDA/pkgs -type d -name "openjdk-*" ) )
18-
if (( ${#OPENJDK} == 0 ))
13+
# Find Java bin directory in Conda PREFIX sandbox
14+
# echo CONDA_EXE=$CONDA_EXE
15+
# CONDA=$( dirname $( dirname $CONDA_EXE ) )
16+
# OpenJDK home should be under PREFIX/pkgs/openjdk-*
17+
# Should be in PREFIX/bin but is not on any system
18+
# On Linux it is under $PREFIX/pkgs/openjdk-*/lib/jvm/bin
19+
# On GitHub macos-13 it is under $PREFIX/lib/jvm/bin
20+
echo FIND JAVA PREFIX $PREFIX
21+
which java javac || true
22+
conda list
23+
# Does not exist:
24+
# source $PREFIX/etc/profile.d/conda.sh
25+
set -x
26+
find $PREFIX
27+
which java javac || true
28+
echo $PATH
29+
set -x
30+
FOUND_JDK=0
31+
find $PREFIX -name java
32+
JDKS=( $( find $PREFIX/pkgs -type d -name "openjdk-*" ) )
33+
if (( ${#JDKS} > 0 ))
1934
then
20-
echo "build.sh: Could not find OpenJDK in $CONDA"
21-
exit 1
35+
JDK_BIN=${JDKS[0]}/lib/jvm/bin
36+
if ! [[ -d $JDK_BIN ]]
37+
then
38+
echo "build.sh: Broken JVM directory structure in $PREFIX"
39+
exit 1
40+
fi
41+
FOUND_JDK=1
2242
fi
23-
if ! [[ -d ${OPENJDK[0]}/lib/jvm/bin ]]
43+
if [[ -d $PREFIX/lib/jvm/bin ]]
2444
then
25-
echo "build.sh: Could not find OpenJDK binaries in $CONDA"
45+
JDK_BIN=$PREFIX/lib/jvm/bin
46+
FOUND_JDK=1
47+
fi
48+
if (( ! FOUND_JDK ))
49+
then
50+
echo "build.sh: Could not find OpenJDK in $CONDA"
2651
exit 1
2752
fi
28-
echo "build.sh: Found OpenJDK: $OPENJDK"
29-
PATH=${OPENJDK[0]}/lib/jvm/bin:$PATH
53+
echo "build.sh: Found OpenJDK bin directory: $JDK_BIN"
54+
PATH=$JDK_BIN:$PATH
3055
which java javac
3156

3257
if (( ${ENABLE_R:-0} ))
@@ -43,6 +68,6 @@ DEV_CONDA=$( cd $RECIPE_DIR/.. ; /bin/pwd -P )
4368

4469
echo "build.sh: calling build-generic.sh ..."
4570
$DEV_CONDA/build-generic.sh
46-
)
71+
) 2>&1 | dd
4772

4873
echo "build.sh: STOP"

dev/github-actions/check

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
3+
# CHECK
4+
# Run job, always return success for GitHub action
5+
# Allows us to capture artifacts and test for success later
6+
# Adds dev/github-actions to PATH to shorten commands
7+
8+
echo "CHECK: ${*}"
9+
10+
if [ ! -d dev/github-actions ]
11+
then
12+
echo "CHECK: MISCONFIGURATION!"
13+
exit 1
14+
fi
15+
16+
PATH=dev/github-actions:$PATH
17+
18+
# Run the arguments here!
19+
if ! ${*}
20+
then
21+
echo "CHECK FAILED: ${*}"
22+
fi
23+
24+
# Always succeeds.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
# SETTINGS SH
5+
# Edit swift-t-settings.sh via settings.sed
6+
# Assumes PWD is the top of the Swift/T clone
7+
# We immediately cd into /dev/
8+
9+
cd dev
10+
SETTINGS_SH=build/swift-t-settings.sh
11+
echo "Editing $SETTINGS_SH ..."
12+
sed -i -f github-actions/settings.sed build/swift-t-settings.sh

0 commit comments

Comments
 (0)