Skip to content

Commit

Permalink
Merge pull request #5140 from richard-cox/richard-drone-ui-pr
Browse files Browse the repository at this point in the history
Port drone build tasks to gh workflows + actions
  • Loading branch information
richard-cox committed May 1, 2024
2 parents eb055c9 + 7014246 commit 52dd792
Show file tree
Hide file tree
Showing 14 changed files with 145 additions and 420 deletions.
118 changes: 0 additions & 118 deletions .drone.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Setup UI Env
description: Setup node, python and call bootstrap script

runs:
using: 'composite'
steps:
- uses: actions/setup-node@v3
with:
node-version: '14.x'

- name: Install Python for node-sass
shell: bash
run: |
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends python2
- name: Install packages
shell: bash
run: ./scripts/bootstrap
67 changes: 67 additions & 0 deletions .github/workflows/build-and-upload.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build and Upload

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

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

jobs:
build-and-upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Setup env
uses: ./.github/actions/setup

- id: build
name: Build
run: ./scripts/build-static

- name: Get gcs auth
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/google-auth/rancher/credentials token | GOOGLE_AUTH
- name: Apply gcs auth
# https://github.com/google-github-actions/auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: "${{ env.GOOGLE_AUTH }}"

- name: Upload build
uses: 'google-github-actions/upload-cloud-storage@v2'
# https://github.com/google-github-actions/upload-cloud-storage
with:
path: ${{steps.build.outputs.BUILD_DIR}}
# Example - https://releases.rancher.com/ui/2.8.0/...
destination: releases.rancher.com/${{ env.REPO }}/${{ steps.build.outputs.VERSION }}
parent: false
headers: |-
cache-control: no-cache,must-revalidate
process_gcloudignore: false

- name: Upload tar
if: ${{ env.CI_BUILD_TAG != ''}}
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: ${{steps.build.outputs.BUILD_TGZ}}
# Example - https://releases.rancher.com/ui/2.8.0.tar.gz
destination: releases.rancher.com/${{ env.REPO }}
parent: false
headers: |-
cache-control: no-cache,must-revalidate
process_gcloudignore: false
19 changes: 19 additions & 0 deletions .github/workflows/build-branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build (Branch)
on:
push:
branches:
- master
- 'release-*'
- '*-dev'

jobs:
test:
uses: ./.github/workflows/test.yaml
build-branch-and-upload:
uses: ./.github/workflows/build-and-upload.yaml
needs: test
permissions:
contents: 'read'
id-token: 'write'
with:
CI_BRANCH: ${{github.ref_name}}
17 changes: 17 additions & 0 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build (Release)
on:
push:
tags:
- v[2-9].*

jobs:
test:
uses: ./.github/workflows/test.yaml
build-tag-and-upload:
uses: ./.github/workflows/build-and-upload.yaml
needs: test
permissions:
contents: 'read'
id-token: 'write'
with:
CI_BUILD_TAG: ${{github.ref_name}}
34 changes: 11 additions & 23 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ on:
- master
- 'release-*'
pull_request:
branches:
- master
- 'release-*'
branches:
- master
- 'release-*'
# This tells GH that the workflow is reusable
workflow_call:

jobs:
unit-test:
Expand All @@ -16,17 +18,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '14.x'

- name: Install Python for node-sass
run: |
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends python2
- name: Install packages
run: ./scripts/bootstrap

- name: Run Setup
uses: ./.github/actions/setup

- name: Run tests
run: yarn test
lint:
Expand All @@ -35,16 +30,9 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '14.x'

- name: Install Python for node-sass
run: |
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends python2
- name: Install packages
run: ./scripts/bootstrap

- name: Run Setup
uses: ./.github/actions/setup

- name: Run linter
run: yarn lint:js
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,3 @@ GTAGS

*.org
yarn-error.log
!Dockerfile.dapper
Dockerfile.dapper*
26 changes: 0 additions & 26 deletions Dockerfile.dapper

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,4 @@
"lib/shared"
]
}
}
}
Loading

0 comments on commit 52dd792

Please sign in to comment.