# Gitea Actions — Copyparty Content Tag CI # Triggers: push, PR, tag builds on: push: branches: [master, main] pull_request: branches: [master, main] release: types: [created] jobs: test: runs-on: docker steps: - uses: actions/checkout@v4 # --- TSV Unit Tests (no network) --- - name: TSV Unit Tests run: | node tests/tsv-test.js # --- Copyparty API Sanity Tests --- - name: Start Copyparty Test Server run: | mkdir -p /tmp/copyparty-test-data docker run -d --name cp-test \ -p 8086:8086 \ -v /tmp/copyparty-test-data:/data \ -e CP_CONFIG=/tmp/copyparty-test-config.yaml \ 9001/copyparty:latest \ || echo "Container already running" # Write test config cat > /tmp/copyparty-test-config.yaml <<'EOF' [global] p: 8086 [accounts] user:12345 [/public/] /data/public accs: r: * [/private/user] /data/private/user accs: A: user EOF # 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 run: | bash tests/api-tests.sh - name: Cleanup Test Container if: always() run: docker stop cp-test && docker rm cp-test || true # --- Release Build --- release: needs: test if: github.event_name == 'release' runs-on: docker steps: - uses: actions/checkout@v4 - name: Build Release Artifact run: | 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/ - name: Upload Release Artifact uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITEA_TOKEN }} file: release/*.tar.gz tag: ${{ github.ref }} file_glob: true