Compare commits
13 Commits
1ea72011b7
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b893969d2 | ||
|
|
f9f38adadc | ||
|
|
f3eae9291b | ||
|
|
5eb64d034e | ||
|
|
18992c63e1 | ||
|
|
ed513251db | ||
|
|
f14d067779 | ||
|
|
aae9b0f771 | ||
|
|
e9c8290f9c | ||
|
|
875997aa45 | ||
|
|
900813fc20 | ||
|
|
28f78567df | ||
|
|
2f7b82047d |
83
.gitea/workflows/ci.yml
Normal file
83
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,83 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: linux
|
||||
container:
|
||||
image: python:3.12-alpine
|
||||
steps:
|
||||
- name: Checkout
|
||||
run: |
|
||||
apk add --no-cache -q git
|
||||
git clone --depth 1 --branch "${GITHUB_REF_NAME}" \
|
||||
"https://oauth2:${{ github.token }}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" .
|
||||
- name: Install ruff
|
||||
run: pip install --no-cache-dir -q ruff
|
||||
- name: Lint
|
||||
run: ruff check src/ tests/
|
||||
|
||||
test:
|
||||
runs-on: linux
|
||||
needs: [lint]
|
||||
container:
|
||||
image: python:3.12-alpine
|
||||
steps:
|
||||
- name: Checkout
|
||||
run: |
|
||||
apk add --no-cache -q git
|
||||
git clone --depth 1 --branch "${GITHUB_REF_NAME}" \
|
||||
"https://oauth2:${{ github.token }}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" .
|
||||
- name: Install deps
|
||||
run: |
|
||||
pip install --no-cache-dir -q -r requirements.txt
|
||||
pip install --no-cache-dir -q pytest pytest-asyncio
|
||||
- name: Test
|
||||
run: PYTHONPATH=src pytest tests/ -v
|
||||
|
||||
secrets:
|
||||
runs-on: linux
|
||||
container:
|
||||
image: alpine:latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
run: |
|
||||
apk add --no-cache -q git curl
|
||||
git clone --branch "${GITHUB_REF_NAME}" \
|
||||
"https://oauth2:${{ github.token }}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" .
|
||||
- name: Install gitleaks
|
||||
run: |
|
||||
ARCH=$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/')
|
||||
VER=$(curl -sI https://github.com/gitleaks/gitleaks/releases/latest | grep -i location | grep -oE 'v[0-9.]+' | tr -d v)
|
||||
curl -sSL "https://github.com/gitleaks/gitleaks/releases/download/v${VER}/gitleaks_${VER}_linux_${ARCH}.tar.gz" \
|
||||
| tar xz -C /usr/local/bin/ gitleaks
|
||||
- name: Scan for secrets
|
||||
run: gitleaks detect --source . -v
|
||||
|
||||
build:
|
||||
runs-on: linux
|
||||
needs: [test, secrets]
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
container:
|
||||
image: docker:latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
run: |
|
||||
apk add --no-cache -q git
|
||||
git clone --depth 1 --branch "${GITHUB_REF_NAME}" \
|
||||
"https://oauth2:${{ github.token }}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" .
|
||||
- name: Login to Harbor
|
||||
run: echo "$HARBOR_PASS" | docker login -u "$HARBOR_USER" --password-stdin harbor.mymx.me
|
||||
env:
|
||||
HARBOR_USER: ${{ secrets.HARBOR_USER }}
|
||||
HARBOR_PASS: ${{ secrets.HARBOR_PASS }}
|
||||
- name: Build and push
|
||||
run: |
|
||||
TAG="harbor.mymx.me/library/bouncer:${GITHUB_SHA::8}"
|
||||
LATEST="harbor.mymx.me/library/bouncer:latest"
|
||||
docker build --push -t "$TAG" -t "$LATEST" -f Containerfile .
|
||||
3
.gitleaks.toml
Normal file
3
.gitleaks.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
[allowlist]
|
||||
description = "Test fixture false positives"
|
||||
paths = ["tests/test_captcha\\.py"]
|
||||
@@ -1,19 +1,19 @@
|
||||
FROM python:3.12-slim
|
||||
FROM python:3.12-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN pip install --no-cache-dir \
|
||||
"python-socks[asyncio]>=2.4" \
|
||||
"aiosqlite>=0.19" \
|
||||
"aiohttp>=3.9" \
|
||||
"aiohttp-socks>=0.8" \
|
||||
"cryptography>=41.0"
|
||||
COPY requirements.txt .
|
||||
RUN apk add --no-cache --virtual .build gcc musl-dev libffi-dev openssl-dev && \
|
||||
pip install --no-cache-dir --upgrade pip && \
|
||||
pip install --no-cache-dir -r requirements.txt && \
|
||||
apk del .build
|
||||
|
||||
COPY src/ /app/src/
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV PYTHONPATH=/app/src
|
||||
|
||||
VOLUME /app/src
|
||||
VOLUME /data
|
||||
|
||||
ENTRYPOINT ["python", "-m", "bouncer"]
|
||||
|
||||
5
requirements.txt
Normal file
5
requirements.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
python-socks[asyncio]>=2.4
|
||||
aiosqlite>=0.19
|
||||
aiohttp>=3.9
|
||||
aiohttp-socks>=0.8
|
||||
cryptography>=41.0
|
||||
Reference in New Issue
Block a user