-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d192f27
commit 0272d85
Showing
14 changed files
with
344 additions
and
33 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: Python Packaging | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
overrideVersion: | ||
description: Manually force a version | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- release_[0-9]+ | ||
tags: | ||
- v[0-9]+.[0-9]+.[0-9]+* | ||
release: | ||
types: | ||
- published | ||
|
||
env: | ||
ADIOS2_CUSTOM_VERSION_OVERRIDE: ${{ github.event.inputs.overrideVersion }} | ||
|
||
jobs: | ||
make_sdist: | ||
name: Make SDist | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Generate common version file | ||
run: cmake -P scripts/ci/gh-actions/config/adios-version.cmake && echo VERSION.TXT | ||
|
||
- name: Build SDist | ||
run: pipx run build --sdist | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: dist/*.tar.gz | ||
|
||
build_wheels: | ||
name: Wheel on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# os: [ubuntu-latest, windows-latest, macos-latest] | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Generate common version file | ||
run: cmake -P scripts/ci/gh-actions/config/adios-version.cmake && echo VERSION.TXT | ||
|
||
- uses: pypa/cibuildwheel@v2.16 | ||
env: | ||
CIBW_BUILD: cp*-manylinux_x86_64 | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: wheelhouse/*.whl | ||
|
||
upload_pypi: | ||
needs: [build_wheels, make_sdist] | ||
environment: pypi | ||
permissions: | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
upload_test_pypi: | ||
needs: [build_wheels, make_sdist] | ||
environment: testpypi | ||
permissions: | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
# Upload to Test PyPI for every commit on main branch | ||
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- name: Publish package distributions to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ |
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
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
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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import adios2 | ||
|
||
import sys | ||
import unittest | ||
|
||
|
||
DATA_FILENAME = "hello-world-py.bp" | ||
|
||
class TestSimpleReadWrite(unittest.TestCase): | ||
|
||
def _write(self, ad, greeting): | ||
"""write a string to a bp file""" | ||
io = ad.DeclareIO("hello-world-writer") | ||
var_greeting = io.DefineVariable("Greeting") | ||
w = io.Open(DATA_FILENAME, adios2.Mode.Write) | ||
w.BeginStep() | ||
w.Put(var_greeting, greeting) | ||
w.EndStep() | ||
w.Close() | ||
return 0 | ||
|
||
def _read(self, ad): | ||
"""read a string from to a bp file""" | ||
io = ad.DeclareIO("hello-world-reader") | ||
r = io.Open(DATA_FILENAME, adios2.Mode.Read) | ||
r.BeginStep() | ||
var_greeting = io.InquireVariable("Greeting") | ||
message = r.Get(var_greeting) | ||
r.EndStep() | ||
r.Close() | ||
return message | ||
|
||
def test_simple_read_write(self): | ||
"""driver function""" | ||
print("ADIOS2 version {0}".format(adios2.__version__)) | ||
ad = adios2.ADIOS() | ||
greeting = "Hello World from ADIOS2" | ||
self._write(ad, greeting) | ||
message = self._read(ad) | ||
print("{}".format(message)) | ||
self.assertEqual(greeting, message) | ||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
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
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
Oops, something went wrong.