chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
# GitHub Actions workflows
|
||||
|
||||
## Test All Applications (`test-all.yml`)
|
||||
|
||||
The test workflow runs on pushes and pull requests to `main`, and can also be
|
||||
started manually. It enforces the checks that exist in the current repository:
|
||||
|
||||
- repository tooling: template-converter tests and bundled export verification;
|
||||
- FastAPI: every pytest test using the Python version and locked dependencies
|
||||
declared in `servers/fastapi`;
|
||||
- Next.js: all Node.js unit tests, ESLint, a production build, and Cypress
|
||||
component tests.
|
||||
|
||||
No test step is allowed to fail silently.
|
||||
|
||||
## Run the CI checks locally
|
||||
|
||||
Install Node.js 20+, npm, Python 3.11, and `uv`, then run:
|
||||
|
||||
```bash
|
||||
./test-local.sh
|
||||
```
|
||||
|
||||
The script installs locked dependencies and runs the same commands as the
|
||||
GitHub Actions workflow.
|
||||
|
||||
## Run one test group
|
||||
|
||||
### FastAPI
|
||||
|
||||
```bash
|
||||
cd servers/fastapi
|
||||
uv sync --locked --dev
|
||||
mkdir -p /tmp/presenton-tests/app-data /tmp/presenton-tests/temp
|
||||
APP_DATA_DIRECTORY=/tmp/presenton-tests/app-data \
|
||||
TEMP_DIRECTORY=/tmp/presenton-tests/temp \
|
||||
DATABASE_URL=sqlite+aiosqlite:////tmp/presenton-tests/test.db \
|
||||
DISABLE_ANONYMOUS_TRACKING=true \
|
||||
DISABLE_IMAGE_GENERATION=true \
|
||||
uv run --locked python -m pytest --verbose --tb=short
|
||||
```
|
||||
|
||||
### Next.js
|
||||
|
||||
```bash
|
||||
cd servers/nextjs
|
||||
npm ci
|
||||
npm test
|
||||
npm run lint
|
||||
NEXT_PUBLIC_FAST_API=http://localhost:8000 \
|
||||
NEXT_PUBLIC_URL=http://localhost:3000 \
|
||||
npm run build
|
||||
npx cypress run --component --browser electron
|
||||
```
|
||||
|
||||
### Repository tooling
|
||||
|
||||
```bash
|
||||
npm ci
|
||||
npm test
|
||||
npm run sync:presentation-export
|
||||
npm run check:presentation-export
|
||||
```
|
||||
@@ -0,0 +1,77 @@
|
||||
name: Docker Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
concurrency:
|
||||
group: docker-release-${{ github.event.release.tag_name || github.ref_name || github.run_id }}
|
||||
cancel-in-progress: false
|
||||
|
||||
env:
|
||||
IMAGE_NAME: ghcr.io/presenton/presenton
|
||||
MOVING_TAG: dev
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
name: Build and push multi-architecture image
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.release.tag_name || github.ref }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GHCR
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Prepare Docker tags
|
||||
id: docker-tags
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "release" ]]; then
|
||||
IMAGE_TAG="${{ github.event.release.tag_name }}"
|
||||
else
|
||||
IMAGE_TAG="${MOVING_TAG}"
|
||||
fi
|
||||
|
||||
{
|
||||
echo "tags<<EOF"
|
||||
echo "${IMAGE_NAME}:${IMAGE_TAG}"
|
||||
echo "EOF"
|
||||
echo "verify_tag=${IMAGE_TAG}"
|
||||
} >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Build and push multi-architecture image
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.docker-tags.outputs.tags }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Verify image
|
||||
env:
|
||||
VERIFY_TAG: ${{ steps.docker-tags.outputs.verify_tag }}
|
||||
run: |
|
||||
docker buildx imagetools inspect "${IMAGE_NAME}:${VERIFY_TAG}" | tee image-inspect.txt
|
||||
grep -q "linux/amd64" image-inspect.txt
|
||||
grep -q "linux/arm64" image-inspect.txt
|
||||
@@ -0,0 +1,53 @@
|
||||
name: Upload Release to R2
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
runs-on: ubuntu-latest
|
||||
environment: sync_r2
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download release assets
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
mkdir assets
|
||||
gh release download "${{ github.event.release.tag_name }}" --dir assets --pattern '*.deb' --pattern '*.dmg' --pattern '*.exe'
|
||||
echo "Downloaded files:"
|
||||
ls -lh assets/
|
||||
|
||||
- name: Extract version from filename
|
||||
run: |
|
||||
FILE=$(ls assets/ | head -n 1)
|
||||
VERSION=$(echo "$FILE" | sed -E 's/^Presenton-(.+)\.(deb|dmg|exe)$/\1/')
|
||||
echo "Extracted version: $VERSION"
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
|
||||
# 4. Install rclone
|
||||
- name: Install rclone
|
||||
run: |
|
||||
curl https://rclone.org/install.sh | sudo bash
|
||||
|
||||
# 5. Configure R2
|
||||
- name: Configure R2
|
||||
run: |
|
||||
mkdir -p ~/.config/rclone
|
||||
cat <<EOF > ~/.config/rclone/rclone.conf
|
||||
[r2]
|
||||
type = s3
|
||||
provider = Cloudflare
|
||||
access_key_id = ${{ secrets.R2_ACCESS_KEY }}
|
||||
secret_access_key = ${{ secrets.R2_SECRET_KEY }}
|
||||
endpoint = https://${{ secrets.R2_ACCOUNT_ID }}.r2.cloudflarestorage.com
|
||||
EOF
|
||||
|
||||
# 6. Upload to R2 (FINAL STEP)
|
||||
- name: Upload files to R2
|
||||
run: |
|
||||
rclone copy assets r2:presenton-desktop/${{ env.VERSION }} --progress --transfers=8
|
||||
@@ -0,0 +1,111 @@
|
||||
name: Test All Applications
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test-repository-tools:
|
||||
name: Test repository tooling
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run repository tests
|
||||
run: npm test
|
||||
|
||||
- name: Install presentation export runtime
|
||||
run: npm run sync:presentation-export
|
||||
|
||||
- name: Verify presentation export runtime
|
||||
run: npm run check:presentation-export
|
||||
|
||||
test-fastapi:
|
||||
name: Test FastAPI
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: servers/fastapi
|
||||
env:
|
||||
APP_DATA_DIRECTORY: /tmp/presenton-app-data
|
||||
TEMP_DIRECTORY: /tmp/presenton-temp
|
||||
DATABASE_URL: sqlite+aiosqlite:////tmp/presenton-test.db
|
||||
DISABLE_ANONYMOUS_TRACKING: "true"
|
||||
DISABLE_IMAGE_GENERATION: "true"
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Set up uv
|
||||
uses: astral-sh/setup-uv@v6
|
||||
with:
|
||||
enable-cache: true
|
||||
cache-dependency-glob: servers/fastapi/uv.lock
|
||||
|
||||
- name: Install locked dependencies
|
||||
run: uv sync --locked --dev
|
||||
|
||||
- name: Create test directories
|
||||
run: mkdir -p "$APP_DATA_DIRECTORY" "$TEMP_DIRECTORY"
|
||||
|
||||
- name: Run all pytest tests
|
||||
run: uv run --locked python -m pytest --verbose --tb=short
|
||||
|
||||
test-nextjs:
|
||||
name: Test Next.js
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: servers/nextjs
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: npm
|
||||
cache-dependency-path: servers/nextjs/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run Node.js tests
|
||||
run: npm test
|
||||
|
||||
- name: Run ESLint
|
||||
run: npm run lint
|
||||
|
||||
- name: Build application
|
||||
env:
|
||||
NEXT_PUBLIC_FAST_API: http://localhost:8000
|
||||
NEXT_PUBLIC_URL: http://localhost:3000
|
||||
run: npm run build
|
||||
|
||||
- name: Run Cypress component tests
|
||||
run: npx cypress run --component --browser electron
|
||||
Reference in New Issue
Block a user