filebrowser/.github/workflows/pr-merge.yaml

82 lines
2.2 KiB
YAML
Raw Normal View History

name: pr-merge
on:
pull_request:
branches:
- 'main'
- 'dev_v*'
2023-09-24 18:57:11 +00:00
- 'v[0-9]+.[0-9]+.[0-9]+'
2023-10-10 13:09:59 +00:00
jobs:
2023-09-25 01:03:09 +00:00
test-backend:
runs-on: ubuntu-latest
steps:
2024-07-30 17:45:27 +00:00
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
2024-07-30 17:45:27 +00:00
go-version: 'stable'
- working-directory: backend
run: go test -race -v ./...
2023-09-25 01:03:09 +00:00
lint-backend:
runs-on: ubuntu-latest
steps:
2024-07-30 17:45:27 +00:00
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
2023-09-25 01:03:09 +00:00
with:
2024-07-30 17:45:27 +00:00
go-version: 'stable'
- uses: golangci/golangci-lint-action@v6
with:
version: v1.59
working-directory: backend
2023-09-25 01:03:09 +00:00
format-backend:
runs-on: ubuntu-latest
steps:
2024-07-30 17:45:27 +00:00
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
2024-07-30 17:45:27 +00:00
go-version: 'stable'
- working-directory: backend
run: go fmt ./...
2023-09-25 01:03:09 +00:00
lint-frontend:
runs-on: ubuntu-latest
steps:
2024-07-30 17:45:27 +00:00
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- working-directory: frontend
run: npm i eslint && npm run lint
2023-09-25 01:03:09 +00:00
push_pr_to_registry:
name: Push PR
runs-on: ubuntu-latest
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
# Workaround to fix error:
# failed to push: failed to copy: io: read/write on closed pipe
# See https://github.com/docker/build-push-action/issues/761
with:
driver-opts: |
image=moby/buildkit:v0.10.6
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
2024-07-30 17:45:27 +00:00
uses: docker/metadata-action@v5
with:
images: gtstef/filebrowser
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
2024-07-30 17:45:27 +00:00
labels: ${{ steps.meta.outputs.labels }}