Skip to content

Commit f29d8b3

Browse files
authored
fix: add github action workflow (supabase#73)
1 parent bf9ae1c commit f29d8b3

File tree

8 files changed

+1085
-38
lines changed

8 files changed

+1085
-38
lines changed

.github/workflows/ci-python.yml

-34
This file was deleted.

.github/workflows/ci.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
test:
12+
name: Test / OS ${{ matrix.os }} / Python ${{ matrix.python-version }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
python-version: [3.8, 3.9, "3.10", "3.11"]
17+
runs-on: ${{ matrix.os }}
18+
steps:
19+
- name: Clone Repository
20+
uses: actions/checkout@v2
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Set up Poetry
28+
uses: abatilo/[email protected]
29+
with:
30+
poetry-version: 1.3.2
31+
32+
# - name: Run Tests
33+
# env:
34+
# SUPABASE_ID: ${{ secrets.SUPABASE_ID }}
35+
# API_KEY: ${{ secrets.API_KEY }}
36+
# run: make run_tests
37+
38+
# - name: Upload Coverage
39+
# uses: codecov/codecov-action@v1
40+
publish:
41+
needs: test
42+
if: ${{ !startsWith(github.event.head_commit.message, 'bump') && !startsWith(github.event.head_commit.message, 'chore') && github.ref == 'refs/heads/main' && contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) && github.repository_owner == 'supabase-community' }}
43+
runs-on: ubuntu-latest
44+
name: "Bump version, create changelog and publish"
45+
environment:
46+
name: pypi
47+
url: https://pypi.org/p/realtime
48+
permissions:
49+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
50+
contents: write # needed for github actions bot to write to repo
51+
steps:
52+
- name: Clone Repository
53+
uses: actions/checkout@v3
54+
with:
55+
ref: ${{ github.ref }}
56+
fetch-depth: 0
57+
token: ${{ secrets.SILENTWORKS_PAT }}
58+
- name: Python Semantic Release
59+
id: release
60+
uses: python-semantic-release/[email protected]
61+
with:
62+
github_token: ${{ secrets.GITHUB_TOKEN }}
63+
64+
- name: Publish package distributions to PyPI
65+
uses: pypa/gh-action-pypi-publish@release/v1
66+
# NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
67+
# See https://github.com/actions/runner/issues/1173
68+
if: steps.release.outputs.released == 'true'
69+
70+
- name: Publish package distributions to GitHub Releases
71+
uses: python-semantic-release/upload-to-gh-release@main
72+
if: steps.release.outputs.released == 'true'
73+
with:
74+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,4 @@ dmypy.json
140140
.DS_Store
141141

142142
.idea/*
143-
# End of https://www.toptal.com/developers/gitignore/api/python
143+
# End of https://www.toptal.com/developers/gitignore/api/python

.pre-commit-config.yaml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
exclude: '^.*\.(md|MD|html)$'
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.0.1
5+
hooks:
6+
- id: trailing-whitespace
7+
- id: check-added-large-files
8+
- id: end-of-file-fixer
9+
- id: mixed-line-ending
10+
args: ["--fix=lf"]
11+
12+
- repo: https://github.com/pycqa/isort
13+
rev: 5.12.0
14+
hooks:
15+
- id: isort
16+
args:
17+
[
18+
"--profile",
19+
"black",
20+
"--multi-line=3",
21+
"--trailing-comma",
22+
"--force-grid-wrap=0",
23+
"--use-parentheses",
24+
"--line-width=88",
25+
]
26+
27+
- repo: https://github.com/myint/autoflake.git
28+
rev: v2.2.1
29+
hooks:
30+
- id: autoflake
31+
args:
32+
[
33+
"--in-place",
34+
"--remove-all-unused-imports",
35+
"--ignore-init-module-imports",
36+
]
37+
38+
- repo: https://github.com/psf/black
39+
rev: "23.3.0"
40+
hooks:
41+
- id: black
42+
43+
- repo: https://github.com/asottile/pyupgrade
44+
rev: v2.29.1
45+
hooks:
46+
- id: pyupgrade
47+
args: ["--py37-plus", "--keep-runtime-typing"]
48+
49+
- repo: https://github.com/commitizen-tools/commitizen
50+
rev: v2.20.0
51+
hooks:
52+
- id: commitizen
53+
stages: [commit-msg]

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Lionell Loh Jian An
3+
Copyright (c) 2020 Lionell Loh Jian An
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
install:
2+
poetry install
3+
4+
install_poetry:
5+
curl -sSL https://install.python-poetry.org | python -
6+
poetry install
7+
8+
tests: install tests_only tests_pre_commit
9+
10+
tests_pre_commit:
11+
poetry run pre-commit run --all-files
12+
13+
run_tests: tests
14+
15+
tests_only:
16+
poetry run pytest --cov=./ --cov-report=xml --cov-report=html -vv
17+
18+
build_sync:
19+
poetry run unasync realtime tests

0 commit comments

Comments
 (0)