-
Notifications
You must be signed in to change notification settings - Fork 1
122 lines (102 loc) · 3.31 KB
/
ci-cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Release
on:
push:
branches:
- main
- pre/*
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
run: pip install poetry
- name: Install dependencies
run: poetry install --no-interaction --no-ansi
- name: Build the package
run: poetry build
test:
name: Test
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
run: pip install poetry
- name: Install dependencies
run: poetry install --no-interaction --no-ansi
- name: Run Linting and Formatting Checks
run: |
poetry run ruff check langchain_scrapegraph tests
poetry run black --check langchain_scrapegraph tests
poetry run isort --check-only langchain_scrapegraph tests
# - name: Run Type Checking
# run: poetry run mypy langchain_scrapegraph tests
- name: Run Tests
run: |
poetry run pytest --disable-socket --allow-unix-socket --asyncio-mode=auto tests/unit_tests
poetry run pytest --asyncio-mode=auto tests/integration_tests
# - name: Upload Coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# files: coverage.xml
# fail_ci_if_error: false
# token: ${{ secrets.CODECOV_TOKEN }}
release:
name: Release
runs-on: ubuntu-latest
needs: [build, test]
if: |
github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/pre/')) ||
github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged &&
(github.event.pull_request.base.ref == 'main' || startsWith(github.event.pull_request.base.ref, 'pre/'))
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
run: pip install poetry
- name: Install dependencies
run: poetry install --no-interaction --no-ansi
- name: Semantic Release
uses: cycjimmy/[email protected]
with:
semantic_version: 23
extra_plugins: |
semantic-release-pypi@3
@semantic-release/git
@semantic-release/commit-analyzer@12
@semantic-release/release-notes-generator@13
@semantic-release/github@10
@semantic-release/changelog@6
conventional-changelog-conventionalcommits@7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}