mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-24 07:53:30 +01:00
Release catalyst
This commit is contained in:
93
.github/workflows/ci.yml
vendored
Normal file
93
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
name: CI
|
||||
on:
|
||||
push: { branches: [ main ] }
|
||||
pull_request:
|
||||
|
||||
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/arangodb34/DEBIAN/Release.key
|
||||
sudo apt-key add Release.key
|
||||
sudo apt-add-repository 'deb https://download.arangodb.com/arangodb34/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:
|
||||
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 }}
|
||||
echo ${{ github.ref }} > 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 }}
|
||||
|
||||
# deploy:
|
||||
# name: Deploy
|
||||
# runs-on: self-hosted
|
||||
# needs: [ build ]
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# - uses: docker/login-action@v1
|
||||
# with:
|
||||
# registry: ${{ env.REGISTRY }}
|
||||
# username: ${{ github.actor }}
|
||||
# password: ${{ secrets.GITHUB_TOKEN }}
|
||||
# - run: docker-compose -f docker-compose.yml -f docker-compose.demo.yml pull
|
||||
# - run: docker-compose -f docker-compose.yml -f docker-compose.demo.yml up -d --remove-orphans --force-recreate
|
||||
# - run: docker-compose -f docker-compose.yml -f docker-compose.demo.yml restart
|
||||
Reference in New Issue
Block a user