navidrome/.github/workflows/build.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

109 lines
2.5 KiB
YAML
Raw Normal View History

2020-01-24 00:21:20 +01:00
name: Build
2020-04-17 15:41:34 +02:00
on:
push:
pull_request:
types: [closed]
branches:
- master
2020-01-05 03:23:24 +01:00
jobs:
go:
name: Test Server on ${{ matrix.os }}
2020-01-05 03:23:24 +01:00
runs-on: ${{ matrix.os }}
strategy:
matrix:
2020-04-17 15:13:43 +02:00
# TODO Fix tests in Windows
# os: [macOS-latest, ubuntu-latest, windows-latest]
2020-01-18 17:01:42 +01:00
os: [macOS-latest, ubuntu-latest]
2020-01-05 03:23:24 +01:00
steps:
2020-02-26 15:37:48 +01:00
- name: Set up Go 1.14
2020-01-05 03:23:24 +01:00
uses: actions/setup-go@v1
with:
2020-02-26 15:37:48 +01:00
go-version: 1.14
2020-01-05 03:23:24 +01:00
id: go
- name: Check out code into the Go module directory
2020-04-17 19:22:11 +02:00
uses: actions/checkout@v2
2020-01-05 03:23:24 +01:00
2020-04-17 15:13:43 +02:00
- uses: actions/cache@v1
id: cache-go
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
2020-01-05 03:23:24 +01:00
- name: Download dependencies
2020-04-17 15:13:43 +02:00
if: steps.cache-go.outputs.cache-hit != 'true'
run: go mod download
2020-01-05 03:23:24 +01:00
- name: Test
run: go test -cover ./... -v
js:
name: Test UI
runs-on: ubuntu-latest
steps:
2020-04-17 19:22:11 +02:00
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
2020-01-24 00:31:52 +01:00
node-version: 13
2020-04-17 15:13:43 +02:00
- uses: actions/cache@v1
id: cache-npm
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('ui/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: npm install dependencies
run: |
cd ui
npm ci
2020-04-17 15:13:43 +02:00
# TODO: Enable when there are tests to run
# - name: npm test
# run: |
# cd ui
# CI=test npm test
- name: npm build
run: |
cd ui
npm run build
2020-04-17 15:41:34 +02:00
- uses: actions/upload-artifact@v1
with:
name: js-bundle
path: ui/build
build:
name: Build snapshot binaries
if: github.event.pull_request.merged || github.event_name == 'push'
needs: [js]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
2020-04-17 19:22:11 +02:00
uses: actions/checkout@v2
2020-04-17 15:41:34 +02:00
2020-04-17 19:22:11 +02:00
- name: Unshallow
run: git fetch --prune --unshallow
2020-04-17 15:41:34 +02:00
- uses: actions/download-artifact@v1
with:
name: js-bundle
path: ui/build
- name: Run GoReleaser
uses: docker://deluan/ci-goreleaser:1.14.1-1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: goreleaser release --rm-dist --skip-publish --snapshot
- uses: actions/upload-artifact@v1
with:
name: binaries
path: dist