Skip to content

Commit cfb170b

Browse files
authored
Publish on PyPI (#60)
* remove test for new sum factorizarion algo that imports discretize and sympde * new workflow test-PR-psydac.yml for push pipelines * use python3 * use cache for struphy test * remove WORKING_DIR from struphy_test * new workflow test-PR-struphy.yml * do not use working-directory in container * use new action Install Psydac in Container * correct action path * add forgotten inputs. * correct typo * fix cache for PR test * include compile language in cache key * include compile language in cache key for real * also in test-struphy * set correct triggers * add workflow pypi-release.yml for publishing on test.pypi * change readme * adopt name slimfeec * adopt pyproject.toml * publish on pypi on push to devel-tiny * put me and Max first as maintainers (appears on pypi) * publish under name feectools * install struphy from branch 146-... * add action * replace psydac -> feectools * compile feectools * rename package folder psydac/ -> feectools/ * import feectools * some last replacements * compile kernels * change version number * test feectools, not psydac * set for publishing on pypi
1 parent 72101a5 commit cfb170b

121 files changed

Lines changed: 794 additions & 1076 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Install Psydac in Container
2+
3+
inputs:
4+
compile_language:
5+
required: true
6+
default: c
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Git branch name
12+
id: git-branch-name
13+
uses: EthanSK/git-branch-name-action@v1
14+
- name: Echo the branch name
15+
shell: bash
16+
run: echo "Branch name ${GIT_BRANCH_NAME}"
17+
- name: Install psydac
18+
shell: bash
19+
run: |
20+
ls / -a
21+
which python3
22+
git clone https://github.com/struphy-hub/psydac-for-struphy.git
23+
cd psydac-for-struphy
24+
echo ${GIT_BRANCH_NAME}
25+
git checkout ${GIT_BRANCH_NAME}
26+
git pull
27+
source /struphy_${{ inputs.compile_language }}_/env_${{ inputs.compile_language }}_/bin/activate
28+
pip show psydac
29+
psydac-accelerate --cleanup --yes
30+
pip uninstall psydac -y
31+
python3 -m pip install . --force-reinstall --no-cache-dir
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Install Struphy in Container
2+
3+
inputs:
4+
compile_language:
5+
required: true
6+
default: c
7+
struphy_branch:
8+
required: true
9+
default: devel
10+
11+
runs:
12+
using: composite
13+
steps:
14+
- name: Git branch name
15+
id: git-branch-name
16+
uses: EthanSK/git-branch-name-action@v1
17+
- name: Echo the branch name
18+
shell: bash
19+
run: echo "Branch name ${GIT_BRANCH_NAME}"
20+
- name: Install psydac
21+
shell: bash
22+
run: |
23+
ls / -a
24+
which python3
25+
git clone https://github.com/struphy-hub/struphy.git
26+
cd struphy
27+
echo ${{ inputs.struphy_branch }}
28+
git checkout ${{ inputs.struphy_branch }}
29+
git pull
30+
source /struphy_${{ inputs.compile_language }}_/env_${{ inputs.compile_language }}_/bin/activate
31+
pip show struphy
32+
struphy compile -d
33+
pip uninstall struphy -y
34+
python3 -m pip install . --force-reinstall --no-cache-dir

.github/workflows/pypi-release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish feectools to PyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- devel-tiny
7+
8+
jobs:
9+
pypi-publish:
10+
name: Upload release to PyPI
11+
12+
runs-on: ubuntu-latest
13+
14+
environment:
15+
name: pypi
16+
url: https://pypi.org/project/feectools/
17+
# url: https://test.pypi.org/project/feectools/
18+
19+
permissions:
20+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v3
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: "3.10"
30+
31+
- name: Install build tools
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install build twine
35+
36+
- name: Build the package
37+
run: python -m build
38+
39+
- name: Publish package distributions to PyPI
40+
uses: pypa/gh-action-pypi-publish@release/v1
41+
# with:
42+
# repository-url: https://test.pypi.org/legacy/
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: PR - test Psydac in container
2+
3+
on:
4+
pull_request:
5+
branches: [devel-tiny]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
test_psydac:
20+
runs-on: ubuntu-latest
21+
22+
container:
23+
image: ghcr.io/struphy-hub/struphy/ubuntu-with-reqs:latest
24+
credentials:
25+
username: spossann
26+
password: ${{ secrets.GHCR_PROJECT_TOKEN }}
27+
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
# TODO: Make sure that struphy works with python > 3.11, keep the lower bound to 3.10
32+
python-version: [ '3.12' ]
33+
compile_language: ['c', 'fortran']
34+
35+
name: Test feectools for Python ${{ matrix.python-version }} / ${{ matrix.compile_language }}
36+
37+
steps:
38+
- name: Check for dockerenv file
39+
run: (ls /.dockerenv && echo Found dockerenv) || (echo No dockerenv)
40+
41+
- name: Checkout repo
42+
uses: actions/checkout@v4
43+
44+
- name: Install project without mpi
45+
run: |
46+
python3 -m venv env
47+
source env/bin/activate
48+
python3 -m pip install ".[test]" --no-cache-dir
49+
python3 -m pip freeze
50+
51+
- name: Compile feectools kernels
52+
run: |
53+
source env/bin/activate
54+
psydac-accelerate --language ${{ matrix.compile_language }}
55+
56+
# - name: Test Pyccel optimization flags
57+
# run: |
58+
# pytest --pyargs psydac -m pyccel --capture=no
59+
60+
- name: Initialize test directory
61+
run: |
62+
mkdir pytest
63+
cp mpi_tester.py pytest
64+
65+
- name: Run single-process tests with Pytest on Ubuntu
66+
run: |
67+
source env/bin/activate
68+
cd pytest
69+
python3 -m pytest -n auto --pyargs feectools -m "not parallel and not petsc"
70+
71+
- name: Install project with mpi
72+
run: |
73+
source env/bin/activate
74+
python3 -m pip install ".[mpi]"
75+
python3 -m pip freeze
76+
77+
- name: Run MPI tests with Pytest
78+
run: |
79+
source env/bin/activate
80+
cd pytest
81+
python3 mpi_tester.py --mpirun="mpiexec -n 4 ${MPI_OPTS}" --pyargs feectools -m "parallel and not petsc"
82+
83+
- name: Remove test directory
84+
if: always()
85+
run: |
86+
rm -rf pytest
87+
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: PR - test Struphy in container
2+
3+
on:
4+
pull_request:
5+
branches: [devel-tiny]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
test_struphy:
20+
runs-on: ubuntu-latest
21+
22+
container:
23+
image: ghcr.io/struphy-hub/struphy/ubuntu-with-struphy:latest
24+
credentials:
25+
username: spossann
26+
password: ${{ secrets.GHCR_PROJECT_TOKEN }}
27+
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
# TODO: Make sure that struphy works with python > 3.11, keep the lower bound to 3.10
32+
python-version: [ '3.12' ]
33+
compile_language: ['c', 'fortran']
34+
35+
name: Test Struphy for Python ${{ matrix.python-version }} / ${{ matrix.compile_language }}
36+
37+
steps:
38+
- name: Check for dockerenv file
39+
run: (ls /.dockerenv && echo Found dockerenv) || (echo No dockerenv)
40+
41+
- name: Checkout repo
42+
uses: actions/checkout@v4
43+
44+
- name: Check .testmondata 1
45+
run: |
46+
ls .testmon* || echo "No .testmondata"
47+
48+
- name: Setup cache for testmon
49+
uses: actions/cache@v4
50+
with:
51+
path: |
52+
.testmondata-struphy-${{ matrix.compile_language }}
53+
.testmondata-struphy-${{ matrix.compile_language }}-mpi
54+
key: testmon-struphy-${{ matrix.compile_language }}-${{ github.ref_name }}-${{ github.event.number }}-${{ github.run_number }}
55+
restore-keys: |
56+
testmon-struphy-${{ matrix.compile_language }}-${{ github.ref_name }}-${{ github.event.number }}-
57+
testmon-struphy-${{ matrix.compile_language }}-${{ github.ref_name }}
58+
testmon-struphy-${{ matrix.compile_language }}-devel
59+
testmon-struphy-${{ matrix.compile_language }}-
60+
testmon-struphy-
61+
62+
- name: Check .testmondata 2
63+
run: |
64+
ls .testmon* || echo "No .testmondata"
65+
66+
# temporary - remove after feectools merge
67+
- name: Install Struphy in container
68+
uses: ./.github/actions/install/struphy-in-container
69+
with:
70+
compile_language: ${{ matrix.compile_language }}
71+
struphy_branch: 146-install-feectools
72+
73+
- name: Install Psydac in container
74+
uses: ./.github/actions/install/psydac-in-container
75+
with:
76+
compile_language: ${{ matrix.compile_language }}
77+
78+
- name: Compile all kernels
79+
run: |
80+
source /struphy_${{ matrix.compile_language }}_/env_${{ matrix.compile_language }}_/bin/activate
81+
struphy compile --language ${{ matrix.compile_language }}
82+
# psydac-accelerate --language ${{ matrix.compile_language }}
83+
84+
- name: Run struphy unit tests
85+
env:
86+
TESTMON_DATAFILE: ${{ github.workspace }}/.testmondata-struphy-${{ matrix.compile_language }}
87+
run: |
88+
source /struphy_${{ matrix.compile_language }}_/env_${{ matrix.compile_language }}_/bin/activate
89+
struphy test Maxwell
90+
struphy test unit
91+
92+
- name: Run struphy model tests
93+
env:
94+
TESTMON_DATAFILE: ${{ github.workspace }}/.testmondata-struphy-${{ matrix.compile_language }}
95+
run: |
96+
source /struphy_${{ matrix.compile_language }}_/env_${{ matrix.compile_language }}_/bin/activate
97+
struphy test models
98+
99+
- name: Install mpi4py
100+
run: |
101+
source /struphy_${{ matrix.compile_language }}_/env_${{ matrix.compile_language }}_/bin/activate
102+
pip install -U mpi4py
103+
104+
- name: Run struphy model tests with mpi
105+
env:
106+
TESTMON_DATAFILE: ${{ github.workspace }}/.testmondata-struphy-${{ matrix.compile_language }}-mpi
107+
run: |
108+
source /struphy_${{ matrix.compile_language }}_/env_${{ matrix.compile_language }}_/bin/activate
109+
struphy test Maxwell
110+
struphy test models --mpi 2

0 commit comments

Comments
 (0)