[pre-commit.ci] pre-commit autoupdate #72
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
# Continuous integration and delivery of the main branch. | |
name: CI/CD | |
on: | |
push: | |
branches: | |
- main | |
- master | |
tags: | |
- '*' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
release: | |
# Automatic release will run on a Github-hosted machine | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Read Current Version | |
id: read_property | |
uses: christian-draeger/[email protected] | |
with: | |
path: 'VERSION' | |
property: 'version' | |
- name: Current Version | |
run: echo ${{ steps.read_property.outputs.value }} | |
- name: Generate Release Notes | |
# Retrieves the commit message from the last commit in current branch (main) | |
# and writes it to a file called release_notes.txt | |
run: git log --format=%B -n 1 ${{ github.event.after }} > release_notes.txt | |
- name: Github Bumpversion Action | |
id: version-bump | |
uses: jasonamyers/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DEFAULT_BUMP: "patch" | |
- name: New Version | |
run: echo ${{ steps.version-bump.outputs.new_ver }} | |
- name: Push Changes To Master/Main | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tags: true | |
- name: Create Github release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.version-bump.outputs.new_ver }} | |
release_name: 'glama_${{ steps.version-bump.outputs.new_ver }}' | |
body_path: "release_notes.txt" | |
draft: false | |
prerelease: false | |
- name: Slack Failure Notification | |
if: failure() | |
uses: rtCamp/[email protected] | |
env: | |
SLACK_MESSAGE: 'Failed to release version glama_${{ steps.version-bump.outputs.new_ver }}' | |
SLACK_COLOR: '#DF5A49' | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_ICON: https://github.com/broadinstitute/glama/blob/main/.github/workflows/dnabad.png?raw=true | |
SLACK_USERNAME: glama | |
- name: Slack Success Notification | |
if: success() | |
uses: rtCamp/[email protected] | |
env: | |
SLACK_MESSAGE: 'Successfully released version glama_${{ steps.version-bump.outputs.new_ver }}' | |
SLACK_COLOR: '#50D9C9' | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_ICON: https://github.com/broadinstitute/glama/blob/main/.github/workflows/dnagood.png?raw=true | |
SLACK_USERNAME: glama | |
linux: | |
needs: [release] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
#target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] | |
target: [x86_64] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags | |
- name: 'Get Previous tag' | |
id: previoustag | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
- name: Checkout specific tag | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ steps.previoustag.outputs.tag }} | |
# - uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: -m crates/glama/Cargo.toml --release --out dist | |
sccache: 'true' | |
manylinux: auto | |
before-script-linux: | | |
# If we're running on rhel centos, install needed packages. | |
if command -v yum &> /dev/null; then | |
yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic | |
# If we're running on i686 we need to symlink libatomic | |
# in order to build openssl with -latomic flag. | |
if [[ ! -d "/usr/lib64" ]]; then | |
ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so | |
fi | |
else | |
# If we're running on debian-based system. | |
apt update -y && apt-get install -y libssl-dev openssl pkg-config | |
fi | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
macos: | |
needs: [release] | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
target: [x86_64, aarch64] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags | |
- name: 'Get Previous tag' | |
id: previoustag | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
- name: Checkout specific tag | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ steps.previoustag.outputs.tag }} | |
# - uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: -m crates/glama/Cargo.toml --release --out dist | |
sccache: 'true' | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
sdist: | |
needs: [release] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags | |
- name: 'Get Previous tag' | |
id: previoustag | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
- name: Checkout specific tag | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ steps.previoustag.outputs.tag }} | |
# - uses: actions/checkout@v3 | |
- name: Build sdist | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: -m crates/glama/Cargo.toml --out dist | |
- name: Upload sdist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
publish: | |
runs-on: ubuntu-latest | |
needs: [release, linux, macos, sdist] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
- name: Publish to PyPI | |
uses: PyO3/maturin-action@v1 | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
with: | |
command: upload | |
args: --non-interactive --skip-existing * |