Skip to content

Commit

Permalink
Create actions to test and package things when we have new PRs
Browse files Browse the repository at this point in the history
Summary

We now have a set of action to test the client when a new PRs is
created.
And also actions to publish a new release and push it to pypi when we
create a new version (ie. v1.0.0).

This is very similar to what we have done for `stacky` and it worked
well.

Testing

Let' see the test results
  • Loading branch information
mpatou committed Mar 4, 2024
1 parent 545cc32 commit ae4cb34
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: Continous integration of Rockset SQLAlchemy

on:
pull_request:
branches:
- master
- main
types: [opened, synchronize, edited, ready_for_review]

jobs:
ci:
name: build and archive
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
python-version: '3.10'
- name: Install pypa/build
run: >-
python3 -m
pip install
build pytest
--user
- name: Test
run: pytest test

- name: Build a binary wheel and a source tarball
run: python3 -m build

- name: Persist build artifacts
uses: actions/upload-artifact@v4
with:
name: sqlalchemy_draft_wheel
path: |
dist/*.whl
retention-days: 2

linter:
name: runner / black formatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
options: "--check --verbose"
src: "./src"

94 changes: 94 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Act on release created

on:
push:
tags:
- 'v*' # Run workflow on version tags, e.g. v1.0.0.

permissions:
contents: write

jobs:
build_wheel:
name: Build wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/[email protected]
with:
python-version: '3.10'

- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build

- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/


publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
needs:
- build_wheel
- bazel_build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/rockset-sqlalchemy
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1


github_release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- run: sha256sum dist/*.whl >dist/$(ls -1 dist/*whl |sed 's@.*/@@').sha256
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
generate_release_notes: true
files: |
./dist/*.tar.gz
./dist/*.whl
./dist/*.whl.sha256
Empty file added test/__init__.py
Empty file.

0 comments on commit ae4cb34

Please sign in to comment.