Skip to content

Commit

Permalink
Squash 50
Browse files Browse the repository at this point in the history
  • Loading branch information
danpf committed Nov 16, 2023
1 parent a8a924e commit 73d8c69
Show file tree
Hide file tree
Showing 39 changed files with 2,161 additions and 522 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: "cpp"

on:
workflow_dispatch:
pull_request:
push:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build and test cpp
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
cc: gcc
cxx: g++
- os: ubuntu-22.04
cc: gcc
cxx: g++
env_list: EMSCRIPTEN=ON
- os: ubuntu-22.04
cc: clang
cxx: clang++
- os: ubuntu-22.04
cc: gcc
cxx: g++
cmake_args: "-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS='-march=native'"
- os: macos-latest
cc: clang
cxx: clang++
- os: windows-latest
cc: ''
cxx: ''
runs-on: ${{ matrix.os }}
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
CMAKE_ARGS: ${{ matrix.cmake_args }}

steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

# - name: install mingw & deps
# uses: msys2/setup-msys2@v2
# with:
# update: true
# install: >-
# git
# make
# pacboy: >-
# toolchain:p
# cmake:p
# ninja:p
# if: matrix.os == 'windows-latest'

- name: Set environment list variables
run: |
env_vars="${{ matrix.env_list }}"
for var in $env_vars; do
echo "$var" >> $GITHUB_ENV
done
if: matrix.os != 'windows-latest'

- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.16.x'

- uses: seanmiddleditch/gha-setup-ninja@master

- name: build and test
run: |
mkdir build && cd build
cmake $CMAKE_ARGS -G Ninja -Dmmtf_build_examples=ON -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=debug ..
ninja
./tests/mmtf_tests
./tests/multi_cpp_test
./examples/mmtf_demo ../submodules/mmtf_spec/test-suite/mmtf/173D.mmtf
./examples/traverse ../submodules/mmtf_spec/test-suite/mmtf/173D.mmtf
./examples/traverse ../submodules/mmtf_spec/test-suite/mmtf/173D.mmtf json
./examples/traverse ../submodules/mmtf_spec/test-suite/mmtf/173D.mmtf print
./examples/print_as_pdb ../submodules/mmtf_spec/test-suite/mmtf/173D.mmtf
61 changes: 61 additions & 0 deletions .github/workflows/emscripten.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: WASM

on:
workflow_dispatch:
pull_request:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-wasm-emscripten:
name: Pyodide
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install pyodide-build
run: pip install pyodide-build==0.23.4

- name: Compute emsdk version
id: compute-emsdk-version
run: |
pyodide xbuildenv install --download
EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version)
echo "emsdk-version=$EMSCRIPTEN_VERSION" >> $GITHUB_OUTPUT
- uses: mymindstorm/setup-emsdk@v12
with:
version: ${{ steps.compute-emsdk-version.outputs.emsdk-version }}
actions-cache-folder: emsdk-cache

# A future version of pyodide may switch to -fwasm-exceptions
- name: Build
run: CFLAGS=-fexceptions LDFLAGS=-fexceptions pyodide build

- uses: actions/upload-artifact@v3
with:
path: dist/*.whl

- uses: actions/setup-node@v4
with:
node-version: 18

- name: Set up Pyodide virtual environment
run: |
pyodide venv .venv-pyodide
.venv-pyodide/bin/pip install $(echo -n dist/*.whl)
- name: Test
run: .venv-pyodide/bin/python -m unittest src/python/tests/tests.py

46 changes: 46 additions & 0 deletions .github/workflows/pip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "Pip"

on:
workflow_dispatch:
pull_request:
push:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build with Pip
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]
python-version: ["3.8", "3.11", "3.12", "pypy-3.8"]

steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

# - name: Setup cmake
# uses: jwlawson/[email protected]
# with:
# cmake-version: '3.16.x'

# - uses: seanmiddleditch/gha-setup-ninja@master

- name: Build and install
run: pip install --verbose .

- name: Test
run: python src/python/tests/tests.py

89 changes: 89 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Wheels

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
release:
types:
- published

env:
FORCE_COLOR: 3

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Build SDist
run: pipx run build --sdist

- name: Check metadata
run: pipx run twine check dist/*

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz


build_wheels:
name: Wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v4
with:
submodules: true

# - name: Set CMAKE_GENERATOR for Windows
# if: matrix.os == 'windows-latest'
# run: echo "CMAKE_GENERATOR=MinGW Makefiles" >> $GITHUB_ENV

- uses: pypa/[email protected]
env:
CIBW_ARCHS_MACOS: universal2
CIBW_ARCHS_WINDOWS: auto ARM64
CMAKE_GENERATOR: ${{ env.CMAKE_GENERATOR }}

- name: Verify clean directory
run: git diff --exit-code
shell: bash

- uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl

upload_all:
name: Upload if release
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/setup-python@v4
with:
python-version: "3.x"

- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}
Loading

0 comments on commit 73d8c69

Please sign in to comment.