Skip to content

Commit e9b35b5

Browse files
author
Denis Jelovina
committed
Enable publishing to TestPyPI in GitHub Actions workflow and add Git metadata retrieval in CMakeLists.txt
1 parent cda713a commit e9b35b5

File tree

2 files changed

+42
-15
lines changed

2 files changed

+42
-15
lines changed

.github/workflows/pyalp-publish.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -172,18 +172,24 @@ jobs:
172172
name: pyalp-wheels-${{ matrix.os }}
173173
path: wheelhouse/*.whl
174174

175-
# Placeholder for publish job; enable when versioning is PEP 440 compliant
176-
# publish:
177-
# needs: build-wheels
178-
# runs-on: ubuntu-latest
179-
# permissions:
180-
# id-token: write
181-
# steps:
182-
# - name: Download wheels
183-
# uses: actions/download-artifact@v4
184-
# with:
185-
# path: dist
186-
# - name: Publish to PyPI
187-
# uses: pypa/gh-action-pypi-publish@release/v1
188-
# with:
189-
# packages-dir: dist
175+
publish:
176+
needs: build-wheels
177+
runs-on: ubuntu-latest
178+
environment:
179+
name: testpypi
180+
url: https://test.pypi.org/p/pyalp
181+
permissions:
182+
id-token: write
183+
steps:
184+
- name: Download all wheels
185+
uses: actions/download-artifact@v4
186+
with:
187+
path: dist
188+
pattern: pyalp-wheels-*
189+
merge-multiple: true
190+
- name: Publish to TestPyPI
191+
uses: pypa/gh-action-pypi-publish@release/v1
192+
with:
193+
repository-url: https://test.pypi.org/legacy/
194+
packages-dir: dist/
195+
verbose: true

CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,27 @@ project( GraphBLAS
3737
DESCRIPTION "The ultimate engine for sparse computation"
3838
LANGUAGES CXX C
3939
)
40+
41+
# Find Git and get repository information for metadata
42+
find_package(Git QUIET)
43+
if(GIT_FOUND)
44+
execute_process(
45+
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
46+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
47+
OUTPUT_VARIABLE ALP_GIT_COMMIT
48+
OUTPUT_STRIP_TRAILING_WHITESPACE
49+
)
50+
execute_process(
51+
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
52+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
53+
OUTPUT_VARIABLE ALP_GIT_BRANCH
54+
OUTPUT_STRIP_TRAILING_WHITESPACE
55+
)
56+
else()
57+
set(ALP_GIT_COMMIT "unknown")
58+
set(ALP_GIT_BRANCH "unknown")
59+
endif()
60+
4061
set( CMAKE_CXX_STANDARD 11 )
4162
set( CMAKE_CXX_STANDARD_REQUIRED ON )
4263

0 commit comments

Comments
 (0)