Add CI
This commit is contained in:
parent
d1aa5762bc
commit
4a070ac1f5
2 changed files with 102 additions and 0 deletions
62
.forgejo/workflows/ci.yml
Normal file
62
.forgejo/workflows/ci.yml
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: docker
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Install system dependencies
|
||||||
|
run: |
|
||||||
|
apt-get update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
devscripts \
|
||||||
|
debhelper \
|
||||||
|
dh-python \
|
||||||
|
python3-all-dev \
|
||||||
|
python3-setuptools \
|
||||||
|
python3-wheel \
|
||||||
|
libssl-dev \
|
||||||
|
ca-certificates \
|
||||||
|
rsync
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build deb
|
||||||
|
run: |
|
||||||
|
mkdir /out
|
||||||
|
|
||||||
|
rsync -a --delete \
|
||||||
|
--exclude '.git' \
|
||||||
|
--exclude '.venv' \
|
||||||
|
--exclude 'dist' \
|
||||||
|
--exclude 'build' \
|
||||||
|
--exclude '__pycache__' \
|
||||||
|
--exclude '.pytest_cache' \
|
||||||
|
--exclude '.mypy_cache' \
|
||||||
|
./ /out/
|
||||||
|
|
||||||
|
cd /out/
|
||||||
|
export DEBEMAIL="mig@mig5.net"
|
||||||
|
export DEBFULLNAME="Miguel Jacq"
|
||||||
|
|
||||||
|
dch --distribution "trixie" --local "~trixie" "CI build for trixie"
|
||||||
|
dpkg-buildpackage -us -uc -b
|
||||||
|
|
||||||
|
# Notify if any previous step in this job failed
|
||||||
|
- name: Notify on failure
|
||||||
|
if: ${{ failure() }}
|
||||||
|
env:
|
||||||
|
WEBHOOK_URL: ${{ secrets.NODERED_WEBHOOK_URL }}
|
||||||
|
REPOSITORY: ${{ forgejo.repository }}
|
||||||
|
RUN_NUMBER: ${{ forgejo.run_number }}
|
||||||
|
SERVER_URL: ${{ forgejo.server_url }}
|
||||||
|
run: |
|
||||||
|
curl -X POST \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"repository\":\"$REPOSITORY\",\"run_number\":\"$RUN_NUMBER\",\"status\":\"failure\",\"url\":\"$SERVER_URL/$REPOSITORY/actions/runs/$RUN_NUMBER\"}" \
|
||||||
|
"$WEBHOOK_URL"
|
||||||
40
.forgejo/workflows/trivy.yml
Normal file
40
.forgejo/workflows/trivy.yml
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
name: Trivy
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 1 * * *'
|
||||||
|
push:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: docker
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install system dependencies
|
||||||
|
run: |
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends wget gnupg
|
||||||
|
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | tee /usr/share/keyrings/trivy.gpg > /dev/null
|
||||||
|
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb generic main" | tee -a /etc/apt/sources.list.d/trivy.list
|
||||||
|
apt-get update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends trivy
|
||||||
|
|
||||||
|
- name: Run trivy
|
||||||
|
run: |
|
||||||
|
trivy fs --no-progress --ignore-unfixed --format table --disable-telemetry --skip-version-check --exit-code 1 .
|
||||||
|
|
||||||
|
# Notify if any previous step in this job failed
|
||||||
|
- name: Notify on failure
|
||||||
|
if: ${{ failure() }}
|
||||||
|
env:
|
||||||
|
WEBHOOK_URL: ${{ secrets.NODERED_WEBHOOK_URL }}
|
||||||
|
REPOSITORY: ${{ forgejo.repository }}
|
||||||
|
RUN_NUMBER: ${{ forgejo.run_number }}
|
||||||
|
SERVER_URL: ${{ forgejo.server_url }}
|
||||||
|
run: |
|
||||||
|
curl -X POST \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"repository\":\"$REPOSITORY\",\"run_number\":\"$RUN_NUMBER\",\"status\":\"failure\",\"url\":\"$SERVER_URL/$REPOSITORY/actions/runs/$RUN_NUMBER\"}" \
|
||||||
|
"$WEBHOOK_URL"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue