Skip to content

Commit

Permalink
Merge pull request #6728 from onflow/jp/update-ci-workflow-for-v0.37
Browse files Browse the repository at this point in the history
Add support for building private dependencies in CI
  • Loading branch information
sjonpaulbrown authored Nov 19, 2024
2 parents 39b6c7f + ea28672 commit 54666f1
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 2 deletions.
44 changes: 43 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,19 @@ jobs:
# https://github.com/golangci/golangci-lint-action/issues/244
skip-cache: true


tidy:
name: Tidy
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup private build environment
if: ${{ vars.PRIVATE_BUILDS_SUPPORTED == 'true' }}
uses: ./actions/private-setup
with:
cadence_deploy_key: ${{ secrets.CADENCE_DEPLOY_KEY }}

- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time
Expand Down Expand Up @@ -139,6 +145,13 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup private build environment
if: ${{ vars.PRIVATE_BUILDS_SUPPORTED == 'true' }}
uses: ./actions/private-setup
with:
cadence_deploy_key: ${{ secrets.CADENCE_DEPLOY_KEY }}

- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time
Expand Down Expand Up @@ -178,6 +191,13 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup private build environment
if: ${{ vars.PRIVATE_BUILDS_SUPPORTED == 'true' }}
uses: ./actions/private-setup
with:
cadence_deploy_key: ${{ secrets.CADENCE_DEPLOY_KEY }}

- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time
Expand Down Expand Up @@ -216,6 +236,13 @@ jobs:
with:
# all tags are needed for integration tests
fetch-depth: 0

- name: Setup private build environment
if: ${{ vars.PRIVATE_BUILDS_SUPPORTED == 'true' }}
uses: ./actions/private-setup
with:
cadence_deploy_key: ${{ secrets.CADENCE_DEPLOY_KEY }}

- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time
Expand Down Expand Up @@ -255,9 +282,17 @@ jobs:
targets: ${{ fromJSON(needs.create-integration-dynamic-test-matrix.outputs.dynamic-matrix)}}
## need to set image explicitly due to GitHub logging issue as described in https://github.com/onflow/flow-go/pull/3087#issuecomment-1234383202
runs-on: ${{ matrix.targets.runner }}

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup private build environment
if: ${{ vars.PRIVATE_BUILDS_SUPPORTED == 'true' }}
uses: ./actions/private-setup
with:
cadence_deploy_key: ${{ secrets.CADENCE_DEPLOY_KEY }}

- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time
Expand Down Expand Up @@ -348,6 +383,13 @@ jobs:
with:
# all tags are needed for integration tests
fetch-depth: 0

- name: Setup private build environment
if: ${{ vars.PRIVATE_BUILDS_SUPPORTED == 'true' }}
uses: ./actions/private-setup
with:
cadence_deploy_key: ${{ secrets.CADENCE_DEPLOY_KEY }}

- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ IMAGE_TAG_ARM := $(IMAGE_TAG)-arm
# Name of the cover profile
COVER_PROFILE := coverage.txt
# Disable go sum database lookup for private repos
GOPRIVATE=github.com/dapperlabs/*
GOPRIVATE=github.com/onflow/*-internal
# OS
UNAME := $(shell uname)

Expand Down
29 changes: 29 additions & 0 deletions actions/private-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Private Build Setup"
description: "Checks and configures the environment for building private dependencies"
inputs:
cadence_deploy_key:
description: "Deploy Key for Private Cadence Repo"
required: true
go_private_value:
description: "The value for GOPRIVATE"
required: false
default: "github.com/onflow/*-internal"
runs:
using: "composite"
steps:
- name: Load deploy key
uses: webfactory/[email protected]
with:
ssh-private-key: "${{ inputs.cadence_deploy_key }}"
known-hosts: "github.com"

- name: Configure git for SSH
shell: bash
run: |
git config --global url."[email protected]:".insteadOf "https://github.com/"
- name: Configure GOPRIVATE env
shell: bash
run: |
echo "GOPRIVATE=${{ inputs.go_private_value }}" >> $GITHUB_ENV

0 comments on commit 54666f1

Please sign in to comment.