mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-07-07 02:02:21 +02:00
87 lines
4.1 KiB
YAML
87 lines
4.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions: read-all
|
|
|
|
jobs:
|
|
ci:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
packages: write
|
|
contents: write
|
|
steps:
|
|
- name: Cleanup Disk
|
|
uses: jlumbroso/free-disk-space@v1.3.1
|
|
with:
|
|
android: true
|
|
dotnet: true
|
|
haskell: true
|
|
tool-cache: true
|
|
large-packages: false
|
|
swap-storage: false
|
|
- name: Cleanup docker cache
|
|
run: |
|
|
echo "-------------Disk info before cleanup----------------"
|
|
df -h
|
|
echo "-----------------------------------------------------"
|
|
docker system prune -a -f
|
|
echo "-------------Disk info after cleanup----------------"
|
|
df -h
|
|
echo "-----------------------------------------------------"
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
# We need the full history for the commitlint task
|
|
with:
|
|
fetch-depth: 0
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
- name: Install QEMU static binaries
|
|
uses: docker/setup-qemu-action@v4
|
|
- name: Install Task
|
|
uses: arduino/setup-task@v2
|
|
- name: Install Dagger
|
|
env:
|
|
# renovate: datasource=github-tags depName=dagger/dagger versioning=semver
|
|
DAGGER_VERSION: 0.21.4
|
|
run: |
|
|
curl -L https://dl.dagger.io/dagger/install.sh | BIN_DIR=$HOME/.local/bin sh
|
|
- name: Run CI task
|
|
run: |
|
|
set +e
|
|
echo "########## BASELINE snapshot (pre-load) ##########"
|
|
echo "[host] $(df -h / | tail -1)"
|
|
echo "[host] gitdu=$(du -sh .git 2>/dev/null|cut -f1) cglayers=$(ls .git/objects/info/commit-graphs/ 2>/dev/null|wc -l)"
|
|
GITHUB_REF= timeout 220 dagger core container from --address=alpine/git \
|
|
with-mounted-directory --path=/src --source=. \
|
|
with-workdir --path=/src \
|
|
with-exec --use-entrypoint=false --args=sh,-c,'printf BASE_mb=; git merge-base origin/main HEAD 2>/dev/null || echo NONE; echo BASE_count=$(git rev-list --count HEAD 2>/dev/null); echo BASE_packls:; ls -la .git/objects/pack 2>/dev/null; echo BASE_cglayers=$(ls .git/objects/info/commit-graphs 2>/dev/null|wc -l)' \
|
|
stdout 2>/dev/null || echo "BASE_DAGGER_ERROR"
|
|
echo "########## LAUNCHING FULL task ci (parallel load) ##########"
|
|
( task ci > /tmp/taskci.log 2>&1 ) & TASKCI=$!
|
|
( for t in $(seq 1 90); do echo "[host t=$t $(date -u +%H:%M:%S)] $(df -h / | tail -1) | gitdu=$(du -sh .git 2>/dev/null|cut -f1) packb=$(du -cb .git/objects/pack/*.pack 2>/dev/null|tail -1|cut -f1)"; sleep 4; done ) & HOSTLOOP=$!
|
|
( for t in $(seq 1 20); do echo "===CTRPROBE t=$t $(date -u +%H:%M:%S)==="; GITHUB_REF= timeout 90 dagger core container from --address=alpine/git with-mounted-directory --path=/src --source=. with-workdir --path=/src with-exec --use-entrypoint=false --args=sh,-c,'printf CTR_mb=; git merge-base origin/main HEAD 2>/dev/null || echo NONE; echo CTR_count=$(git rev-list --count HEAD 2>/dev/null); echo CTR_packls:; ls -la .git/objects/pack 2>/dev/null; echo CTR_cglayers=$(ls .git/objects/info/commit-graphs 2>/dev/null|wc -l)' stdout 2>/dev/null || echo CTR_DAGGER_ERROR; sleep 7; done ) & CTRLOOP=$!
|
|
sleep 290
|
|
kill $HOSTLOOP $CTRLOOP $TASKCI 2>/dev/null
|
|
echo "########## commitlint result from task ci ##########"
|
|
grep -iE "commitlint|merge-base|Failed to run task" /tmp/taskci.log 2>/dev/null | sed -E 's/\x1b\[[0-9;]*m//g' | tail -30
|
|
exit 1
|
|
- name: Write manifest
|
|
run: |
|
|
task manifest
|
|
- name: Publish images
|
|
if: |
|
|
github.event_name == 'workflow_dispatch' ||
|
|
github.event.pull_request.head.repo.full_name == github.repository
|
|
env:
|
|
REGISTRY_USER: ${{ github.actor }}
|
|
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
task publish
|
|
- name: Attach manifest to workflow run
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: manifest.yaml
|
|
path: ./manifest.yaml
|