-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
2 changed files
with
161 additions
and
0 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
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,158 @@ | ||
name: Release | ||
|
||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
# https://matklad.github.io/2021/09/04/fast-rust-builds.html | ||
# indicates that non-incremental builds improve CI performance. | ||
CARGO_INCREMENTAL: 0 | ||
# Since we're not shipping any build artifacts, turning off debug | ||
# symbols will speed things up without hurting anything. | ||
RUSTFLAGS: '-C debuginfo=0' | ||
|
||
# All the build jobs except linux specify no-sdist so we only build it | ||
# once. The linux job is also special since that's the only one in | ||
# which we run clippy. | ||
|
||
jobs: | ||
# This only runs when we push to main. Instead of running tests, we | ||
# bump the version and make a tag. | ||
BumpVersion: | ||
runs-on: ubuntu-latest | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
#if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# - run: git config user.name "GitHub actions" | ||
# - run: git config user.email "[email protected]" | ||
# - run: python3 -m pip install --user python-semantic-release | ||
# - run: python -m semantic_release version -v DEBUG -D commit_author="github-actions <[email protected]>" | ||
|
||
- name: Python Semantic Release | ||
uses: relekang/python-semantic-release@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- run: git push | ||
|
||
# These Build* jobs run all the time except when we're pushing to | ||
# main; we've already run tests in the PR and after we increment the | ||
# semantic release number, we're going to run tests on that commit | ||
# anyway so there's no point to run tests a third time. | ||
BuildLinux: | ||
runs-on: ubuntu-latest | ||
needs: [ BumpVersion ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions-rs/clippy-check@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: --all-features | ||
|
||
# Looks like cargo-bloat-action won't be working for us anytime | ||
# soon unfortunately.... | ||
# - name: cargo bloat | ||
# uses: orf/cargo-bloat-action@v1 | ||
# with: | ||
# token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: maturin build | ||
uses: messense/maturin-action@v1 | ||
with: | ||
manylinux: manylinux2014 | ||
command: build | ||
args: --release --strip -o dist | ||
|
||
- name: install locally built wheel | ||
run: pip install --user --find-links=dist geo_rasterize --force-reinstall | ||
|
||
- name: run doctests | ||
run: python -m doctest -v README.md | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist | ||
retention-days: 2 | ||
|
||
BuildWindows: | ||
runs-on: windows-latest | ||
needs: [ BumpVersion ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- uses: messense/maturin-action@v1 | ||
with: | ||
command: build | ||
args: --release --strip --no-sdist -o dist | ||
|
||
- name: install locally built wheel | ||
run: pip install --user --find-links=dist geo_rasterize --force-reinstall | ||
|
||
- name: run doctests | ||
run: python -m doctest -v README.md | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist | ||
retention-days: 2 | ||
|
||
BuildMacOS: | ||
runs-on: macos-latest | ||
needs: [ BumpVersion ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- uses: messense/maturin-action@v1 | ||
with: | ||
command: build | ||
args: --release --strip --no-sdist -o dist --universal2 | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist | ||
retention-days: 2 | ||
|
||
# We've got a new version! `Build` will run and after it finishes we | ||
# can publish! | ||
Publish: | ||
runs-on: ubuntu-latest | ||
needs: [ BuildLinux, BuildWindows, BuildMacOS ] | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: wheels | ||
- name: Publish to PyPI | ||
uses: messense/maturin-action@v1 | ||
env: | ||
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | ||
with: | ||
command: upload | ||
args: --repository-url=https://test.pypi.org/legacy/ --username=msalib --skip-existing * |