-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (71 loc) · 2.5 KB
/
build-app.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Build App
on:
workflow_call:
inputs:
repo:
type: string
required: true
cache_requirements:
type: boolean
default: true
env:
AR_REPO: ${{ inputs.repo }}
jobs:
build:
name: Build App
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- id: "auth"
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
name: "Authenticate to Google Cloud"
uses: "google-github-actions/[email protected]"
with:
token_format: "access_token"
workload_identity_provider: ${{ secrets.CODECOV_GCP_WIDP }}
service_account: ${{ secrets.CODECOV_GCP_WIDSA }}
- name: Docker configuration
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
run: |-
echo ${{steps.auth.outputs.access_token}} | docker login -u oauth2accesstoken --password-stdin https://us-docker.pkg.dev
- name: Cache Requirements
id: cache-requirements
if: inputs.cache_requirements
uses: actions/cache@v4
env:
cache-name: cache-requirements
with:
path: |
requirements.tar
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/docker/Dockerfile.requirements') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Cache App
id: cache-app
uses: actions/cache@v4
env:
cache-name: cache-app
with:
path: |
app.tar
key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.run_id }}
- name: Load requirements from cache
if: ${{ steps.cache-requirements.outputs.cache-hit == 'true' && inputs.cache_requirements }}
run: |
make load.requirements
- name: Build/pull requirements
if: ${{ steps.cache-requirements.outputs.cache-hit != 'true' && inputs.cache_requirements }}
run: |
make build.requirements
make save.requirements
- name: Push Requirements
if: ${{ steps.cache-requirements.outputs.cache-hit != 'true' && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' && inputs.cache_requirements }}
run: |
make push.requirements
- name: Build app
run: |
make build.app
make save.app