diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7eddf476..44302200 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,16 +1,14 @@ -name: wheels +name: release on: - push: - tags: - # 'r[0-9]+.[0-9]+.[0-9]+' to match semantic version tag, e.g. r2.0.8 - - "r[0-9]+.[0-9]+.[0-9]+" + release: + types: [published] jobs: build: name: build py3.${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }} strategy: - fail-fast: false + fail-fast: true matrix: os: - ubuntu @@ -30,11 +28,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: set up python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - name: set up rust if: matrix.os != 'ubuntu' uses: actions-rs/toolchain@v1 @@ -54,22 +47,29 @@ jobs: override: true - run: cd rust/ && cargo test - - name: install python dependencies - run: pip install -U setuptools wheel twine cibuildwheel plotly + - name: set up python + uses: actions/setup-python@v4 + with: + python-version: "3.10" - - name: build sdist - if: matrix.os == 'ubuntu' && matrix.python-version == '8' + - name: install Python dependencies + run: pip install -U setuptools wheel twine cibuildwheel pytest + + - name: build source distribution + if: matrix.os == 'ubuntu' && matrix.python-version == '10' run: | pip install -U setuptools-rust - python setup.py sdist + python -c "import setuptools; setuptools.setup()" sdist + - name: build ${{ matrix.platform || matrix.os }} binaries run: cibuildwheel --output-dir dist env: CIBW_BUILD: "cp3${{ matrix.python-version }}-*" CIBW_SKIP: "*-win32 *-musllinux* *i686 *ppc64le *s390x *aarch64" CIBW_PLATFORM: ${{ matrix.platform || matrix.os }} - CIBW_TEST_REQUIRES: "pytest" - CIBW_TEST_COMMAND: "pytest -v {project}/python/fastsim/tests" + # TODO: why doesn't pytest work with cibuildwheel? + # CIBW_TEST_COMMAND: "pytest -v {project}/python/fastsim/tests" + CIBW_TEST_COMMAND: "python -m unittest discover {project}/python/fastsim/tests" CIBW_ARCHS_MACOS: 'universal2' # see https://cibuildwheel.readthedocs.io/en/stable/faq/#universal2 CIBW_TEST_SKIP: '*_universal2:arm64' @@ -85,6 +85,7 @@ jobs: pip install -U setuptools-rust && curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y && rustup show + # - name: build windows 32bit binaries # if: matrix.os == 'windows' # run: cibuildwheel --output-dir dist @@ -100,6 +101,7 @@ jobs: # rustup default nightly-i686-pc-windows-msvc && # rustup override set nightly-i686-pc-windows-msvc && # rustup show + - name: list dist files run: ${{ matrix.ls || 'ls -lh' }} dist/ @@ -107,11 +109,25 @@ jobs: with: path: ./dist/* - - name: twine check - run: twine check dist/* - - - name: upload to pypi - run: twine upload dist/* + release: + needs: build + name: release files to PyPI + runs-on: ubuntu-latest + steps: + - name: download files + uses: actions/download-artifact@v2.1.1 + + - name: set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - run: pip install twine + + - run: twine check ./artifact/* + + - name: upload files + run: twine upload ./artifact/* env: TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.fastsim_pypi_token }} \ No newline at end of file + TWINE_PASSWORD: ${{ secrets.fastsim_pypi_token }} diff --git a/.github/workflows/wheels.yaml b/.github/workflows/wheels.yaml index 1b233abc..3a081382 100644 --- a/.github/workflows/wheels.yaml +++ b/.github/workflows/wheels.yaml @@ -10,7 +10,7 @@ jobs: build: name: build py3.${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }} strategy: - fail-fast: false + fail-fast: true matrix: os: - ubuntu @@ -30,11 +30,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: set up python - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - name: set up rust if: matrix.os != 'ubuntu' uses: actions-rs/toolchain@v1 @@ -42,6 +37,7 @@ jobs: profile: minimal toolchain: stable override: true + - run: rustup target add aarch64-apple-darwin if: matrix.os == 'macos' @@ -53,22 +49,29 @@ jobs: override: true - run: cd rust/ && cargo test - - name: install python dependencies - run: pip install -U setuptools wheel twine cibuildwheel plotly + - name: set up python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: install Python dependencies + run: pip install -U setuptools wheel twine cibuildwheel pytest - - name: build sdist - if: matrix.os == 'ubuntu' && matrix.python-version == '8' + - name: build source distribution + if: matrix.os == 'ubuntu' && matrix.python-version == '10' run: | pip install -U setuptools-rust - python setup.py sdist + python -c "import setuptools; setuptools.setup()" sdist + - name: build ${{ matrix.platform || matrix.os }} binaries run: cibuildwheel --output-dir dist env: CIBW_BUILD: "cp3${{ matrix.python-version }}-*" CIBW_SKIP: "*-win32 *-musllinux* *i686 *ppc64le *s390x *aarch64" CIBW_PLATFORM: ${{ matrix.platform || matrix.os }} - CIBW_TEST_REQUIRES: "pytest" - CIBW_TEST_COMMAND: "pytest -v {project}/python/fastsim/tests" + # TODO: why doesn't pytest work with cibuildwheel? + # CIBW_TEST_COMMAND: "pytest -v {project}/python/fastsim/tests" + CIBW_TEST_COMMAND: "python -m unittest discover {project}/python/fastsim/tests" CIBW_ARCHS_MACOS: 'universal2' # see https://cibuildwheel.readthedocs.io/en/stable/faq/#universal2 CIBW_TEST_SKIP: '*_universal2:arm64' @@ -84,6 +87,7 @@ jobs: pip install -U setuptools-rust && curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y && rustup show + # - name: build windows 32bit binaries # if: matrix.os == 'windows' # run: cibuildwheel --output-dir dist @@ -99,9 +103,10 @@ jobs: # rustup default nightly-i686-pc-windows-msvc && # rustup override set nightly-i686-pc-windows-msvc && # rustup show + - name: list dist files run: ${{ matrix.ls || 'ls -lh' }} dist/ - uses: actions/upload-artifact@v3 with: - path: ./dist/* \ No newline at end of file + path: ./dist/* diff --git a/README.md b/README.md index eac3a8ed..4a0f01c8 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ out = component output Rust versions of classes have limited Language Server Protocol integration, and we are actively working on fixing this. # Release Notes +2.1.0 -- release and installation improvements, RustVehicle init cleanup, calibration improvements 2.0.11 - 2.0.22 -- PyPI fixes. Also, Rust version is now >100x faster than Python version. 2.0.10 -- logging fixes, proc macro reorganization, some CAVs performance fixes 2.0.9 -- support for mac ARM/RISC architecture diff --git a/pyproject.toml b/pyproject.toml index f869bf0a..f4256535 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "fastsim" -version = "2.0.22" +version = "2.1.0" authors = [{ name = "NREL/MTES/CIMS/MBAP Group", email = "fastsim@nrel.gov" }] description = "Tool for modeling vehicle powertrains" readme = "README.md" @@ -21,16 +21,18 @@ dependencies = [ "pandas>=1", "matplotlib>=3.3", "numpy>=1.18", + "scipy", "seaborn>=0.10", "typing_extensions", "pyyaml", + "pytest", ] [project.urls] Homepage = "https://www.nrel.gov/transportation/fastsim.html" [project.optional-dependencies] -dev = ["black", "pytest", "maturin", "plotly", "ipykernel", "pymoo==0.6.0.1",] +dev = ["black", "maturin", "plotly", "ipykernel", "pymoo==0.6.0.1",] [tool.setuptools] zip-safe = false