Skip to content

Commit a9c1938

Browse files
committed
chore: update GH actions
Update versions Upgrade lint python workflow
1 parent e22433a commit a9c1938

6 files changed

Lines changed: 129 additions & 40 deletions

File tree

.github/workflows/lint-python.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
# https://beta.ruff.rs
2-
name: ruff
1+
name: Ruff
32
on:
43
push:
54
branches:
65
- main
76
pull_request:
87
branches:
98
- main
9+
1010
jobs:
1111
ruff:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
15-
- run: pip install --user ruff
16-
- run: ruff check --ignore="E722,F40,F841" --line-length=320 --target-version=py37 .
14+
- uses: actions/checkout@v4
15+
- uses: astral-sh/ruff-action@v3
16+
with:
17+
src: "./sendgrid"
18+
- uses: astral-sh/ruff-action@v3
19+
with:
20+
args: "format --check --diff"

.github/workflows/pr-lint.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ jobs:
77
validate:
88
name: Validate title
99
runs-on: ubuntu-latest
10+
permissions:
11+
pull-requests: read
1012
steps:
11-
- uses: amannn/action-semantic-pull-request@v5
13+
- uses: amannn/action-semantic-pull-request@v6
1214
with:
1315
types: |
1416
chore

.github/workflows/test-and-deploy.yml

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,20 @@ jobs:
1818
strategy:
1919
matrix:
2020
python-version: [ '3.9', '3.10', '3.11', '3.12' , '3.13']
21-
env:
22-
DOCKER_LOGIN: ${{ secrets.DOCKER_USERNAME && secrets.DOCKER_AUTH_TOKEN }}
2321
steps:
2422
- name: Checkout sendgrid-python
25-
uses: actions/checkout@v3
23+
uses: actions/checkout@v5
2624

27-
- name: Login to Docker Hub
28-
if: env.DOCKER_LOGIN
29-
uses: docker/login-action@v2
25+
- name: Install uv and set the Python version
26+
uses: astral-sh/setup-uv@v6
3027
with:
31-
username: ${{ secrets.DOCKER_USERNAME }}
32-
password: ${{ secrets.DOCKER_AUTH_TOKEN }}
28+
python-version: ${{ matrix.python-version }}
3329

34-
- name: Install Docker Compose
35-
run: |
36-
sudo apt-get update
37-
sudo apt-get install -y docker-compose
30+
- name: Install the project
31+
run: uv sync --locked --all-extras --group test
3832

39-
- name: Build & Test
40-
run: make test
33+
- name: Run test
34+
run: uv run coverage run -m unittest discover -s test/unit
4135

4236
deploy:
4337
name: Deploy
@@ -46,19 +40,13 @@ jobs:
4640
runs-on: ubuntu-latest
4741
steps:
4842
- name: Checkout sendgrid-python
49-
uses: actions/checkout@v3
43+
uses: actions/checkout@v5
5044

51-
- name: Set up Python
52-
uses: actions/setup-python@v6
53-
with:
54-
python-version: '3.10'
45+
- name: Install uv
46+
uses: astral-sh/setup-uv@v6
5547

56-
- name: Install dependencies
57-
run: |
58-
python -m pip install --upgrade pip
59-
pip install build
60-
pip install wheel
61-
python setup.py sdist bdist_wheel
48+
- name: Build the project
49+
run: uv build
6250

6351
- name: Create GitHub Release
6452
uses: sendgrid/dx-automator/actions/release@main

Makefile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
.PHONY: venv install test-install test test-integ test-docker clean nopyc
22

33
venv: clean
4-
@python --version || (echo "Python is not installed, please install Python 3"; exit 1);
5-
pip install virtualenv
6-
virtualenv --python=python venv
4+
@uv --version || (echo "uv is not installed, please install uv"; exit 1);
5+
uv venv --clear
76

87
install: venv
9-
. venv/bin/activate; pip install -r test/requirements.txt
10-
. venv/bin/activate; python setup.py install
11-
. venv/bin/activate; pip install -r requirements.txt
8+
uv sync --locked --all-extras --dev --group test
129

1310
test: install
14-
. venv/bin/activate; coverage run -m unittest discover -s test/unit
11+
uv run coverage run -m unittest discover -s test/unit
1512

1613
test-integ: test
17-
. venv/bin/activate; coverage run -m unittest discover -s test/integ
14+
uv run coverage run -m unittest discover -s test/integ
1815

1916
version ?= latest
2017
test-docker:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ classifiers = [
2727
[dependency-groups]
2828
dev = ["ruff>=0.13.0"]
2929
test = [
30+
"coverage>=7.10.6",
3031
"cryptography>=44.0.1",
3132
"flask==3.1.0",
3233
"more-itertools==5.0.0",

0 commit comments

Comments
 (0)