Skip to content

Commit a4b5132

Browse files
Merge pull request #6727 from onflow/jp/update-ci
Add support for building private dependencies in CI
2 parents 8844d8e + 771319f commit a4b5132

File tree

3 files changed

+73
-2
lines changed

3 files changed

+73
-2
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,19 @@ jobs:
5555
# https://github.com/golangci/golangci-lint-action/issues/244
5656
skip-cache: true
5757

58-
5958
tidy:
6059
name: Tidy
6160
runs-on: ubuntu-latest
6261
steps:
6362
- name: Checkout repo
6463
uses: actions/checkout@v3
64+
65+
- name: Setup private build environment
66+
if: ${{ vars.PRIVATE_BUILDS_SUPPORTED == 'true' }}
67+
uses: ./actions/private-setup
68+
with:
69+
cadence_deploy_key: ${{ secrets.CADENCE_DEPLOY_KEY }}
70+
6571
- name: Setup Go
6672
uses: actions/setup-go@v4
6773
timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time
@@ -139,6 +145,13 @@ jobs:
139145
steps:
140146
- name: Checkout repo
141147
uses: actions/checkout@v3
148+
149+
- name: Setup private build environment
150+
if: ${{ vars.PRIVATE_BUILDS_SUPPORTED == 'true' }}
151+
uses: ./actions/private-setup
152+
with:
153+
cadence_deploy_key: ${{ secrets.CADENCE_DEPLOY_KEY }}
154+
142155
- name: Setup Go
143156
uses: actions/setup-go@v4
144157
timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time
@@ -178,6 +191,13 @@ jobs:
178191
steps:
179192
- name: Checkout repo
180193
uses: actions/checkout@v3
194+
195+
- name: Setup private build environment
196+
if: ${{ vars.PRIVATE_BUILDS_SUPPORTED == 'true' }}
197+
uses: ./actions/private-setup
198+
with:
199+
cadence_deploy_key: ${{ secrets.CADENCE_DEPLOY_KEY }}
200+
181201
- name: Setup Go
182202
uses: actions/setup-go@v4
183203
timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time
@@ -216,6 +236,13 @@ jobs:
216236
with:
217237
# all tags are needed for integration tests
218238
fetch-depth: 0
239+
240+
- name: Setup private build environment
241+
if: ${{ vars.PRIVATE_BUILDS_SUPPORTED == 'true' }}
242+
uses: ./actions/private-setup
243+
with:
244+
cadence_deploy_key: ${{ secrets.CADENCE_DEPLOY_KEY }}
245+
219246
- name: Setup Go
220247
uses: actions/setup-go@v4
221248
timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time
@@ -255,9 +282,17 @@ jobs:
255282
targets: ${{ fromJSON(needs.create-integration-dynamic-test-matrix.outputs.dynamic-matrix)}}
256283
## need to set image explicitly due to GitHub logging issue as described in https://github.com/onflow/flow-go/pull/3087#issuecomment-1234383202
257284
runs-on: ${{ matrix.targets.runner }}
285+
258286
steps:
259287
- name: Checkout repo
260288
uses: actions/checkout@v3
289+
290+
- name: Setup private build environment
291+
if: ${{ vars.PRIVATE_BUILDS_SUPPORTED == 'true' }}
292+
uses: ./actions/private-setup
293+
with:
294+
cadence_deploy_key: ${{ secrets.CADENCE_DEPLOY_KEY }}
295+
261296
- name: Setup Go
262297
uses: actions/setup-go@v4
263298
timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time
@@ -348,6 +383,13 @@ jobs:
348383
with:
349384
# all tags are needed for integration tests
350385
fetch-depth: 0
386+
387+
- name: Setup private build environment
388+
if: ${{ vars.PRIVATE_BUILDS_SUPPORTED == 'true' }}
389+
uses: ./actions/private-setup
390+
with:
391+
cadence_deploy_key: ${{ secrets.CADENCE_DEPLOY_KEY }}
392+
351393
- name: Setup Go
352394
uses: actions/setup-go@v4
353395
timeout-minutes: 10 # fail fast. sometimes this step takes an extremely long time

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ IMAGE_TAG_ARM := $(IMAGE_TAG)-arm
2626
# Name of the cover profile
2727
COVER_PROFILE := coverage.txt
2828
# Disable go sum database lookup for private repos
29-
GOPRIVATE=github.com/dapperlabs/*
29+
GOPRIVATE=github.com/onflow/*-internal
3030
# OS
3131
UNAME := $(shell uname)
3232

actions/private-setup/action.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "Private Build Setup"
2+
description: "Checks and configures the environment for building private dependencies"
3+
inputs:
4+
cadence_deploy_key:
5+
description: "Deploy Key for Private Cadence Repo"
6+
required: true
7+
go_private_value:
8+
description: "The value for GOPRIVATE"
9+
required: false
10+
default: "github.com/onflow/*-internal"
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: Load deploy key
15+
uses: webfactory/[email protected]
16+
with:
17+
ssh-private-key: "${{ inputs.cadence_deploy_key }}"
18+
known-hosts: "github.com"
19+
20+
- name: Configure git for SSH
21+
shell: bash
22+
run: |
23+
git config --global url."[email protected]:".insteadOf "https://github.com/"
24+
25+
- name: Configure GOPRIVATE env
26+
shell: bash
27+
run: |
28+
echo "GOPRIVATE=${{ inputs.go_private_value }}" >> $GITHUB_ENV
29+

0 commit comments

Comments
 (0)