Skip to content

Commit

Permalink
chore: ui support github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ly5156 committed Nov 12, 2024
1 parent a329c4d commit 5b48742
Show file tree
Hide file tree
Showing 7 changed files with 236 additions and 103 deletions.
98 changes: 0 additions & 98 deletions .drone-cn.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/build-and-upload-branch-pandaria.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Pandaria Build Dashboard (Branch)
on:
push:
branches:
- 'release-*-cn*'

jobs:
build-validation:
name: Build Test
uses: ./.github/workflows/build-test-pandaria.yaml
build:
name: Build and Upload
uses: ./.github/workflows/build-and-upload-pandaria.yaml
needs:
- build-validation
permissions:
contents: 'read'
id-token: 'write'
with:
CI_BRANCH: ${{github.ref_name}}
87 changes: 87 additions & 0 deletions .github/workflows/build-and-upload-pandaria.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Pandaria Build Dashboard and Upload

on:
workflow_call:
inputs:
CI_BRANCH:
required: false
type: string
CI_BUILD_TAG:
required: false
type: string

env:
CI_BUILD_TAG: ${{inputs.CI_BUILD_TAG}}
CI_BRANCH: ${{inputs.CI_BRANCH}}
GIT_REPO: ${{github.repository}}
GIT_COMMIT: ${{github.sha}}
REPO: ${{github.event.repository.name || ''}}

jobs:
build-and-upload-hosted:
name: Build & Upload Hosted
runs-on: repo-dashboard-runner-k8s
container: ubuntu:24.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

# Note - Cannot use the setup action here as it uses a different yarn install arg
- uses: actions/setup-node@v3
with:
node-version: '14.x'
cache: 'yarn'

# Build a directory containing the dashboard that can be used with ui-dashboard-index
- id: build-hosted
name: Build Hosted
run: ./scripts/build-hosted

- id: upload-gate
name: Upload Gate (superceded by a newer build?)
run: ./scripts/build-upload-gate

- name: Setup AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-southeast-2

- name: Upload build
run: |
aws s3 sync --delete --acl public-read ${{steps.build-hosted.outputs.BUILD_HOSTED_DIR}} s3://pandaria-dashboard-ui/dashboard/${{ steps.build-hosted.outputs.BUILD_HOSTED_LOCATION }}
build-and-upload-embedded:
name: Build & Upload Embedded
runs-on: repo-dashboard-runner-k8s
container: ubuntu:24.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

# Note - Cannot use the setup action here as it uses a different yarn install arg
- uses: actions/setup-node@v3
with:
node-version: '14.x'
cache: 'yarn'

# Build a tar that will be picked up by rancher builds and embedded into it
- id: build-embedded
name: Build Embedded
run: ./scripts/build-embedded
env:
EMBED_PKG: https://releases.rancher.com/harvester-ui/plugin/harvester-1.0.3.tar.gz
- name: Setup AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-southeast-2

- name: Upload tar
run: |
aws s3 cp ${{steps.build-embedded.outputs.BUILD_EMBEDED_TGZ}} s3://pandaria-dashboard-ui/${{env.CI_BRANCH}}/
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Build Dashboard 2.8 (Release)
name: Pandaria Build Dashboard (Release)
on:
push:
tags:
- v2.8.*
- v*-cn-ent*

jobs:
build-validation:
name: Validate Code
uses: ./.github/workflows/build-test.yaml
uses: ./.github/workflows/build-test-pandaria.yaml
build:
name: Build and Upload
uses: ./.github/workflows/build-and-upload.yaml
uses: ./.github/workflows/build-and-upload-pandaria.yaml
needs:
- build-validation
permissions:
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/build-test-pandaria.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Validation steps required before a build occurs. Not designed to replace the CI test workflow
name: Build Test

on:
# This tells GH that the workflow is reusable
workflow_call:

jobs:
unit-test:
runs-on: repo-dashboard-runner-k8s
container: ubuntu:24.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Run tests
uses: ./.github/actions/unit-tests

i18n:
runs-on: repo-dashboard-runner-k8s
container: ubuntu:24.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Run i18n lint
uses: ./.github/actions/i18n-lint

lint:
runs-on: repo-dashboard-runner-k8s
container: ubuntu:24.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Run lint
uses: ./.github/actions/lint
84 changes: 84 additions & 0 deletions .github/workflows/test-pandaria.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Pandaria Tests
on:
push:
branches:
- 'release-*-cn*'
pull_request:
branches:
- 'release-*-cn*'
workflow_dispatch:
inputs:
environment:
description: 'Environment to run tests against'
type: environment
required: true

env:
# Build the dashboard to use in tests. When set to false it will grab `latest` from CDN (useful for running e2e tests quickly)
BUILD_DASHBOARD: true


jobs:
unit-test:
runs-on: repo-dashboard-runner-k8s
container: ubuntu:24.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Run tests
uses: ./.github/actions/unit-tests

- name: Collect Coverage
run: |
mkdir -p coverage-artifacts/coverage
cp coverage/unit/coverage-final.json coverage-artifacts/coverage/coverage-unit.json
cp -r coverage/unit/ coverage-artifacts/coverage/unit/
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
name: ${{github.run_number}}-${{github.run_attempt}}-coverage
path: coverage-artifacts/**/*

i18n:
runs-on: repo-dashboard-runner-k8s
container: ubuntu:24.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Run i18n lint
uses: ./.github/actions/i18n-lint

check-i18n:
runs-on: repo-dashboard-runner-k8s
container: ubuntu:24.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '16.x'

- name: Install packages
run: yarn install:ci

- name: Run i18n string check
run: |
# Falure won't fail the job (remove -x when all current issues are fixed)
./scripts/check-i18n -s -x
lint:
runs-on: repo-dashboard-runner-k8s
container: ubuntu:24.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Run tests
uses: ./.github/actions/lint
2 changes: 1 addition & 1 deletion scripts/version
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fi
COMMIT=$(git rev-parse --short HEAD)
COMMIT_DATE=$(git --no-pager log -1 --format='%ct')
COMMIT_BRANCH=$(git rev-parse --abbrev-ref HEAD | sed -E 's/[^a-zA-Z0-9.-]+/-/g')
GIT_TAG=${DRONE_TAG:-$(git tag -l --contains HEAD | head -n 1)}
GIT_TAG=${CI_BUILD_TAG:-$(git tag -l --contains HEAD | head -n 1)}
LAST_TAG=${GIT_TAG:-'v0.0.0'}

if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then
Expand Down

0 comments on commit 5b48742

Please sign in to comment.