Skip to content

Commit

Permalink
Updates for Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ctribes committed Jan 24, 2025
1 parent a231cf1 commit c7c8c53
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 40 deletions.
39 changes: 8 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ jobs:
build_type: "Release", cc: "cl", cxx: "cl",
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
}
# - {
# name: "Windows -- MinGW", artifact: "Windows-MinGW.tar.xz",
# os: windows-latest,
# build_type: "Release", cc: "x86_64-w64-mingw32-gcc", cxx: "x86_64-w64-mingw32-g++"
# }
- {
name: "Ubuntu", artifact: "Linux.tar.xz",
os: ubuntu-latest,
Expand All @@ -48,7 +43,7 @@ jobs:

- name: Prepare Python environment
run: >-
pip install setuptools wheel cython pytest
pip install setuptools wheel cython==0.29.* pytest
- name: Install dependencies on Windows
if: startsWith(matrix.config.name, 'Windows')
Expand Down Expand Up @@ -80,7 +75,6 @@ jobs:
cmake \
-DCMAKE_CC_COMPILER=${{matrix.config.cc}} \
-DCMAKE_CXX_COMPILER=${{matrix.config.cxx}} \
-DBUILD_TESTS=ON \
-DBUILD_INTERFACE_C=ON \
-DBUILD_INTERFACE_PYTHON=ON \
-DTEST_OPENMP=OFF \
Expand All @@ -94,17 +88,8 @@ jobs:
mkdir instdir
mkdir build
cd build
if [[ "${{matrix.config.name}}" == "Windows -- MinGW" ]]; then
cmake -G "MinGW Makefiles" \
-DTEST_OPENMP=OFF \
-DBUILD_INTERFACE_C=ON \
-DBUILD_EXAMPLES=OFF \
-DCMAKE_INSTALL_PREFIX=../instdir \
..
else
cmake .. -DTEST_OPENMP=OFF -DBUILD_INTERFACE_C=ON -DBUILD_INTERFACE_PYTHON=ON -DBUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=../instdir
fi
cmake .. -DTEST_OPENMP=OFF -DBUILD_INTERFACE_C=ON -DBUILD_INTERFACE_PYTHON=ON -DBUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=../instdir
- name: Build
shell: bash
run: |
Expand All @@ -130,16 +115,8 @@ jobs:
pip install --force-reinstall dist/*.whl
pytest
- name: Prepare upload
shell: bash
run: |
mv README.txt instdir/.
mv LICENSE instdir/.
cd instdir
tar -cf NOMAD4.tar *
- name: Upload
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.os }}
path: instdir/NOMAD4.tar
# - name: Upload
# uses: actions/upload-artifact@v2
# with:
# name: ${{ matrix.config.os }}
# path: build
34 changes: 25 additions & 9 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and publish binary wheels onto PyPi
name: Build and publish binary wheels onto TestPyPi

on:
workflow_dispatch:
Expand All @@ -19,9 +19,15 @@ jobs:
os: ubuntu-latest
archs: x86_64

- name: macOS
- name: macOS_X86
os: macos-latest
archs: x86_64
extra_option: -DCMAKE_OSX_ARCHITECTURES=x86_64

- name: macOS_ARM
os: macos-latest
archs: arm64
extra_option: -DCMAKE_OSX_ARCHITECTURES=arm64

name: Wheels for ${{ matrix.target.name }}
runs-on: ${{ matrix.target.os }}
Expand All @@ -32,6 +38,10 @@ jobs:
with:
python-version: '3.8'

- name: Prepare Python environment
run: >-
pip install setuptools wheel cython==0.29.* pytest
- name: Install dependencies on Windows
if: startsWith(matrix.config.name, 'Windows')
run: |
Expand All @@ -53,12 +63,12 @@ jobs:
cmake --version
- name: Build binary wheels
uses: pypa/cibuildwheel@v2.20.0
uses: pypa/cibuildwheel@v2.16.5
env:
CIBW_ARCHS: >-
${{ matrix.target.archs }}
CIBW_BEFORE_ALL: >-
cmake -DBUILD_INTERFACE_PYTHON=ON -DTEST_OPENMP=OFF -DBUILD_EXAMPLES=OFF -S . -B build &&
cmake -DBUILD_INTERFACE_PYTHON=ON -DTEST_OPENMP=OFF -DBUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release ${{ matrix.target.extra_option }} -S . -B build &&
cmake --build build --config Release --clean-first --target nomadStatic --parallel 2
CIBW_ENVIRONMENT: >-
NOMAD_SRC=../../src
Expand All @@ -70,24 +80,27 @@ jobs:
CIBW_BUILD_FRONTEND: >-
build
CIBW_BUILD_VERBOSITY: >-
3
2
CIBW_SKIP: >-
pp*
with:
output-dir: wheelhouse
package-dir: interfaces/PyNomad

- name: Collect wheels for processing
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.target.name }}
path: wheelhouse/*.whl

# We use pypa/gh-action-pypi-publish to upload the binary wheels onto PyPi.

pypi-publish:
name: Publish to PyPi
name: Publish to TestPyPi (testing)
runs-on: ubuntu-latest
needs: build
# Specifying a GitHub environment is optional, but strongly encouraged
environment: master
environment: develop
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
Expand All @@ -96,8 +109,11 @@ jobs:
- name: Collect wheels for publication
uses: actions/download-artifact@v4
with:
name: artifact
pattern: binary-*
merge-multiple: true
path: dist

- name: Publish wheels to PyPi
- name: Publish wheels to TestPyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/

0 comments on commit c7c8c53

Please sign in to comment.