This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
build(deps): bump github.com/gin-gonic/gin from 1.8.1 to 1.9.1 #313
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Server | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: {} | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '1.18' | |
- name: Install misspell | |
run: go install github.com/client9/misspell/cmd/misspell@latest | |
env: | |
GOPATH: /home/runner/go | |
- name: Check misspell | |
run: find . -type f | grep -v webroot/assets | grep -v "models/.*_testdata.*.go" | xargs /home/runner/go/bin/misspell -error | |
- name: Check if format is correct | |
run: .ci/check-gofmt | |
- name: Check that every package has a testfiles | |
run: .ci/check-testfiles | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: root | |
POSTGRES_PASSWORD: root | |
POSTGRES_DB: media_server | |
ports: | |
- 26257:5432 | |
# needed because the postgres container does not provide a healthcheck | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '1.18' | |
- name: Install swag | |
run: go install github.com/swaggo/swag/cmd/swag@latest | |
env: | |
GOPATH: /home/runner/go | |
- name: Generate Docs | |
run: /home/runner/go/bin/swag init --parseDependency --parseDepth 2 --parseInternal -g web/docs.go -o web/docs | |
- name: Test | |
run: go test -ldflags "-X dev.sum7.eu/genofire/golang-lib/web/webtest.DBConnection=postgres://root:root@localhost:26257/media_server?sslmode=disable" $(go list ./... | grep -v /vendor/) -v -failfast -p 1 -coverprofile .testCoverage.txt | |
- name: Show Coverage | |
run: go tool cover -func=".testCoverage.txt" | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '1.18' | |
- name: Install swag | |
run: go install github.com/swaggo/swag/cmd/swag@latest | |
env: | |
GOPATH: /home/runner/go | |
- name: Generate Docs | |
run: /home/runner/go/bin/swag init --parseDependency --parseDepth 2 --parseInternal -g web/docs.go -o web/docs | |
- name: Build | |
run: go build -ldflags "-X main.VERSION=$(git describe --tags)" -v | |
env: | |
CGO_ENABLED: 0 | |
- name: Archive build artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build | |
path: media-server | |
deploy: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
needs: | |
- lint | |
- test | |
- build | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: build | |
path: build/ | |
- name: Upload to Server | |
uses: up9cloud/action-rsync@master | |
env: | |
USER: ${{secrets.DEPLOY_SSH_USER}} | |
HOST: ${{secrets.DEPLOY_SSH_HOST}} | |
KEY: ${{secrets.DEPLOY_SSH_KEY}} | |
ARGS: -rzh -O --delete-after | |
SSH_ARGS: '-p ${{secrets.DEPLOY_SSH_PORT}} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' | |
SOURCE: build/media-server | |
TARGET: / |