Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.8] Port drone build tasks to gh workflows + actions #5143

Merged
merged 5 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading