Skip to content

Commit

Permalink
PDA-325 Create common GHA for PDA services (#118)
Browse files Browse the repository at this point in the history
* reorganizing deploy and cache for eks

* added steps

* Changed to using go mod for go build and go setup

* Missed saving file

* Updated sonarscanner setup and passed the repo token down to setup go

* Added github token to buf

* Changed files around again

* Fixed cache naming

* Made caching optional

* remove optional cache

* fixed comment

* Added tag update

* Fixing name

* ugh no autosave

* Changed to v0

* Adjusting sudo command

* updating to newer uterm code

* Cleaned up dist

* Added back dist or everything fails

* changed name to ssh

* Moving back to original action but removing sudo

* Try again

* Added sudo back in

* fixing sudo

* Continued refactor

* remove tidy and use download

* remove tidy and use download

* rename setup

* tab on copy/paste

* Reverting all js changes

* added back licenses
  • Loading branch information
dcbickfo authored Jul 20, 2023
1 parent ee75bbd commit 549513f
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 56 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/main-version-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Update Main Version
run-name: Move ${{ github.event.inputs.major_version }} to ${{ github.event.inputs.target }}

on:
workflow_dispatch:
inputs:
target:
description: The tag or reference to use
required: true
major_version:
type: choice
description: The major version to update
options:
- v0

jobs:
tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Git config
run: |
git config user.name flipp-bot
git config user.email [email protected]
- name: Tag new target
run: git tag -f ${{ github.event.inputs.major_version }} ${{ github.event.inputs.target }}
- name: Push new tag
run: git push origin ${{ github.event.inputs.major_version }} --force
21 changes: 21 additions & 0 deletions cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'cache'
description: 'Custom GitHub action that caches the workspace code to the default location for deploy'

inputs:
DEPLOY_CACHE_PATH:
description: Path to restore cache
required: false
default: ./*
DEPLOY_CACHE_KEY:
description: Cache key
required: false
default: workspace-cache-${{ github.run_id }}


runs:
using: 'composite'
steps:
- uses: actions/cache@v3
with:
path: ${{ inputs.DEPLOY_CACHE_PATH }}
key: ${{ inputs.DEPLOY_CACHE_KEY }}
5 changes: 1 addition & 4 deletions eks-deploy/action.yml → deploy/eks/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ runs:
shell: bash
run: shopt -s dotglob && rm -rf "${{ github.workspace }}"/*
- name: Restoring workspace from cache
uses: actions/cache@v3
with:
path: ./*
key: workspace-cache-${{ github.run_id }}
uses: wishabi/github-actions/cache@v0
- name: Deploying to EKS via Helm release
shell: bash
run: |
Expand Down
23 changes: 23 additions & 0 deletions deploy/lambda/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'lambda-deploy'
description: 'Custom GitHub action that deploys the repository to lambda using its "/deploy/build.sh" script'

inputs:
ENV:
description: Application environment (staging or production)
required: true


runs:
using: 'composite'
steps:
- uses: actions/checkout@v3
- name: Cleaning workspace
shell: bash
run: shopt -s dotglob && rm -rf "${{ github.workspace }}"/*
- name: Restoring workspace from cache
uses: wishabi/github-actions/cache@v0
- name: Deploying to Lambda
shell: bash
run: |
export DEPLOY_ENV=${{ inputs.ENV }}
chmod +x ./deploy/build.sh && ./deploy/build.sh service
32 changes: 0 additions & 32 deletions go/build/action.yml

This file was deleted.

14 changes: 4 additions & 10 deletions go/setup/action.yml → go/configure/action.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: 'go-setup'
name: 'go-configure'
description: 'Set up Go environment for CI build. Sets up Buf if the relevant inputs are provided.'

inputs:
GO_VERSION:
description: Golang version to be used for CI build
required: true
FLIPPCIRCLECIPULLER_REPO_TOKEN:
description: Flipp circleci repo token
required: true
Expand All @@ -18,18 +15,15 @@ inputs:
runs:
using: 'composite'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setting up private modules access
shell: bash
run: git config --global url."https://${{ inputs.FLIPPCIRCLECIPULLER_REPO_TOKEN }}:[email protected]/wishabi".insteadOf "https://github.com/wishabi"
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ inputs.GO_VERSION }}
check-latest: true
cache: true
- name: Setting up buf
uses: bufbuild/buf-setup-action@v1
if: "${{ inputs.BUF_BUILD_API_TOKEN != '' }}"
with:
github_token: ${{ inputs.FLIPPCIRCLECIPULLER_REPO_TOKEN }}
buf_user: ${{ inputs.BUF_BUILD_USER }}
buf_api_token: ${{ inputs.BUF_BUILD_API_TOKEN }}
20 changes: 11 additions & 9 deletions go/deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ inputs:
BUF_REPO_NAME:
description: Name of the buf repo to be built
required: false
FLIPPCIRCLECIPULLER_REPO_TOKEN:
description: Flipp circleci repo token
required: true

runs:
using: 'composite'
Expand All @@ -20,15 +23,14 @@ runs:
path: vendor
key: vendor-cache-${{ hashFiles('go.mod','go.sum') }}
restore-keys: vendor-cache-${{ hashFiles('go.mod','go.sum') }}
- name: Vendorizing Go dependencies
shell: bash
- name: Setting up private modules access
if: steps.vendor-cache.outputs.cache-hit != 'true'
run: go mod vendor
- name: Validating Go dependencies
shell: bash
run: go mod tidy
run: |
set -e
# Check that go.mod and go.sum are up to date
go mod tidy
git diff --exit-code -- go.mod go.sum
go mod vendor
- name: Caching workspace for deploy jobs
uses: actions/cache@v3
with:
path: ./*
key: workspace-cache-${{ github.run_id }}
uses: wishabi/github-actions/cache@v0
4 changes: 3 additions & 1 deletion sonarqube-scan/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ runs:
using: "composite"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setting up sonarqube
uses: warchant/setup-sonar-scanner@v3
uses: warchant/setup-sonar-scanner@v4
- name: Downloading test report
uses: actions/download-artifact@v3
with:
Expand Down

0 comments on commit 549513f

Please sign in to comment.