Skip to content

Commit

Permalink
Merge pull request #5143 from rancher/richard-cox-2.8-drone
Browse files Browse the repository at this point in the history
[2.8] Port drone build tasks to gh workflows + actions
  • Loading branch information
richard-cox committed May 30, 2024
2 parents 4d2774b + 9395d49 commit 1b26ba2
Show file tree
Hide file tree
Showing 15 changed files with 169 additions and 414 deletions.
134 changes: 0 additions & 134 deletions .drone.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Linked Issues
======
<!--
Link any related issues, pull-requests, or commit hashes that are relavent to this pull-request.
Link any related issues, pull-requests, or commit hashes that are relevant to this pull-request.
If you are opening a PR without a corresponding issue create an issue before you do. This will help QA massively. PR's opened without linked issues will not be merged until an issue is created and linked here.
Expand Down
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
17 changes: 17 additions & 0 deletions .github/workflows/build-branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build (Branch)
on:
push:
branches:
- release-2.8

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-2.8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build 2.8 (Release)
on:
push:
tags:
- v2.8.*

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}}
36 changes: 36 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Tests
on:
push:
branches:
- release-2.8
pull_request:
branches:
- release-2.8
# This tells GH that the workflow is reusable
workflow_call:

jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

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

- name: Run tests
run: yarn test
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- 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 1b26ba2

Please sign in to comment.