Change C++ .h files into .hpp files for modernisation #849
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Codon CI | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
create_release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
permissions: | |
contents: write | |
steps: | |
- name: Create Release | |
if: contains(github.ref, 'tags/v') | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
manylinux: | |
runs-on: ubuntu-latest | |
name: Codon CI (manylinux) | |
needs: create_release | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache Dependencies | |
id: cache-deps | |
uses: actions/cache@v4 | |
with: | |
path: llvm | |
key: manylinux-llvm | |
- name: Main | |
uses: ./.github/actions/build-manylinux | |
- name: Upload Release Asset | |
if: contains(github.ref, 'tags/v') | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ./codon-linux-x86_64.tar.gz | |
asset_name: codon-linux-x86_64.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: manylinux-x86_64 | |
path: codon-linux-x86_64.tar.gz | |
main: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-12 | |
runs-on: ${{ matrix.os }} | |
name: Codon CI | |
needs: create_release | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Linux Setup | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
echo "LIBEXT=so" >> $GITHUB_ENV | |
echo "OS_NAME=linux" >> $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 | |
- name: Set up Python | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install numpy cython wheel astunparse | |
which python | |
which pip | |
echo "CODON_PYTHON=$(python test/python/find-python-library.py)" >> $GITHUB_ENV | |
- name: Cache Dependencies | |
id: cache-deps | |
uses: actions/cache@v4 | |
with: | |
path: llvm | |
key: ${{ runner.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: | | |
mkdir build | |
export LLVM_DIR=$(llvm/bin/llvm-config --cmakedir) | |
(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 | |
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++ | |
- name: Test | |
run: | | |
ln -s build/libcodonrt.${LIBEXT} . | |
build/codon_test | |
test/app/test.sh build | |
(cd test/python && CODON_DIR=$(pwd)/../../codon-deploy python3 setup.py build_ext --inplace && python3 pyext.py) | |
env: | |
CODON_PATH: ./stdlib | |
PYTHONPATH: .:./test/python | |
LD_LIBRARY_PATH: ./build | |
- name: Artifact Environment | |
run: | | |
echo "CODON_BUILD_ARCHIVE=codon-$(uname -s | awk '{print tolower($0)}')-$(uname -m).tar.gz" >> $GITHUB_ENV | |
- name: Prepare Artifacts | |
run: | | |
cp -rf codon-deploy/python/dist . | |
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 | |
- name: Upload Release Asset | |
if: contains(github.ref, 'tags/v') && startsWith(matrix.os, 'macos') | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ./codon-darwin-x86_64.tar.gz | |
asset_name: codon-darwin-x86_64.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload Artifacts | |
if: startsWith(matrix.os, 'macos') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-x86_64 | |
path: codon-darwin-x86_64.tar.gz | |
- name: Upload Artifacts | |
if: startsWith(matrix.os, 'ubuntu') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-x86_64 | |
path: codon-linux-x86_64.tar.gz | |
# - name: Publish Package | |
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && startsWith(matrix.os, 'ubuntu') | |
# uses: pypa/gh-action-pypi-publish@release/v1 |