Skip to content

Commit

Permalink
2025 updates (#619)
Browse files Browse the repository at this point in the history
* 2025 updates

* Update ci.yml
  • Loading branch information
arshajii authored Jan 29, 2025
1 parent d13d6a5 commit b8c1eee
Show file tree
Hide file tree
Showing 418 changed files with 72,300 additions and 561 deletions.
3 changes: 3 additions & 0 deletions .github/actions/build-manylinux-aarch64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM quay.io/pypa/manylinux2014_aarch64
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
5 changes: 5 additions & 0 deletions .github/actions/build-manylinux-aarch64/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: manylinux build (aarch64)
description: Builds Codon on manylinux (aarch64)
runs:
using: docker
image: Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ set -e
# setup
cd /github/workspace
yum -y update
yum -y install python3 python3-devel
yum -y install python3 python3-devel gcc-gfortran

# env
export PYTHONPATH=$(pwd)/test/python
export CODON_PYTHON=$(python3 test/python/find-python-library.py)
python3 -m pip install -Iv pip==21.3.1
python3 -m pip install numpy
python3 -m pip install -Iv pip==21.3.1 numpy==1.17.5

# deps
if [ ! -d ./llvm ]; then
Expand All @@ -22,6 +21,7 @@ mkdir build
export CC="$(pwd)/llvm/bin/clang"
export CXX="$(pwd)/llvm/bin/clang++"
export LLVM_DIR=$(llvm/bin/llvm-config --cmakedir)
export CODON_SYSTEM_LIBRARIES=/usr/lib64
(cd build && cmake .. -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=${CC} \
-DCMAKE_CXX_COMPILER=${CXX})
Expand All @@ -44,6 +44,7 @@ build/codon_test

# package
export CODON_BUILD_ARCHIVE=codon-$(uname -s | awk '{print tolower($0)}')-$(uname -m).tar.gz
rm -rf codon-deploy/lib/libfmt.a codon-deploy/lib/pkgconfig codon-deploy/lib/cmake codon-deploy/python/codon.egg-info codon-deploy/python/dist codon-deploy/python/build
rm -rf codon-deploy/lib/libfmt.a codon-deploy/lib/pkgconfig codon-deploy/lib/cmake \
codon-deploy/python/codon.egg-info codon-deploy/python/dist codon-deploy/python/build
tar -czf ${CODON_BUILD_ARCHIVE} codon-deploy
du -sh codon-deploy
File renamed without changes.
5 changes: 5 additions & 0 deletions .github/actions/build-manylinux-x86_64/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: manylinux build (x86_64)
description: Builds Codon on manylinux (x86_64)
runs:
using: docker
image: Dockerfile
50 changes: 50 additions & 0 deletions .github/actions/build-manylinux-x86_64/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/sh -l
set -e

# setup
cd /github/workspace
yum -y update
yum -y install python3 python3-devel gcc-gfortran

# env
export PYTHONPATH=$(pwd)/test/python
export CODON_PYTHON=$(python3 test/python/find-python-library.py)
python3 -m pip install -Iv pip==21.3.1 numpy==1.17.5

# deps
if [ ! -d ./llvm ]; then
/bin/bash scripts/deps.sh 2;
fi

# build
mkdir build
export CC="$(pwd)/llvm/bin/clang"
export CXX="$(pwd)/llvm/bin/clang++"
export LLVM_DIR=$(llvm/bin/llvm-config --cmakedir)
export CODON_SYSTEM_LIBRARIES=/usr/lib64
(cd build && cmake .. -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=${CC} \
-DCMAKE_CXX_COMPILER=${CXX})
cmake --build build --config Release -- VERBOSE=1
cmake --install build --prefix=codon-deploy

# build cython
export PATH=$PATH:$(pwd)/llvm/bin
python3 -m pip install cython wheel astunparse
(cd codon-deploy/python && python3 setup.py sdist)
CODON_DIR=$(pwd)/codon-deploy python3 -m pip install -v codon-deploy/python/dist/*.gz
python3 test/python/cython_jit.py

# test
export LD_LIBRARY_PATH=$(pwd)/build:$LD_LIBRARY_PATH
export PYTHONPATH=$(pwd):$PYTHONPATH
export CODON_PATH=$(pwd)/stdlib
ln -s build/libcodonrt.so .
build/codon_test

# package
export CODON_BUILD_ARCHIVE=codon-$(uname -s | awk '{print tolower($0)}')-$(uname -m).tar.gz
rm -rf codon-deploy/lib/libfmt.a codon-deploy/lib/pkgconfig codon-deploy/lib/cmake \
codon-deploy/python/codon.egg-info codon-deploy/python/dist codon-deploy/python/build
tar -czf ${CODON_BUILD_ARCHIVE} codon-deploy
du -sh codon-deploy
5 changes: 0 additions & 5 deletions .github/actions/build-manylinux/action.yml

This file was deleted.

73 changes: 53 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ jobs:
uses: ncipollo/release-action@v1

manylinux:
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- x86_64
# - aarch64
runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-arm-latest' || 'ubuntu-latest' }}
name: Codon CI (manylinux)
needs: create_release
permissions:
Expand All @@ -39,10 +44,15 @@ jobs:
uses: actions/cache@v4
with:
path: llvm
key: manylinux-llvm
key: manylinux-${{ matrix.arch }}-llvm

- name: Main x86_64
if: matrix.arch == 'x86_64'
uses: ./.github/actions/build-manylinux-x86_64

- name: Main
uses: ./.github/actions/build-manylinux
- name: Main aarch64
if: matrix.arch == 'aarch64'
uses: ./.github/actions/build-manylinux-aarch64

- name: Upload Release Asset
if: contains(github.ref, 'tags/v')
Expand All @@ -66,7 +76,8 @@ jobs:
matrix:
os:
- ubuntu-latest
- macos-12
- macos-latest
# - ubuntu-arm-latest
runs-on: ${{ matrix.os }}
name: Codon CI
needs: create_release
Expand All @@ -79,23 +90,49 @@ jobs:
with:
python-version: '3.9'

- name: Linux Setup
if: startsWith(matrix.os, 'ubuntu')
- name: x86_64 Linux Setup
if: startsWith(matrix.os, 'ubuntu') && matrix.os != 'ubuntu-arm-latest'
run: |
sudo apt update
sudo apt install -y gfortran libgfortran5 lsb-release wget software-properties-common gnupg
wget https://apt.llvm.org/llvm.sh
sudo chmod +x llvm.sh
sudo ./llvm.sh 17
echo "LIBEXT=so" >> $GITHUB_ENV
echo "OS_NAME=linux" >> $GITHUB_ENV
echo "CODON_SYSTEM_LIBRARIES=/usr/lib/x86_64-linux-gnu" >> $GITHUB_ENV
echo "CC=clang-17" >> $GITHUB_ENV
echo "CXX=clang++-17" >> $GITHUB_ENV
- name: Arm Linux Setup
if: matrix.os == 'ubuntu-arm-latest'
run: |
sudo apt update
sudo apt install -y gfortran libgfortran5 lsb-release wget software-properties-common gnupg
wget https://apt.llvm.org/llvm.sh
sudo chmod +x llvm.sh
sudo ./llvm.sh 17
echo "LIBEXT=so" >> $GITHUB_ENV
echo "OS_NAME=linux" >> $GITHUB_ENV
echo "CODON_SYSTEM_LIBRARIES=/usr/lib/aarch64-linux-gnu" >> $GITHUB_ENV
echo "CC=clang-17" >> $GITHUB_ENV
echo "CXX=clang++-17" >> $GITHUB_ENV
- name: macOS Setup
if: startsWith(matrix.os, 'macos')
run: |
brew install automake
echo "LIBEXT=dylib" >> $GITHUB_ENV
echo "OS_NAME=osx" >> $GITHUB_ENV
echo "CODON_SYSTEM_LIBRARIES=$(brew --prefix gcc)/lib/gcc/current" >> $GITHUB_ENV
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "FC=gfortran-12" >> $GITHUB_ENV
- name: Set up Python
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install numpy cython wheel astunparse
python -m pip install cython wheel astunparse
python -m pip install --force-reinstall -v "numpy==1.26.4"
which python
which pip
echo "CODON_PYTHON=$(python test/python/find-python-library.py)" >> $GITHUB_ENV
Expand All @@ -105,14 +142,11 @@ jobs:
uses: actions/cache@v4
with:
path: llvm
key: ${{ runner.os }}-llvm
key: ${{ runner.os }}-${{ matrix.os }}-llvm

- name: Build Dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: ./scripts/deps.sh 2
env:
CC: clang
CXX: clang++

- name: Build
run: |
Expand All @@ -123,18 +157,12 @@ jobs:
-DCMAKE_CXX_COMPILER=${CXX})
cmake --build build --config Release -- VERBOSE=1
cmake --install build --prefix=codon-deploy
env:
CC: clang
CXX: clang++
- name: Build Cython
run: |
(cd codon-deploy/python && python3 setup.py sdist)
CODON_DIR=$(pwd)/codon-deploy python -m pip install -v codon-deploy/python/dist/*.gz
python test/python/cython_jit.py
env:
CC: clang
CXX: clang++
CODON_PATH=$(pwd)/codon-deploy/lib/codon/stdlib python test/python/cython_jit.py
- name: Test
run: |
Expand All @@ -151,6 +179,11 @@ jobs:
run: |
echo "CODON_BUILD_ARCHIVE=codon-$(uname -s | awk '{print tolower($0)}')-$(uname -m).tar.gz" >> $GITHUB_ENV
- name: Codesign (macOS)
if: startsWith(matrix.os, 'macos')
run: |
codesign -f -s - codon-deploy/bin/codon codon-deploy/lib/codon/*.dylib
- name: Prepare Artifacts
run: |
cp -rf codon-deploy/python/dist .
Expand Down
Loading

0 comments on commit b8c1eee

Please sign in to comment.