2020-04-24 00:32:51 +02:00
|
|
|
name: Pipeline
|
2020-04-25 18:12:48 +02:00
|
|
|
on:
|
2020-04-25 18:06:05 +02:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-04-25 18:35:36 +02:00
|
|
|
tags:
|
|
|
|
- "v*"
|
2020-04-25 18:06:05 +02:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-01-26 18:36:24 +01:00
|
|
|
jobs:
|
2020-09-05 21:10:21 +02:00
|
|
|
golangci-lint:
|
|
|
|
name: Lint Server
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Install taglib
|
|
|
|
run: sudo apt-get install libtag1-dev
|
|
|
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: golangci-lint
|
2020-10-12 17:30:41 +02:00
|
|
|
uses: golangci/golangci-lint-action@v2
|
2020-09-05 21:10:21 +02:00
|
|
|
with:
|
2021-05-11 18:30:11 +02:00
|
|
|
version: v1.40
|
2020-09-05 21:10:21 +02:00
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
args: --timeout 2m
|
|
|
|
|
|
|
|
go:
|
2021-02-03 20:39:59 +01:00
|
|
|
name: Test Server with Go ${{ matrix.go_version }}
|
2020-09-05 21:10:21 +02:00
|
|
|
runs-on: ubuntu-latest
|
2021-02-03 20:39:59 +01:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-03-12 17:06:51 +01:00
|
|
|
go_version: [1.16.x]
|
2020-09-05 21:10:21 +02:00
|
|
|
steps:
|
|
|
|
- name: Install taglib
|
|
|
|
run: sudo apt-get install libtag1-dev
|
|
|
|
|
2021-02-03 20:39:59 +01:00
|
|
|
- name: Set up Go ${{ matrix.go_version }}
|
2020-10-12 17:58:38 +02:00
|
|
|
uses: actions/setup-go@v2
|
2020-09-05 21:10:21 +02:00
|
|
|
with:
|
2021-02-03 20:39:59 +01:00
|
|
|
stable: '!contains(${{ matrix.go_version }}, "beta") && !contains(${{ matrix.go_version }}, "rc")'
|
|
|
|
go-version: ${{ matrix.go_version }}
|
2020-09-05 21:10:21 +02:00
|
|
|
id: go
|
|
|
|
|
|
|
|
- name: Check out code into the Go module directory
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2020-10-12 17:58:38 +02:00
|
|
|
- uses: actions/cache@v2
|
2020-09-05 21:10:21 +02:00
|
|
|
id: cache-go
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
2021-02-03 20:39:59 +01:00
|
|
|
key: ${{ runner.os }}-go-${{ matrix.go_version }}-${{ hashFiles('**/go.sum') }}
|
2020-09-05 21:10:21 +02:00
|
|
|
restore-keys: |
|
2021-02-03 20:39:59 +01:00
|
|
|
${{ runner.os }}-go-${{ matrix.go_version }}-
|
2020-09-05 21:10:21 +02:00
|
|
|
|
|
|
|
- name: Download dependencies
|
|
|
|
if: steps.cache-go.outputs.cache-hit != 'true'
|
2021-02-03 20:39:59 +01:00
|
|
|
continue-on-error: ${{contains(matrix.go_version, 'beta') || contains(matrix.go_version, 'rc')}}
|
2020-09-05 21:10:21 +02:00
|
|
|
run: go mod download
|
|
|
|
|
|
|
|
- name: Test
|
2021-02-03 20:39:59 +01:00
|
|
|
continue-on-error: ${{contains(matrix.go_version, 'beta') || contains(matrix.go_version, 'rc')}}
|
2020-09-05 21:10:21 +02:00
|
|
|
run: go test -cover ./... -v
|
2020-04-17 19:52:18 +02:00
|
|
|
js:
|
|
|
|
name: Build JS bundle
|
2020-01-26 18:36:24 +01:00
|
|
|
runs-on: ubuntu-latest
|
2021-02-01 22:40:55 +01:00
|
|
|
env:
|
|
|
|
NODE_OPTIONS: '--max_old_space_size=4096'
|
2020-01-26 18:36:24 +01:00
|
|
|
steps:
|
2020-04-17 19:52:18 +02:00
|
|
|
- uses: actions/checkout@v2
|
2020-01-26 18:36:24 +01:00
|
|
|
- uses: actions/setup-node@v1
|
|
|
|
with:
|
2021-05-25 16:53:16 +02:00
|
|
|
node-version: 16
|
2020-04-17 19:22:11 +02:00
|
|
|
|
2020-10-12 17:58:38 +02:00
|
|
|
- uses: actions/cache@v2
|
2020-04-17 19:52:18 +02:00
|
|
|
id: cache-npm
|
|
|
|
with:
|
|
|
|
path: ~/.npm
|
|
|
|
key: ${{ runner.os }}-node-${{ hashFiles('ui/package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-node-
|
|
|
|
|
|
|
|
- name: npm install dependencies
|
2020-01-26 18:36:24 +01:00
|
|
|
run: |
|
|
|
|
cd ui
|
|
|
|
npm ci
|
2020-04-17 19:52:18 +02:00
|
|
|
|
2021-05-25 15:58:06 +02:00
|
|
|
- name: npm lint
|
2020-04-26 20:48:29 +02:00
|
|
|
run: |
|
|
|
|
cd ui
|
2021-05-25 15:58:06 +02:00
|
|
|
npm run check-formatting && npm run lint
|
2020-04-26 20:48:29 +02:00
|
|
|
|
2020-11-11 02:45:04 +01:00
|
|
|
- name: npm test
|
|
|
|
run: |
|
|
|
|
cd ui
|
|
|
|
npm test
|
|
|
|
|
2020-04-17 19:52:18 +02:00
|
|
|
- name: npm build
|
|
|
|
run: |
|
|
|
|
cd ui
|
2020-01-26 18:36:24 +01:00
|
|
|
npm run build
|
2020-04-17 19:22:11 +02:00
|
|
|
|
2020-07-21 22:25:46 +02:00
|
|
|
- uses: actions/upload-artifact@v2
|
2020-04-17 19:52:18 +02:00
|
|
|
with:
|
|
|
|
name: js-bundle
|
|
|
|
path: ui/build
|
|
|
|
|
|
|
|
binaries:
|
|
|
|
name: Binaries
|
2020-10-27 20:58:27 +01:00
|
|
|
needs: [js, go, golangci-lint]
|
2020-04-17 19:52:18 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@v2
|
2020-07-21 23:37:36 +02:00
|
|
|
with:
|
2020-07-22 00:12:59 +02:00
|
|
|
fetch-depth: 0
|
2020-04-17 19:52:18 +02:00
|
|
|
|
2020-07-21 22:25:46 +02:00
|
|
|
- uses: actions/download-artifact@v2
|
2020-04-17 19:52:18 +02:00
|
|
|
with:
|
|
|
|
name: js-bundle
|
|
|
|
path: ui/build
|
|
|
|
|
2020-07-21 21:38:23 +02:00
|
|
|
- name: Show Tags
|
|
|
|
run: git tag
|
|
|
|
|
|
|
|
- name: Show Version
|
|
|
|
run: git describe --tags
|
|
|
|
|
2020-04-23 02:56:04 +02:00
|
|
|
- name: Run GoReleaser - SNAPSHOT
|
|
|
|
if: startsWith(github.ref, 'refs/tags/') != true
|
2021-05-14 20:31:07 +02:00
|
|
|
uses: docker://deluan/ci-goreleaser:1.16.4-1
|
2020-04-23 02:56:04 +02:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
args: goreleaser release --rm-dist --skip-publish --snapshot
|
|
|
|
|
|
|
|
- name: Run GoReleaser - RELEASE
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
2021-05-14 20:31:07 +02:00
|
|
|
uses: docker://deluan/ci-goreleaser:1.16.4-1
|
2020-01-26 18:36:24 +01:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
args: goreleaser release --rm-dist
|
2020-04-17 19:52:18 +02:00
|
|
|
|
2020-07-21 22:25:46 +02:00
|
|
|
- uses: actions/upload-artifact@v2
|
2020-04-23 02:56:04 +02:00
|
|
|
with:
|
|
|
|
name: binaries
|
2020-07-21 22:07:36 +02:00
|
|
|
path: |
|
|
|
|
dist
|
|
|
|
!dist/*.tar.gz
|
|
|
|
!dist/*.zip
|
2020-04-23 02:56:04 +02:00
|
|
|
|
2020-04-17 19:52:18 +02:00
|
|
|
docker:
|
|
|
|
name: Docker images
|
2020-04-23 02:56:04 +02:00
|
|
|
needs: [binaries]
|
2020-04-17 19:52:18 +02:00
|
|
|
runs-on: ubuntu-latest
|
2020-04-26 21:34:24 +02:00
|
|
|
env:
|
|
|
|
DOCKER_IMAGE: ${{secrets.DOCKER_IMAGE}}
|
2020-04-17 19:52:18 +02:00
|
|
|
steps:
|
2021-02-08 19:36:00 +01:00
|
|
|
- name: Set up QEMU
|
|
|
|
id: qemu
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
if: env.DOCKER_IMAGE != ''
|
|
|
|
|
2020-04-17 19:52:18 +02:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
id: buildx
|
2021-02-08 19:36:00 +01:00
|
|
|
uses: docker/setup-buildx-action@v1
|
2020-04-27 20:59:12 +02:00
|
|
|
if: env.DOCKER_IMAGE != ''
|
2020-04-17 19:52:18 +02:00
|
|
|
|
2020-10-12 17:58:38 +02:00
|
|
|
- uses: actions/checkout@v2
|
2020-04-27 20:59:12 +02:00
|
|
|
if: env.DOCKER_IMAGE != ''
|
2020-04-17 19:52:18 +02:00
|
|
|
|
2020-07-21 22:25:46 +02:00
|
|
|
- uses: actions/download-artifact@v2
|
2020-04-27 20:59:12 +02:00
|
|
|
if: env.DOCKER_IMAGE != ''
|
2020-04-17 19:52:18 +02:00
|
|
|
with:
|
2020-04-23 02:56:04 +02:00
|
|
|
name: binaries
|
|
|
|
path: dist
|
2020-04-17 19:52:18 +02:00
|
|
|
|
|
|
|
- name: Build the Docker image and push
|
2020-04-27 20:59:12 +02:00
|
|
|
if: env.DOCKER_IMAGE != ''
|
2020-04-17 19:52:18 +02:00
|
|
|
env:
|
2020-04-24 00:42:31 +02:00
|
|
|
DOCKER_IMAGE: ${{secrets.DOCKER_IMAGE}}
|
2021-02-01 01:36:18 +01:00
|
|
|
DOCKER_PLATFORM: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
|
2020-04-17 19:52:18 +02:00
|
|
|
run: |
|
|
|
|
echo ${{secrets.DOCKER_PASSWORD}} | docker login -u ${{secrets.DOCKER_USERNAME}} --password-stdin
|
2020-04-23 02:56:04 +02:00
|
|
|
docker buildx build --platform ${DOCKER_PLATFORM} `.github/workflows/docker-tags.sh` -f .github/workflows/pipeline.dockerfile --push .
|