Set working directory #16
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
name: Build | |
on: | |
push: | |
pull_request: | |
release: | |
types: | |
- published | |
env: | |
CIBW_ARCHS_MACOS: x86_64 arm64 | |
CIBW_BEFORE_ALL_LINUX: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain=stable --profile=minimal -y | |
CIBW_ENVIRONMENT_LINUX: 'PATH="$HOME/.cargo/bin:$PATH"' | |
CIBW_SKIP: cp36-* cp37-* pp* *i686 | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- run: rustup target add aarch64-apple-darwin | |
if: startsWith(matrix.os, 'macos') | |
- run: rustup target add i686-pc-windows-msvc | |
if: startsWith(matrix.os, 'windows') | |
- uses: pypa/[email protected] | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheelhouse | |
path: ./wheelhouse/*.whl | |
import_library: | |
needs: [build_wheels] | |
strategy: | |
matrix: | |
python: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
name: Import library on ${{ matrix.os }} with Python ${{ matrix.python }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheelhouse | |
path: wheelhouse | |
- run: ls wheelhouse # @DEV | |
- run: for file in *.whl; do mv $file "$(printf "$file" | sed -r 's/^(colourtime)-(\d\.\d\.\d)-(.+)$/\1-\2+local-\3/')"; done | |
working-directory: wheelhouse | |
- run: ls wheelhouse # @DEV | |
- run: python -m pip install --find-links wheelhouse colourtime+local | |
shell: bash | |
- run: python -c 'import colourtime' | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: pipx run build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [build_wheels, import_library, build_sdist] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheelhouse | |
path: wheelhouse | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- run: mv wheelhouse/* dist/ | |
- uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |