Files
Copyparty-content-tag/.gitea/workflows/ci.yaml
T
Frog-Lover-Antony 582b5ea8cb
/ test (push) Failing after 34s
/ release (push) Has been skipped
CI native clone + docker
2026-07-18 18:51:00 +03:00

128 lines
3.7 KiB
YAML

# Gitea Actions — Copyparty Content Tag CI
# Fully Docker-based: no host-side tooling (no Node.js, no git) required.
# Every step runs inside a Docker container with its own dependencies.
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
release:
types: [created]
env:
WS: /ws
jobs:
test:
runs-on: docker
# Shared workspace volume so containers can pass files between steps
container:
image: alpine:latest
steps:
# --- Clone repo inside an Alpine container with git ---
- name: Checkout Source
run: |
apk add --no-cache git
mkdir -p $WS && cd $WS
git clone $GITEA_REPOSITORY_URL .
git checkout $GITEA_REVISION
# --- TSV Unit Tests inside Node container ---
- name: TSV Unit Tests
run: |
docker run --rm \
-v $WS:$WS \
-w $WS/tests \
node:22-slim \
node tsv-test.js
# --- Copyparty API Sanity Tests ---
- name: Prepare Test Data & Config
run: |
apk add --no-cache curl
mkdir -p /tmp/copyparty-data/public /tmp/copyparty-data/private/user
cat > /tmp/copyparty-config.ini <<'EOF'
[global]
p = 8086
[accounts]
user = 12345
[/public/]
/data/public
accs:
r = *
[/private/user]
/data/private/user
accs:
A = user
EOF
- name: Start Copyparty Test Server
run: |
apk add --no-cache curl
docker run -d --name cp-test \
-p 8086:8086 \
-v /tmp/copyparty-data:/data \
-v /tmp/copyparty-config.ini:/etc/copyparty/config.ini:ro \
-e CP_CONFIG=/etc/copyparty/config.ini \
9001/copyparty:latest \
|| { docker restart cp-test; true }
# Wait for server to be ready
for i in $(seq 1 30); do
curl -sf http://localhost:8086/?ls >/dev/null 2>&1 && break
sleep 2
done
- name: API Sanity Tests (in job container)
run: |
apk add --no-cache curl jq bash
cd $WS/tests && bash api-tests.sh
- name: Cleanup Test Container
if: always()
run: |
apk add --no-cache curl
docker stop cp-test && docker rm cp-test || true
# --- Release Build ---
release:
needs: test
if: github.event_name == 'release'
runs-on: docker
container:
image: alpine:latest
steps:
- name: Checkout Source
run: |
apk add --no-cache git
mkdir -p $WS && cd $WS
git clone $GITEA_REPOSITORY_URL .
git checkout $GITEA_REVISION
# --- Build release artifact inside Alpine container ---
- name: Build Release Artifact
run: |
apk add --no-cache tar coreutils
mkdir -p /release/copyparty-content-tag
cp src/*.html src/*.css src/*.js /release/copyparty-content-tag/
cd /release
sha256sum copyparty-content-tag/* > checksums.sha256
tar czf copyparty-content-tag.tar.gz copyparty-content-tag/
# --- Upload to Gitea Release via API (no JS action needed) ---
- name: Upload Release Artifact
run: |
apk add --no-cache curl
TAG=$(echo "$GITEA_REF" | sed 's|refs/tags||')
curl -sSf -X POST \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary @/release/copyparty-content-tag.tar.gz \
"$GITEA_SERVER_URL/api/repos/$GITEA_REPOSITORY/releases.attachments?name=copyparty-content-tag.tar.gz&tag=$TAG"