mirror of
https://github.com/gtsteffaniak/filebrowser.git
synced 2026-11-26 16:39:41 -05:00
192 lines
6.4 KiB
YAML
192 lines
6.4 KiB
YAML
name: PR Request
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- "main"
|
|
- "dev/v*.*.*"
|
|
- "beta/v*.*.*"
|
|
- "stable/v*.*.*"
|
|
- "staging/v*.*.*"
|
|
jobs:
|
|
prime_docker_cache:
|
|
name: Prime docker cache
|
|
runs-on: ubuntu-24.04-arm
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Prime Cache
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: _docker/Dockerfile.primecache
|
|
push: false
|
|
load: false
|
|
cache-to: |
|
|
type=gha,mode=max,scope=${{ github.ref_name }}-playwright-base
|
|
build_frontend:
|
|
name: Build frontend
|
|
runs-on: ubuntu-24.04-arm
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: frontend/.nvmrc
|
|
- name: Build frontend
|
|
working-directory: frontend
|
|
run: npm ci && npm run build
|
|
- name: Upload frontend build artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dist
|
|
path: frontend/dist
|
|
build_backend:
|
|
name: Build backend
|
|
runs-on: ubuntu-24.04-arm
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 'stable'
|
|
- name: Build backend
|
|
working-directory: backend
|
|
run: go build -o filebrowser .
|
|
- name: Upload backend build artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: filebrowser
|
|
path: backend/filebrowser
|
|
test_playwright:
|
|
needs: [build_backend, build_frontend, prime_docker_cache]
|
|
name: Test Playwright - ${{ matrix.name }}
|
|
runs-on: ubuntu-24.04-arm
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: general
|
|
dockerfile: ./_docker/Dockerfile.playwright-general
|
|
- name: proxy
|
|
dockerfile: ./_docker/Dockerfile.playwright-proxy
|
|
- name: noauth
|
|
dockerfile: ./_docker/Dockerfile.playwright-noauth
|
|
- name: oidc
|
|
dockerfile: ./_docker/Dockerfile.playwright-oidc
|
|
- name: sharing
|
|
dockerfile: ./_docker/Dockerfile.playwright-sharing
|
|
- name: no-config
|
|
dockerfile: ./_docker/Dockerfile.playwright-no-config
|
|
- name: settings
|
|
dockerfile: ./_docker/Dockerfile.playwright-settings
|
|
- name: screenshots
|
|
dockerfile: ./_docker/Dockerfile.playwright-screenshots
|
|
- name: previews
|
|
dockerfile: ./_docker/Dockerfile.playwright-previews
|
|
- name: jwt
|
|
dockerfile: ./_docker/Dockerfile.playwright-jwt
|
|
- name: performance
|
|
dockerfile: ./_docker/Dockerfile.playwright-performance
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Download frontend build
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: dist
|
|
path: frontend/dist
|
|
- name: Download backend build
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: filebrowser
|
|
path: backend/
|
|
- name: Make backend executable
|
|
run: chmod +x backend/filebrowser
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3.0.0
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3.0.0
|
|
- name: Build and Test
|
|
id: build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ${{ matrix.dockerfile }}
|
|
push: false
|
|
load: true
|
|
cache-from: |
|
|
type=gha,scope=${{ github.ref_name }}-playwright-base
|
|
type=gha,scope=main-playwright-base
|
|
cache-to: |
|
|
type=gha,mode=max,scope=${{ github.ref_name }}-playwright-base
|
|
- name: Extract listing performance results
|
|
if: matrix.name == 'performance' && success()
|
|
run: |
|
|
mkdir -p perf-artifact
|
|
cid=$(docker create "${{ steps.build.outputs.imageid }}")
|
|
docker cp "$cid:/app/frontend/test-results/listing-performance-perf/results.json" perf-artifact/results.json
|
|
docker rm "$cid"
|
|
- name: Upload listing performance results
|
|
if: matrix.name == 'performance' && success()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: listing-performance-results
|
|
path: perf-artifact/results.json
|
|
retention-days: 7
|
|
push_pr_to_registry:
|
|
name: Build docker image
|
|
runs-on: ubuntu-24.04-arm
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3.0.0
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3.0.0
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./_docker/Dockerfile.slim
|
|
push: false # Do not push the image for now
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-args: |
|
|
VERSION=${{ steps.meta.outputs.version }}
|
|
REVISION=${{ steps.meta.outputs.revision }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
build_media_docker_image:
|
|
name: Build media docker image
|
|
runs-on: ubuntu-24.04-arm
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3.0.0
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3.0.0
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./_docker/Dockerfile.media
|
|
push: false # Do not push the image for now
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-args: |
|
|
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
|
|
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
|
cache-from: type=gha,scope=pr-media
|
|
cache-to: type=gha,mode=max,scope=pr-media
|