Skip to content

Commit 0854c6a

Browse files
[as-1069] Add asdf and pre-commit caches (#501)
* feat(workflows): add new workflows for asdf and pre-commit to create cache on merge to main (to speed up installs). chore(workflows): update names of asdf-dependabot-update workflow steps. chore(pr-template): add priority to rationale. chore(workflows): replace existing usage of asdf install to use new action (with cache for speedups). * chore(workflows): add steps to checkout voxel51/aloha-github-workflows. Add `sed` statement to replace repo action (generate-version-file) with relative action. Update relative path for `asdf-install-and-cache` action. Pass secrets to `workflow_call` workflows.
1 parent c1cd467 commit 0854c6a

8 files changed

Lines changed: 201 additions & 18 deletions

File tree

.github/pull_request_template.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
<!-- Explain why you are making this change. Describe the problem. -->
44

5+
<!-- Please also assign a priority label to the PR. -->
6+
Review Priority
7+
8+
* [ ] high
9+
* [ ] medium
10+
* [ ] low
11+
512
## Changes
613

714
<!-- Describe the changes. -->
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: Create GitHub Caches for default branch
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
jobs:
9+
cache-asdf-tools:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v6.0.1
13+
- name: Checkout voxel51/aloha-github-workflows
14+
uses: actions/checkout@v6.0.1
15+
with:
16+
repository: voxel51/aloha-github-workflows
17+
ref: main
18+
token: ${{ secrets.ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT }}
19+
path: ./.github/actions/aloha-github-workflows
20+
- name: Set generate-version-file action's path from remote to local
21+
# Public repos cannot access private action repo without GitHub Enterprise
22+
# Instead, we clone the private workflow directory and update the `asdf-install-and-cache/action.yml`
23+
# file's reference to `voxel51/aloha-github-workflows/.github/actions/generate-version-file` with the local path.
24+
shell: bash
25+
run: |
26+
sed -i \
27+
's%voxel51/aloha-github-workflows/.github/actions/generate-version-file@main%./.github/actions/aloha-github-workflows/.github/actions/generate-version-file%' \
28+
.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache/action.yml
29+
- name: Cache asdf tools
30+
uses: ./.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache
31+
cache-pre-commit-repos:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v6.0.1
35+
- name: Checkout voxel51/aloha-github-workflows
36+
uses: actions/checkout@v6.0.1
37+
with:
38+
repository: voxel51/aloha-github-workflows
39+
ref: main
40+
token: ${{ secrets.ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT }}
41+
path: ./.github/actions/aloha-github-workflows
42+
- name: Set generate-version-file action's path from remote to local
43+
# Public repos cannot access private action repo without GitHub Enterprise
44+
# Instead, we clone the private workflow directory and update the `asdf-install-and-cache/action.yml`
45+
# file's reference to `voxel51/aloha-github-workflows/.github/actions/generate-version-file` with the local path.
46+
shell: bash
47+
run: |
48+
sed -i \
49+
's%voxel51/aloha-github-workflows/.github/actions/generate-version-file@main%./.github/actions/aloha-github-workflows/.github/actions/generate-version-file%' \
50+
.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache/action.yml
51+
- name: Cache pre-commit repos
52+
uses: ./.github/actions/aloha-github-workflows/.github/actions/pre-commit-cache

.github/workflows/pr.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,25 @@ jobs:
5151
if: ${{ needs.modified-files.outputs.docker-unit-required == 'true' }}
5252
uses: ./.github/workflows/test-docker.yml
5353
secrets:
54-
REPO_GOOGLE_WORKLOAD_IDP: ${{ secrets.REPO_GOOGLE_WORKLOAD_IDP }}
5554
FO_INTERNAL_LICENSE: ${{ secrets.FO_INTERNAL_LICENSE }}
5655
FO_LEGACY_LICENSE: ${{ secrets.FO_LEGACY_LICENSE }}
56+
ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT: ${{ secrets.ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT }}
57+
REPO_GOOGLE_WORKLOAD_IDP: ${{ secrets.REPO_GOOGLE_WORKLOAD_IDP }}
5758

5859
helm-integration:
5960
needs: modified-files
6061
if: ${{ needs.modified-files.outputs.helm-integration-required == 'true' }}
6162
uses: ./.github/workflows/test-integration-helm.yml
6263
secrets:
64+
ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT: ${{ secrets.ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT }}
6365
REPO_GOOGLE_WORKLOAD_IDP: ${{ secrets.REPO_GOOGLE_WORKLOAD_IDP }}
6466

6567
helm-unit:
6668
needs: modified-files
6769
if: ${{ needs.modified-files.outputs.helm-unit-required == 'true' }}
6870
uses: ./.github/workflows/test-helm.yml
71+
secrets:
72+
ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT: ${{ secrets.ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT }}
6973

7074
validate-chart-version:
7175
# Always run check, even if no helm changes.

.github/workflows/pre-commit.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,27 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v6
19+
- name: Checkout voxel51/aloha-github-workflows
20+
uses: actions/checkout@v6
21+
with:
22+
repository: voxel51/aloha-github-workflows
23+
ref: main
24+
token: ${{ secrets.ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT }}
25+
path: ./.github/actions/aloha-github-workflows
26+
- name: Set generate-version-file action's path from remote to local
27+
# Public repos cannot access private action repo without GitHub Enterprise
28+
# Instead, we clone the private workflow directory and update the `asdf-install-and-cache/action.yml`
29+
# file's reference to `voxel51/aloha-github-workflows/.github/actions/generate-version-file` with the local path.
30+
shell: bash
31+
run: |
32+
sed -i \
33+
's%voxel51/aloha-github-workflows/.github/actions/generate-version-file@main%./.github/actions/aloha-github-workflows/.github/actions/generate-version-file%' \
34+
.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache/action.yml
1935
- uses: actions/setup-python@v6.2.0
2036
- name: Temporary SQLite/LZMA - Install missing libraries
2137
run: sudo apt install -y libsqlite3-dev libbz2-dev
22-
- name: install asdf & tools
23-
uses: asdf-vm/actions/install@v4.0.1
38+
- name: Install asdf & tools
39+
uses: ./.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache
2440
- name: Install helm plugins
2541
run: make helm-plugins
2642
- uses: pre-commit/action@v3.0.1

.github/workflows/test-docker-pulls.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,26 @@ jobs:
2424
steps:
2525
- uses: actions/checkout@v6
2626
- uses: actions/setup-python@v6.2.0
27+
- name: Checkout voxel51/aloha-github-workflows
28+
uses: actions/checkout@v6
29+
with:
30+
repository: voxel51/aloha-github-workflows
31+
ref: main
32+
token: ${{ secrets.ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT }}
33+
path: ./.github/actions/aloha-github-workflows
34+
- name: Set generate-version-file action's path from remote to local
35+
# Public repos cannot access private action repo without GitHub Enterprise
36+
# Instead, we clone the private workflow directory and update the `asdf-install-and-cache/action.yml`
37+
# file's reference to `voxel51/aloha-github-workflows/.github/actions/generate-version-file` with the local path.
38+
shell: bash
39+
run: |
40+
sed -i \
41+
's%voxel51/aloha-github-workflows/.github/actions/generate-version-file@main%./.github/actions/aloha-github-workflows/.github/actions/generate-version-file%' \
42+
.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache/action.yml
2743
- name: Temporary SQLite/LZMA - Install missing libraries
2844
run: sudo apt install -y libsqlite3-dev libbz2-dev
29-
- name: install asdf & tools
30-
uses: asdf-vm/actions/install@v4.0.1
45+
- name: Install asdf & tools
46+
uses: ./.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache
3147
- name: Login to Docker Hub
3248
uses: docker/login-action@v3
3349
with:

.github/workflows/test-docker.yml

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,39 @@ name: Tests - Docker Compose
44
on:
55
workflow_call:
66
secrets:
7-
REPO_GOOGLE_WORKLOAD_IDP:
8-
required: true
97
FO_INTERNAL_LICENSE:
108
required: true
119
FO_LEGACY_LICENSE:
1210
required: true
11+
ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT:
12+
required: true
13+
REPO_GOOGLE_WORKLOAD_IDP:
14+
required: true
1315

1416
jobs:
1517
unit-compose:
1618
runs-on: ubuntu-latest
1719
steps:
1820
- uses: actions/checkout@v6
21+
- name: Checkout voxel51/aloha-github-workflows
22+
uses: actions/checkout@v6
23+
with:
24+
repository: voxel51/aloha-github-workflows
25+
ref: main
26+
token: ${{ secrets.ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT }}
27+
path: ./.github/actions/aloha-github-workflows
28+
- name: Set generate-version-file action's path from remote to local
29+
# Public repos cannot access private action repo without GitHub Enterprise
30+
# Instead, we clone the private workflow directory and update the `asdf-install-and-cache/action.yml`
31+
# file's reference to `voxel51/aloha-github-workflows/.github/actions/generate-version-file` with the local path.
32+
shell: bash
33+
run: |
34+
sed -i \
35+
's%voxel51/aloha-github-workflows/.github/actions/generate-version-file@main%./.github/actions/aloha-github-workflows/.github/actions/generate-version-file%' \
36+
.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache/action.yml
1937
- uses: actions/setup-python@v6.2.0
20-
- name: install asdf & tools
21-
uses: asdf-vm/actions/install@v4.0.1
38+
- name: Install asdf & tools
39+
uses: ./.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache
2240
- name: Run unit tests
2341
shell: bash
2442
run: |
@@ -30,11 +48,27 @@ jobs:
3048
runs-on: ubuntu-latest
3149
steps:
3250
- uses: actions/checkout@v6
51+
- name: Checkout voxel51/aloha-github-workflows
52+
uses: actions/checkout@v6
53+
with:
54+
repository: voxel51/aloha-github-workflows
55+
ref: main
56+
token: ${{ secrets.ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT }}
57+
path: ./.github/actions/aloha-github-workflows
58+
- name: Set generate-version-file action's path from remote to local
59+
# Public repos cannot access private action repo without GitHub Enterprise
60+
# Instead, we clone the private workflow directory and update the `asdf-install-and-cache/action.yml`
61+
# file's reference to `voxel51/aloha-github-workflows/.github/actions/generate-version-file` with the local path.
62+
shell: bash
63+
run: |
64+
sed -i \
65+
's%voxel51/aloha-github-workflows/.github/actions/generate-version-file@main%./.github/actions/aloha-github-workflows/.github/actions/generate-version-file%' \
66+
.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache/action.yml
3367
- uses: actions/setup-python@v6.2.0
3468
- name: Temporary SQLite/LZMA - Install missing libraries
3569
run: sudo apt install -y libsqlite3-dev libbz2-dev
36-
- name: install asdf & tools
37-
uses: asdf-vm/actions/install@v4.0.1
70+
- name: Install asdf & tools
71+
uses: ./.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache
3872
- name: Authenticate to Google Cloud
3973
id: auth
4074
uses: google-github-actions/auth@v3
@@ -69,9 +103,25 @@ jobs:
69103
runs-on: ubuntu-latest
70104
steps:
71105
- uses: actions/checkout@v6
106+
- name: Checkout voxel51/aloha-github-workflows
107+
uses: actions/checkout@v6
108+
with:
109+
repository: voxel51/aloha-github-workflows
110+
ref: main
111+
token: ${{ secrets.ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT }}
112+
path: ./.github/actions/aloha-github-workflows
113+
- name: Set generate-version-file action's path from remote to local
114+
# Public repos cannot access private action repo without GitHub Enterprise
115+
# Instead, we clone the private workflow directory and update the `asdf-install-and-cache/action.yml`
116+
# file's reference to `voxel51/aloha-github-workflows/.github/actions/generate-version-file` with the local path.
117+
shell: bash
118+
run: |
119+
sed -i \
120+
's%voxel51/aloha-github-workflows/.github/actions/generate-version-file@main%./.github/actions/aloha-github-workflows/.github/actions/generate-version-file%' \
121+
.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache/action.yml
72122
- uses: actions/setup-python@v6.2.0
73-
- name: install asdf & tools
74-
uses: asdf-vm/actions/install@v4.0.1
123+
- name: Install asdf & tools
124+
uses: ./.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache
75125
- name: Authenticate to Google Cloud
76126
id: auth
77127
uses: google-github-actions/auth@v3

.github/workflows/test-helm.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
11
---
22
name: Tests - Helm
33

4-
on: workflow_call
4+
on:
5+
workflow_call:
6+
secrets:
7+
ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT:
8+
required: true
59

610
jobs:
711
unit-helm:
812
runs-on: ubuntu-latest
913
steps:
1014
- uses: actions/checkout@v6
15+
- name: Checkout voxel51/aloha-github-workflows
16+
uses: actions/checkout@v6
17+
with:
18+
repository: voxel51/aloha-github-workflows
19+
ref: main
20+
token: ${{ secrets.ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT }}
21+
path: ./.github/actions/aloha-github-workflows
22+
- name: Set generate-version-file action's path from remote to local
23+
# Public repos cannot access private action repo without GitHub Enterprise
24+
# Instead, we clone the private workflow directory and update the `asdf-install-and-cache/action.yml`
25+
# file's reference to `voxel51/aloha-github-workflows/.github/actions/generate-version-file` with the local path.
26+
shell: bash
27+
run: |
28+
sed -i \
29+
's%voxel51/aloha-github-workflows/.github/actions/generate-version-file@main%./.github/actions/aloha-github-workflows/.github/actions/generate-version-file%' \
30+
.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache/action.yml
1131
- uses: actions/setup-python@v6.2.0
1232
- name: Temporary SQLite/LZMA - Install missing libraries
1333
run: sudo apt install -y libsqlite3-dev libbz2-dev
14-
- name: install asdf & tools
15-
uses: asdf-vm/actions/install@v4.0.1
34+
- name: Install asdf & tools
35+
uses: ./.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache
1636
- name: Run unit tests
1737
shell: bash
1838
run: |

.github/workflows/test-integration-helm.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ name: Tests - Integration Helm
44
on:
55
workflow_call:
66
secrets:
7+
ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT:
8+
required: true
79
REPO_GOOGLE_WORKLOAD_IDP:
810
required: true
911

@@ -15,11 +17,27 @@ jobs:
1517
id-token: 'write'
1618
steps:
1719
- uses: actions/checkout@v6
20+
- name: Checkout voxel51/aloha-github-workflows
21+
uses: actions/checkout@v6
22+
with:
23+
repository: voxel51/aloha-github-workflows
24+
ref: main
25+
token: ${{ secrets.ORG_RO_ALOHA_GITHUB_WORKFLOWS_FG_PAT }}
26+
path: ./.github/actions/aloha-github-workflows
27+
- name: Set generate-version-file action's path from remote to local
28+
# Public repos cannot access private action repo without GitHub Enterprise
29+
# Instead, we clone the private workflow directory and update the `asdf-install-and-cache/action.yml`
30+
# file's reference to `voxel51/aloha-github-workflows/.github/actions/generate-version-file` with the local path.
31+
shell: bash
32+
run: |
33+
sed -i \
34+
's%voxel51/aloha-github-workflows/.github/actions/generate-version-file@main%./.github/actions/aloha-github-workflows/.github/actions/generate-version-file%' \
35+
.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache/action.yml
1836
- uses: actions/setup-python@v6.2.0
1937
- name: Temporary SQLite/LZMA - Install missing libraries
2038
run: sudo apt install -y libsqlite3-dev libbz2-dev
21-
- name: install asdf & tools
22-
uses: asdf-vm/actions/install@b7bcd026f18772e44fe1026d729e1611cc435d47
39+
- name: Install asdf & tools
40+
uses: ./.github/actions/aloha-github-workflows/.github/actions/asdf-install-and-cache
2341
- name: Authenticate to Google Cloud
2442
uses: google-github-actions/auth@v3
2543
with:

0 commit comments

Comments
 (0)