mirror of https://github.com/statping/statping
improved GH actions
parent
ab87cbda7f
commit
698c7d548c
|
@ -1,114 +0,0 @@
|
||||||
name: Statping Build and Deploy
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-binary:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Install Go
|
|
||||||
uses: actions/setup-go@v1
|
|
||||||
with:
|
|
||||||
go-version: '1.14.x'
|
|
||||||
|
|
||||||
- name: Add GOBIN to PATH
|
|
||||||
run: echo "::add-path::$(go env GOPATH)/bin"
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Install Node
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: '10.x'
|
|
||||||
|
|
||||||
- name: Install Global Dependencies
|
|
||||||
run: npm install -g yarn sass newman cross-env wait-on @sentry/cli
|
|
||||||
|
|
||||||
- name: Checkout Statping Repo
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- uses: actions/cache@v1
|
|
||||||
id: nodecache
|
|
||||||
with:
|
|
||||||
path: ./frontend/node_modules
|
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-node-
|
|
||||||
|
|
||||||
- name: Download Frontend Dependencies
|
|
||||||
if: steps.nodecache.outputs.cache-hit != 'true'
|
|
||||||
working-directory: ./frontend
|
|
||||||
run: yarn
|
|
||||||
|
|
||||||
- uses: actions/cache@v1
|
|
||||||
id: golangcache
|
|
||||||
with:
|
|
||||||
path: ~/go/pkg/mod
|
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-go-
|
|
||||||
|
|
||||||
- name: Download Go mods
|
|
||||||
if: steps.golangcache.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
go mod download
|
|
||||||
go mod verify
|
|
||||||
make test-deps
|
|
||||||
|
|
||||||
- name: Build Frontend Statping
|
|
||||||
run: make clean compile
|
|
||||||
|
|
||||||
- name: Upload Compiled Frontend
|
|
||||||
uses: actions/upload-artifact@v1
|
|
||||||
with:
|
|
||||||
name: static-frontend
|
|
||||||
path: /home/runner/work/statping/statping/source/rice-box.go
|
|
||||||
|
|
||||||
- name: Install Statping
|
|
||||||
run: |
|
|
||||||
make build
|
|
||||||
chmod +x statping
|
|
||||||
mv statping $(go env GOPATH)/bin/
|
|
||||||
|
|
||||||
- name: Test Statping
|
|
||||||
env:
|
|
||||||
DB_CONN: sqlite3
|
|
||||||
STATPING_DIR: /home/runner/work/statping/statping
|
|
||||||
API_KEY: demopassword123
|
|
||||||
DISABLE_LOGS: true
|
|
||||||
ALLOW_REPORTS: true
|
|
||||||
DISCORD_URL: ${{ secrets.DISCORD_URL }}
|
|
||||||
EMAIL_HOST: ${{ secrets.EMAIL_HOST }}
|
|
||||||
EMAIL_USER: ${{ secrets.EMAIL_USER }}
|
|
||||||
EMAIL_PASS: ${{ secrets.EMAIL_PASS }}
|
|
||||||
EMAIL_OUTGOING: ${{ secrets.EMAIL_OUTGOING }}
|
|
||||||
EMAIL_SEND_TO: ${{ secrets.EMAIL_SEND_TO }}
|
|
||||||
EMAIL_PORT: ${{ secrets.EMAIL_PORT }}
|
|
||||||
MOBILE_ID: ${{ secrets.MOBILE_ID }}
|
|
||||||
MOBILE_NUMBER: ${{ secrets.MOBILE_NUMBER }}
|
|
||||||
PUSHOVER_TOKEN: ${{ secrets.PUSHOVER_TOKEN }}
|
|
||||||
PUSHOVER_API: ${{ secrets.PUSHOVER_API }}
|
|
||||||
SLACK_URL: ${{ secrets.SLACK_URL }}
|
|
||||||
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
|
||||||
TELEGRAM_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL }}
|
|
||||||
TWILIO_SID: ${{ secrets.TWILIO_SID }}
|
|
||||||
TWILIO_SECRET: ${{ secrets.TWILIO_SECRET }}
|
|
||||||
TWILIO_FROM: ${{ secrets.TWILIO_FROM }}
|
|
||||||
TWILIO_TO: ${{ secrets.TWILIO_TO }}
|
|
||||||
run: SASS=`which sass` go test -v -covermode=count -coverprofile=coverage.out -p=1 ./...
|
|
||||||
|
|
||||||
- name: Build Binaries
|
|
||||||
run: make build-bin build-win
|
|
||||||
|
|
||||||
# - name: Build Binaries
|
|
||||||
# run: goveralls -coverprofile=coverage.out -service=travis -repotoken $(COVERALLS)
|
|
||||||
|
|
||||||
- name: Slack Notification
|
|
||||||
uses: rtCamp/action-slack-notify@v2.0.0
|
|
||||||
env:
|
|
||||||
SLACK_WEBHOOK: ${{ secrets.SLACK_URL }}
|
|
||||||
SLACK_CHANNEL: dev
|
|
||||||
SLACK_USERNAME: Github
|
|
|
@ -1,22 +0,0 @@
|
||||||
name: ReleaseWorkflow
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published, prereleased]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
createSentryRelease:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@master
|
|
||||||
- name: Create a Sentry release
|
|
||||||
uses: tclindner/sentry-releases-action@v1.0.0
|
|
||||||
env:
|
|
||||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
||||||
SENTRY_URL: ${{ secrets.SENTRY_URL }}
|
|
||||||
SENTRY_ORG: statping
|
|
||||||
SENTRY_PROJECT: backend
|
|
||||||
with:
|
|
||||||
tagName: ${{ github.ref }}
|
|
||||||
environment: qa
|
|
|
@ -1,22 +0,0 @@
|
||||||
name: ReleaseFrontendWorkflow
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published, prereleased]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
createSentryRelease:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@master
|
|
||||||
- name: Create a Sentry Frontend release
|
|
||||||
uses: tclindner/sentry-releases-action@v1.0.0
|
|
||||||
env:
|
|
||||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_FRONTEND_AUTH_TOKEN }}
|
|
||||||
SENTRY_URL: ${{ secrets.SENTRY_URL }}
|
|
||||||
SENTRY_ORG: statping
|
|
||||||
SENTRY_PROJECT: frontend
|
|
||||||
with:
|
|
||||||
tagName: ${{ github.ref }}
|
|
||||||
environment: qa
|
|
|
@ -0,0 +1,239 @@
|
||||||
|
name: Statping Build and Deploy
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
compile:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Install Go
|
||||||
|
uses: actions/setup-go@v1
|
||||||
|
with:
|
||||||
|
go-version: '1.14.x'
|
||||||
|
|
||||||
|
- name: Add GOBIN to PATH
|
||||||
|
run: echo "::add-path::$(go env GOPATH)/bin"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Install Node
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: '10.x'
|
||||||
|
|
||||||
|
- name: Install Global Dependencies
|
||||||
|
run: npm install -g yarn sass newman cross-env wait-on @sentry/cli
|
||||||
|
|
||||||
|
- name: Checkout Statping Repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: actions/cache@v1
|
||||||
|
id: nodecache
|
||||||
|
with:
|
||||||
|
path: ./frontend/node_modules
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- name: Download Frontend Dependencies
|
||||||
|
if: steps.nodecache.outputs.cache-hit != 'true'
|
||||||
|
working-directory: ./frontend
|
||||||
|
run: yarn
|
||||||
|
|
||||||
|
- uses: actions/cache@v1
|
||||||
|
id: golangcache
|
||||||
|
with:
|
||||||
|
path:
|
||||||
|
- ~/go/pkg/mod
|
||||||
|
- ~/go/bin
|
||||||
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
|
|
||||||
|
- name: Download Go mods
|
||||||
|
if: steps.golangcache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
go mod download
|
||||||
|
go mod verify
|
||||||
|
make test-deps
|
||||||
|
|
||||||
|
- name: Build Frontend Statping
|
||||||
|
run: make clean compile
|
||||||
|
|
||||||
|
- name: Upload Compiled Frontend
|
||||||
|
uses: actions/upload-artifact@v1
|
||||||
|
with:
|
||||||
|
name: static-frontend
|
||||||
|
path: /home/runner/work/statping/statping/source/rice-box.go
|
||||||
|
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Statping Repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Go
|
||||||
|
uses: actions/setup-go@v1
|
||||||
|
with:
|
||||||
|
go-version: '1.14.x'
|
||||||
|
|
||||||
|
- name: Add GOBIN to PATH
|
||||||
|
run: echo "::add-path::$(go env GOPATH)/bin"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- uses: actions/cache@v1
|
||||||
|
id: golangcache
|
||||||
|
with:
|
||||||
|
path:
|
||||||
|
- ~/go/pkg/mod
|
||||||
|
- ~/go/bin
|
||||||
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
|
|
||||||
|
- name: Download Go mods
|
||||||
|
if: steps.golangcache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
go mod download
|
||||||
|
go mod verify
|
||||||
|
make test-deps
|
||||||
|
|
||||||
|
- name: Download Compiled Frontend
|
||||||
|
uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: static-frontend
|
||||||
|
path: /home/runner/work/statping/statping/source/rice-box.go
|
||||||
|
|
||||||
|
- name: Install Statping
|
||||||
|
run: |
|
||||||
|
make build
|
||||||
|
chmod +x statping
|
||||||
|
mv statping $(go env GOPATH)/bin/
|
||||||
|
|
||||||
|
- name: Go Tests
|
||||||
|
run: SASS=`which sass` go test -v -covermode=count -coverprofile=coverage.out -p=1 ./...
|
||||||
|
env:
|
||||||
|
DB_CONN: sqlite3
|
||||||
|
STATPING_DIR: /home/runner/work/statping/statping
|
||||||
|
API_KEY: demopassword123
|
||||||
|
DISABLE_LOGS: true
|
||||||
|
ALLOW_REPORTS: true
|
||||||
|
VERSION: $(cat version.txt)
|
||||||
|
COVERALLS: ${{ secrets.COVERALLS }}
|
||||||
|
DISCORD_URL: ${{ secrets.DISCORD_URL }}
|
||||||
|
EMAIL_HOST: ${{ secrets.EMAIL_HOST }}
|
||||||
|
EMAIL_USER: ${{ secrets.EMAIL_USER }}
|
||||||
|
EMAIL_PASS: ${{ secrets.EMAIL_PASS }}
|
||||||
|
EMAIL_OUTGOING: ${{ secrets.EMAIL_OUTGOING }}
|
||||||
|
EMAIL_SEND_TO: ${{ secrets.EMAIL_SEND_TO }}
|
||||||
|
EMAIL_PORT: ${{ secrets.EMAIL_PORT }}
|
||||||
|
MOBILE_ID: ${{ secrets.MOBILE_ID }}
|
||||||
|
MOBILE_NUMBER: ${{ secrets.MOBILE_NUMBER }}
|
||||||
|
PUSHOVER_TOKEN: ${{ secrets.PUSHOVER_TOKEN }}
|
||||||
|
PUSHOVER_API: ${{ secrets.PUSHOVER_API }}
|
||||||
|
SLACK_URL: ${{ secrets.SLACK_URL }}
|
||||||
|
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
|
TELEGRAM_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL }}
|
||||||
|
TWILIO_SID: ${{ secrets.TWILIO_SID }}
|
||||||
|
TWILIO_SECRET: ${{ secrets.TWILIO_SECRET }}
|
||||||
|
TWILIO_FROM: ${{ secrets.TWILIO_FROM }}
|
||||||
|
TWILIO_TO: ${{ secrets.TWILIO_TO }}
|
||||||
|
|
||||||
|
- name: Coveralls Testing Coverage
|
||||||
|
run: goveralls -coverprofile=coverage.out -service=travis -repotoken $COVERALLS
|
||||||
|
env:
|
||||||
|
COVERALLS: ${{ secrets.COVERALLS }}
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Statping Repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Go
|
||||||
|
uses: actions/setup-go@v1
|
||||||
|
with:
|
||||||
|
go-version: '1.14.x'
|
||||||
|
|
||||||
|
- uses: actions/cache@v1
|
||||||
|
id: golangcache
|
||||||
|
with:
|
||||||
|
path:
|
||||||
|
- ~/go/pkg/mod
|
||||||
|
- ~/go/bin
|
||||||
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
|
|
||||||
|
- name: Add GOBIN to PATH
|
||||||
|
run: echo "::add-path::$(go env GOPATH)/bin"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Download Compiled Frontend
|
||||||
|
uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: static-frontend
|
||||||
|
path: /home/runner/work/statping/statping/source/rice-box.go
|
||||||
|
|
||||||
|
- name: Build Binaries
|
||||||
|
env:
|
||||||
|
VERSION: $(cat version.txt)
|
||||||
|
COMMIT: $GITHUB_SHA
|
||||||
|
run: make build-bin build-win
|
||||||
|
|
||||||
|
- name: Upload Compiled Binaries
|
||||||
|
uses: actions/upload-artifact@v1
|
||||||
|
with:
|
||||||
|
name: statping-bins
|
||||||
|
path: /home/runner/work/statping/statping/build/*
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@latest
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
VERSION: $(cat version.txt)
|
||||||
|
with:
|
||||||
|
tag_name: v$(cat version.txt)
|
||||||
|
release_name: Release v$(cat version.txt)
|
||||||
|
body: Statping v$(cat version.txt)
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
|
||||||
|
post-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Statping Repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Slack Notification
|
||||||
|
uses: rtCamp/action-slack-notify@v2.0.0
|
||||||
|
env:
|
||||||
|
SLACK_WEBHOOK: ${{ secrets.SLACK_URL }}
|
||||||
|
SLACK_CHANNEL: dev
|
||||||
|
SLACK_USERNAME: StatpingDev
|
||||||
|
|
||||||
|
- name: Sentry Backend Release
|
||||||
|
uses: tclindner/sentry-releases-action@v1.0.0
|
||||||
|
env:
|
||||||
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||||
|
SENTRY_URL: ${{ secrets.SENTRY_URL }}
|
||||||
|
SENTRY_ORG: statping
|
||||||
|
SENTRY_PROJECT: backend
|
||||||
|
with:
|
||||||
|
tagName: v$(cat version.txt)
|
||||||
|
environment: production
|
||||||
|
|
||||||
|
- name: Sentry Frontend Release
|
||||||
|
uses: tclindner/sentry-releases-action@v1.0.0
|
||||||
|
env:
|
||||||
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||||
|
SENTRY_URL: ${{ secrets.SENTRY_URL }}
|
||||||
|
SENTRY_ORG: statping
|
||||||
|
SENTRY_PROJECT: frontend
|
||||||
|
with:
|
||||||
|
tagName: v$(cat version.txt)
|
||||||
|
environment: production
|
Loading…
Reference in New Issue