Skip to content

Commit d7f6daa

Browse files
authored
Merge pull request #4 from ScrapeGraphAI/add-CI/CD
feat: add CI/CD
2 parents 5c223e0 + ea678ad commit d7f6daa

File tree

7 files changed

+279
-0
lines changed

7 files changed

+279
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/custom.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: Custom issue template
3+
about: Describe this issue template's purpose here.
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/workflows/code-quality.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Code Quality Checks
2+
3+
on:
4+
push:
5+
paths:
6+
- 'scrapegraphai/**'
7+
- '.github/workflows/pylint.yml'
8+
9+
jobs:
10+
quality:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v3
17+
18+
- name: Install dependencies
19+
run: uv sync --frozen
20+
21+
- name: Run Ruff
22+
run: uv run ruff check scrapegraphai
23+
24+
- name: Run Black
25+
run: uv run black --check scrapegraphai
26+
27+
- name: Run isort
28+
run: uv run isort --check-only scrapegraphai
29+
30+
- name: Analysing the code with pylint
31+
run: uv run poe pylint-ci
32+
33+
- name: Check Pylint score
34+
run: |
35+
pylint_score=$(uv run poe pylint-score-ci | grep 'Raw metrics' | awk '{print $4}')
36+
if (( $(echo "$pylint_score < 8" | bc -l) )); then
37+
echo "Pylint score is below 8. Blocking commit."
38+
exit 1
39+
else
40+
echo "Pylint score is acceptable."
41+
fi

.github/workflows/codeql.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
branches: [ "main" ]
19+
schedule:
20+
- cron: '42 19 * * 5'
21+
22+
jobs:
23+
analyze:
24+
name: Analyze
25+
# Runner size impacts CodeQL analysis time. To learn more, please see:
26+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
27+
# - https://gh.io/supported-runners-and-hardware-resources
28+
# - https://gh.io/using-larger-runners
29+
# Consider using larger runners for possible analysis time improvements.
30+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
31+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
32+
permissions:
33+
# required for all workflows
34+
security-events: write
35+
36+
# only required for workflows in private repositories
37+
actions: read
38+
contents: read
39+
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
language: [ 'python' ]
44+
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
45+
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
46+
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
47+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
48+
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@v4
52+
53+
# Initializes the CodeQL tools for scanning.
54+
- name: Initialize CodeQL
55+
uses: github/codeql-action/init@v3
56+
with:
57+
languages: ${{ matrix.language }}
58+
# If you wish to specify custom queries, you can do so here or in a config file.
59+
# By default, queries listed here will override any specified in a config file.
60+
# Prefix the list here with "+" to use these queries and those in the config file.
61+
62+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
63+
# queries: security-extended,security-and-quality

.github/workflows/release.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- pre/*
7+
8+
jobs:
9+
build:
10+
name: Build
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Install git
14+
run: |
15+
sudo apt update
16+
sudo apt install -y git
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.10'
22+
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v3
25+
26+
- name: Install Node Env
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 20
30+
31+
- name: Checkout
32+
uses: actions/[email protected]
33+
with:
34+
fetch-depth: 0
35+
persist-credentials: false
36+
37+
- name: Build and validate package
38+
run: |
39+
uv venv
40+
. .venv/bin/activate
41+
uv pip install --upgrade setuptools wheel hatchling
42+
uv sync --frozen
43+
uv pip install -e .
44+
uv build
45+
uv pip install --upgrade pkginfo==1.12.0 twine==6.0.1 # Upgrade pkginfo and install twine
46+
python -m twine check dist/*
47+
48+
- name: Debug Dist Directory
49+
run: ls -al dist
50+
51+
- name: Cache build
52+
uses: actions/cache@v3
53+
with:
54+
path: ./dist
55+
key: ${{ runner.os }}-build-${{ github.sha }}
56+
57+
release:
58+
name: Release
59+
runs-on: ubuntu-latest
60+
needs: build
61+
environment: development
62+
if: >
63+
github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/pre/beta') ||
64+
(github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged &&
65+
(github.event.pull_request.base.ref == 'main' || github.event.pull_request.base.ref == 'pre/beta'))
66+
permissions:
67+
contents: write
68+
issues: write
69+
pull-requests: write
70+
id-token: write
71+
steps:
72+
- name: Checkout repo
73+
uses: actions/[email protected]
74+
with:
75+
fetch-depth: 0
76+
persist-credentials: false
77+
78+
- name: Restore build artifacts
79+
uses: actions/cache@v3
80+
with:
81+
path: ./dist
82+
key: ${{ runner.os }}-build-${{ github.sha }}
83+
84+
- name: Semantic Release
85+
uses: cycjimmy/[email protected]
86+
with:
87+
semantic_version: 23
88+
extra_plugins: |
89+
semantic-release-pypi@3
90+
@semantic-release/git
91+
@semantic-release/commit-analyzer@12
92+
@semantic-release/release-notes-generator@13
93+
@semantic-release/github@10
94+
@semantic-release/changelog@6
95+
conventional-changelog-conventionalcommits@7
96+
env:
97+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.DS_Store
2+
.venv
3+
__pycache__
4+
*.pyc
5+
*.pyo
6+
*.pyd
7+
*.pyw
8+
*.pyz
9+
*.pywz
10+
*.pyzw
11+
*.pyzwz

0 commit comments

Comments
 (0)