Skip to content

Commit

Permalink
Merge pull request #11 from rockset/redo_github_ci
Browse files Browse the repository at this point in the history
Create actions to test and package things when we have new PRs
  • Loading branch information
mpatou authored Mar 4, 2024
2 parents 545cc32 + 5f08916 commit 3b5f2b5
Show file tree
Hide file tree
Showing 4 changed files with 153 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"
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Continous integration of Rockset SQLAlchemy

on:
pull_request:
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 sqlalchemy
--user
- name: Test
run: if [ $(ls -1 test/*.py |grep -v __init__.py |wc -l) -gt 0 ]; then pytest test; else true; fi

- 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 3b5f2b5

Please sign in to comment.