Add workflows (#31)

Co-authored-by: Graham Steffaniak <graham.steffaniak@autodesk.com>
This commit is contained in:
Graham Steffaniak 2023-09-15 17:14:18 -05:00 committed by GitHub
parent 3ae1f5b9d0
commit 1285c020d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 51 additions and 88 deletions

View File

@ -1,4 +1,4 @@
backend/database.db backend/**.db
backend/vendor/** backend/vendor/**
frontend/dist/** frontend/dist/**
frontend/node_modules/** frontend/node_modules/**

View File

@ -3,98 +3,57 @@ name: main
on: on:
push: push:
branches: branches:
- 'master' - 'main'
tags: - 'v\d+.\d+.\d+'
- 'v*'
pull_request: pull_request:
branches:
- 'main'
- 'v\d+.\d+.\d+'
jobs: jobs:
# linters
lint-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- run: make lint-frontend
lint-backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.20.1
- run: make lint-backend
lint-commits:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: '16'
- run: make lint-commits
lint:
runs-on: ubuntu-latest
needs: [lint-frontend, lint-backend, lint-commits]
steps:
- run: echo "done"
# tests
test-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- run: make test-frontend
test-backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.20.1
- run: make test-backend
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [test-frontend, test-backend]
steps: steps:
- run: echo "done" - uses: actions/checkout@v3
- uses: actions/setup-go@v4
# release with:
release: go-version: 1.21.1
- run: cd backend && go test -race -v ./...
lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [lint, test]
if: startsWith(github.event.ref, 'refs/tags/v')
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-go@v4
with: with:
fetch-depth: 0 go-version: 1.21.1
- uses: actions/setup-go@v2 - run: cd backend && go fmt ./...
with: push_to_registry:
go-version: 1.20.1 needs: [lint, test]
- uses: actions/setup-node@v2 name: Push Docker image to Docker Hub
with: runs-on: ubuntu-latest
node-version: '16' if: contains(github.ref, 'main') || startsWith(github.ref,'v0.')
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v3
- name: Build frontend - name: Log in to Docker Hub
run: make build-frontend uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
- name: Login to Docker Hub
uses: docker/login-action@v1
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run GoReleaser - name: Extract metadata (tags, labels) for Docker
uses: goreleaser/goreleaser-action@v2 id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with: with:
version: latest images: gtstef/filebrowser
args: release --rm-dist - name: Build and push
env: uses: docker/build-push-action@v5
GITHUB_TOKEN: ${{ secrets.GH_PAT }} with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
file: ./Dockerfile
push: true
tags: ${{ contains(github.ref, 'main') && 'latest' || steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@ -16,9 +16,9 @@ jobs:
stale-pr-message: 'This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' stale-pr-message: 'This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
close-pr-message: 'This PR was closed because it has been stalled for 5 days with no activity.' close-pr-message: 'This PR was closed because it has been stalled for 5 days with no activity.'
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.' close-issue-message: 'This issue was closed because it has been stalled for 30 days with no activity.'
days-before-stale: 30 days-before-stale: 30
days-before-close: 5 days-before-close: 30
exempt-issue-labels: 'feature ☘,enhancement ⚙,bug 🐞' exempt-issue-labels: 'feature ☘,enhancement ⚙,bug 🐞'
exempt-pr-labels: 'need-help,wip' exempt-pr-labels: 'need-help,wip'
operations-per-run: 100 operations-per-run: 100

View File

@ -8,6 +8,7 @@ RUN npm run build
FROM golang:1.21-alpine as base FROM golang:1.21-alpine as base
WORKDIR /app WORKDIR /app
COPY ./backend ./ COPY ./backend ./
RUN go get -u golang.org/x/net
RUN go build -ldflags="-w -s" -o filebrowser . RUN go build -ldflags="-w -s" -o filebrowser .
FROM alpine:latest FROM alpine:latest

View File

@ -1,5 +1,5 @@
<p align="center"> <p align="center">
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-green.svg?color=3F51B5&style=for-the-badge&label=License&logoColor=000000&labelColor=ececec" alt="License: MIT"></a> <a href="https://opensource.org/license/apache-2-0/"><img src="https://img.shields.io/badge/License-Apache_2.0-blue.svg" alt="License: Apache-2.0"></a>
</p> </p>
<p align="center"> <p align="center">
<img src="frontend/public/img/icons/favicon-256x256.png" width="100" title="Login With Custom URL"> <img src="frontend/public/img/icons/favicon-256x256.png" width="100" title="Login With Custom URL">

View File

@ -1,6 +1,6 @@
module github.com/gtsteffaniak/filebrowser module github.com/gtsteffaniak/filebrowser
go 1.21.0 go 1.21
require ( require (
github.com/asdine/storm/v3 v3.2.1 github.com/asdine/storm/v3 v3.2.1

View File

@ -6,7 +6,10 @@
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"fix": "npx vue-cli-service lint", "fix": "npx vue-cli-service lint",
"watch": "vue-cli-service build --watch" "watch": "vue-cli-service build --watch",
"lint": "eslint --ext .vue,.js src/",
"lint:fix": "eslint --ext .vue,.js --fix src/",
"format": "prettier --write ."
}, },
"dependencies": { "dependencies": {
"ace-builds": "^1.24.2", "ace-builds": "^1.24.2",