Skip to content

Commit

Permalink
ci: setup ci-workflow for PR (karmada-io#115)
Browse files Browse the repository at this point in the history
* ci: add all target in Makefile

Signed-off-by: warjiang <1096409085@qq.com>

* ci: add ci-workflow actions

Co-authored-by: Hongcai Ren <renhongcai@huawei.com>
Signed-off-by: warjiang <1096409085@qq.com>

---------

Signed-off-by: warjiang <1096409085@qq.com>
Co-authored-by: Hongcai Ren <renhongcai@huawei.com>
  • Loading branch information
2 people authored and chouchongYHMing committed Sep 25, 2024
1 parent 9113d27 commit 491bd8f
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 1 deletion.
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Reference: https://github.com/karmada-io/karmada/blob/master/.github/workflows/ci.yml
# We cut some unused job to make the workflow more suitable for ci of karmada dashboard
name: CI Workflow
on:
# Run this workflow every time a new commit pushed to upstream/fork repository.
# Run workflow on fork repository will help contributors find and resolve issues before sending a PR.
push:
# Exclude branches created by Dependabot to avoid triggering current workflow
# for PRs initiated by Dependabot.
branches-ignore:
- 'dependabot/**'
pull_request:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # for actions/checkout to fetch code
jobs:
build-frontend:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- uses: pnpm/action-setup@v4
with:
version: 8.15.6
- name: Build dashboard
run: |
echo "Start build"
pnpm --version
cd ui
pnpm install -w
pnpm run dashboard:build
build-bin:
name: build-bin
runs-on: ubuntu-22.04
steps:
- name: checkout code
uses: actions/checkout@v4
with:
# Number of commits to fetch. 0 indicates all history for all branches and tags.
# We need to guess version via git tags.
fetch-depth: 0
- name: install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: compile
run: make all
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ REGISTRY_USER_NAME ?= ""
REGISTRY_PASSWORD ?= ""
REGISTRY_SERVER_ADDRESS ?= ""

TARGETS := karmada-dashboard-api
TARGETS := karmada-dashboard-api \
karmada-dashboard-web \


# Build binary.
Expand All @@ -24,6 +25,8 @@ TARGETS := karmada-dashboard-api
$(TARGETS):
BUILD_PLATFORMS=$(GOOS)/$(GOARCH) hack/build.sh $@

.PHONY: all
all: $(TARGETS)

# Build image.
#
Expand Down Expand Up @@ -52,3 +55,4 @@ image-karmada-dashboard-web:
BUILD_PLATFORMS=linux/$(GOARCH) hack/build.sh karmada-dashboard-web
cp -R ui/apps/dashboard/dist _output/bin/linux/$(GOARCH)/dist
DOCKER_FILE="build-web.Dockerfile" VERSION=$(VERSION) REGISTRY=$(REGISTRY) BUILD_PLATFORMS=linux/$(GOARCH) hack/docker.sh karmada-dashboard-web

0 comments on commit 491bd8f

Please sign in to comment.