mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-24 16:03:10 +01:00
81 lines
2.5 KiB
YAML
81 lines
2.5 KiB
YAML
name: CI
|
|
on:
|
|
push: { branches: [ main ] }
|
|
pull_request:
|
|
release: { types: [ published ] }
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
env: { GIN_MODE: test }
|
|
steps:
|
|
- uses: actions/setup-go@v2
|
|
with: { go-version: '1.17' }
|
|
- uses: actions/setup-node@v2
|
|
with: { node-version: '14' }
|
|
- uses: actions/checkout@v2
|
|
- run: |
|
|
mkdir -p ui/dist/img
|
|
touch ui/dist/index.html ui/dist/favicon.ico ui/dist/manifest.json ui/dist/img/fake.png
|
|
- run: docker-compose up -d
|
|
working-directory: dev
|
|
- name: Install ArangoDB
|
|
run: |
|
|
curl -OL https://download.arangodb.com/arangodb38/DEBIAN/Release.key
|
|
sudo apt-key add Release.key
|
|
sudo apt-add-repository 'deb https://download.arangodb.com/arangodb38/DEBIAN/ /'
|
|
sudo apt-get update -y && sudo apt-get -y install arangodb3
|
|
- run: go test -coverprofile=cover.out -coverpkg=./... ./...
|
|
- run: go tool cover -func=cover.out
|
|
|
|
build-npm:
|
|
name: Build npm
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/setup-node@v2
|
|
with: { node-version: '14' }
|
|
- uses: actions/checkout@v2
|
|
- run: yarn install && yarn build
|
|
working-directory: ui
|
|
- uses: actions/upload-artifact@v2
|
|
with: { name: ui, path: ui/dist, retention-days: 1 }
|
|
|
|
build:
|
|
if: github.event_name != 'pull_request'
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
needs: [ build-npm, test ]
|
|
steps:
|
|
- uses: actions/setup-go@v2
|
|
with: { go-version: '1.17' }
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/download-artifact@v2
|
|
with: { name: ui, path: ui/dist }
|
|
- run: go build -o catalyst ./cmd/catalyst/.
|
|
- uses: docker/login-action@v1
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Version
|
|
if: ${{ github.ref != '' }}
|
|
run: |
|
|
echo ${{ github.ref_name }}
|
|
echo ${{ github.ref_name }} > VERSION
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v3
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
- uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|