-
Notifications
You must be signed in to change notification settings - Fork 4
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
1 parent
b09df31
commit 45ae18b
Showing
3 changed files
with
117 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Announcements | ||
* First announcement | ||
|
||
# Changes |
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,112 @@ | ||
name: Create a github release for the spark-client Python library | ||
|
||
env: | ||
BRANCH: ${{ github.ref_name }} | ||
# SNAP_VERSION: 3.3.2 | ||
VERSION: 0.0.0 | ||
# pkg_base: https://github.com/canonical/spark-k8s-toolkit-py/archive/refs/tags/v${{env.VERSION}} | ||
|
||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
jobs: | ||
checks: | ||
name: Check build condition for spark libs | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
python-version: | ||
- '3.9' | ||
- '3.10' | ||
steps: | ||
- id: checkout | ||
name: Checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.BRANCH }} | ||
fetch-depth: 0 | ||
- id: setup-python | ||
name: Setup Python | ||
uses: actions/setup-python@v2.2.2 | ||
with: | ||
python-version: ${{matrix.python-version}} | ||
architecture: x64 | ||
- id: code-checks | ||
name: Make sure the code follows conventions and tests correctly | ||
run: | | ||
make checks | ||
autorelease: | ||
name: Release the package on github | ||
needs: checks | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
strategy: | ||
fail-fast: true | ||
steps: | ||
- id: checkout | ||
name: Checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.BRANCH }} | ||
fetch-depth: 0 | ||
- id: setup-python | ||
name: Setup Python | ||
uses: actions/setup-python@v2.2.2 | ||
with: | ||
python-version: '3.10' | ||
architecture: x64 | ||
- id: build-package | ||
name: Build package | ||
run: | | ||
make checks | ||
poetry build | ||
- name: Add version to environment vars | ||
run: | | ||
echo "PROJECT_VERSION=${{ env.VERSION }}" >> $GITHUB_ENV | ||
- name: Check if tag version matches project version | ||
run: | | ||
TAG=$(git describe HEAD --tags --abbrev=0) | ||
echo $TAG | ||
echo $PROJECT_VERSION | ||
if [[ "$TAG" != "v$PROJECT_VERSION" ]]; then exit 1; fi | ||
- name: Create Github Release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
body_path: ".github/RELEASE-TEMPLATE.md" | ||
files: | | ||
dist/spark_client-${{env.PROJECT_VERSION}}-py3-none-any.whl | ||
dist/spark_client-${{env.PROJECT_VERSION}}.tar.gz | ||
test: | ||
name: Test Release | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
needs: | ||
- autorelease | ||
- checks | ||
steps: | ||
- id: check-tar-gz | ||
name: Check tar.gz package | ||
run: | | ||
# check if release is now published and available | ||
echo "Checking latest available Spark package release v${{env.VERSION}}." | ||
STATUSCODE=$(curl --silent --head https://github.com/canonical/spark-k8s-toolkit-py/archive/refs/tags/v${{env.VERSION}}.tar.gz | head -n 1 | cut -d' ' -f2) | ||
if [[ ${STATUSCODE} -ne 200 ]] && [[ ${STATUSCODE} -ne 302 ]]; then exit 1; fi | ||
- id: download-package | ||
name: Download wheel package | ||
run: | | ||
# check if release is now published and available | ||
echo "Downloading latest available Spark wheel package release v${{env.VERSION}}." | ||
wget https://github.com/canonical/spark-k8s-toolkit-py/archive/refs/tags/v${{env.VERSION}}-py3-none-any.whl --no-check-certificate | ||
- id: install-package | ||
name: Install wheel package file | ||
run: | | ||
pip install ./spark_client-${{env.VERSION}}-py3-none-any.whl |
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