ci: separate frontend and backend

main
Johnson 2 years ago
parent ebdb5127a2
commit 03a396c694

@ -0,0 +1,67 @@
name: Unit Tests
on:
pull_request:
branches:
- "main"
push:
branches:
- "main"
jobs:
backend-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
frontend:
- 'frontend/**'
backend:
- '**/*.go'
- name: Set up Go
if: steps.changes.outputs.backend == 'true'
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Test Backend
if: steps.changes.outputs.backend == 'true'
run: |
go vet ./...
go test -v ./...
- name: Set up Node.js
if: steps.changes.outputs.frontend == 'true'
uses: actions/setup-node@v3
with:
node-version: 17
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Test Frontend
if: steps.changes.outputs.frontend == 'true'
run: |
cd frontend
npm install
npm run lint
- name: Notify of test failure
id: slack
uses: slackapi/slack-github-action@v1.18.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Notify of test failure
if: failure()
id: slack
uses: slackapi/slack-github-action@v1.18.0
with:
channel-id: 'github-actions'
slack-message: "Test result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

@ -1,65 +0,0 @@
name: PR Sanity Check
on:
pull_request:
branches:
- "main"
push:
branches:
- "main"
jobs:
backend-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Test
run: |
go vet ./...
go test -v ./...
- name: Notify of test failure
if: failure()
uses: rtCamp/action-slack-notify@v2.0.0
env:
SLACK_CHANNEL: dashboard
SLACK_COLOR: "#BF280A"
SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
SLACK_TITLE: Tests Failed
SLACK_USERNAME: GitHub Actions
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
frontend-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 17
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Test
run: |
cd frontend
npm install
npm run lint
- name: Notify of test failure
if: failure()
uses: rtCamp/action-slack-notify@v2.0.0
env:
SLACK_CHANNEL: dashboard
SLACK_COLOR: "#BF280A"
SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
SLACK_TITLE: Tests Failed
SLACK_USERNAME: GitHub Actions
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}

@ -1,4 +1,4 @@
# Go Micro Dashboard [![View](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fxpunch%2Fgo-micro-dashboard&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=go&edge_flat=false)](https://hits.seeyoufarm.com)
# Go Micro Dashboard [![GoDoc](https://godoc.org/github.com/go-micro/plugins?status.svg)](https://godoc.org/github.com/go-micro/plugins) [![Unit Tests](https://github.com/go-micro/dashboard/actions/workflows/ci.yml/badge.svg)](https://github.com/go-micro/dashboard/actions/workflows/ci.yml) [![Docker](https://github.com/go-micro/dashboard/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/go-micro/dashboard/actions/workflows/docker-publish.yml) [![Vistors](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fxpunch%2Fgo-micro-dashboard&count_bg=%2379C83D&title_bg=%23555555&icon=github.svg&icon_color=%23E7E7E7&title=Vistors&edge_flat=false)](https://hits.seeyoufarm.com) [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0)
Go micro dashboard is designed to make it as easy as possible for users to work with go-micro framework.

Loading…
Cancel
Save