diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..78ff98b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +--- +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5f3da81 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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/setup-python@v5.0.0 + 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" + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..211f0f7 --- /dev/null +++ b/.github/workflows/release.yml @@ -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/setup-python@v5.0.0 + 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/gh-action-sigstore-python@v2.1.1 + 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 diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..e69de29