Skip to content

Commit 3be43fd

Browse files
authored
chore(ci): add codebuild github actions runner managed pr build (#35005)
### Issue # (if applicable) Closes # ### Reason for this change Adds new PR build that runs on CodeBuild managed Github Actions runner ### Description of changes PR Build github workflow ### Describe any new or updated permissions being added ### Description of how you validated changes ### Checklist - [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent fb1792c commit 3be43fd

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Codebuild PR Build
2+
3+
on:
4+
workflow_dispatch: {}
5+
merge_group: {}
6+
push:
7+
branches:
8+
- main
9+
- v2-release
10+
pull_request:
11+
branches:
12+
- main
13+
- v2-release
14+
15+
# For every PR, cancel any previous builds in progress
16+
# ... but for all other builds we keep them running
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.pull_request.number || github.run_id }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
build:
23+
runs-on: codebuild-aws-cdk-github-actions-runner-${{ github.run_id }}-${{ github.run_attempt }}
24+
25+
env:
26+
PR_BUILD: true
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
32+
- name: Setup Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: "18"
36+
cache: "yarn"
37+
38+
- name: Set up Docker
39+
uses: docker/setup-buildx-action@v3
40+
41+
- name: Load Docker images
42+
id: docker-cache
43+
uses: actions/cache/restore@v4
44+
with:
45+
path: |
46+
~/.docker-images.tar
47+
key: docker-cache-${{ runner.os }}
48+
49+
- name: Restore Docker images
50+
if: ${{ steps.docker-cache.outputs.cache-hit }}
51+
run: docker image load --input ~/.docker-images.tar
52+
53+
- name: Cache build artifacts
54+
uses: actions/cache@v4
55+
with:
56+
path: |
57+
~/.s3buildcache
58+
key: s3buildcache-${{ runner.os }}
59+
60+
- name: Configure system settings
61+
run: |
62+
(command -v sysctl || sudo apt-get update && sudo apt-get install -y procps) && \
63+
sudo sysctl -w vm.max_map_count=2251954
64+
65+
- name: Build
66+
run: /bin/bash ./build.sh --ci
67+
68+
- name: Run Rosetta
69+
run: /bin/bash ./scripts/run-rosetta.sh
70+
71+
- name: Check for uncommitted changes
72+
run: git diff-index --exit-code --ignore-space-at-eol --stat HEAD
73+
74+
- name: Export Docker images
75+
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
76+
run: docker image save --output ~/.docker-images.tar $(docker image list --format '{{ if ne .Repository "<none>" }}{{ .Repository }}{{ if ne .Tag "<none>" }}:{{ .Tag }}{{ end }}{{ else }}{{ .ID }}{{ end }}')
77+
78+
- name: Cache Docker images
79+
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
80+
uses: actions/cache/save@v4
81+
with:
82+
path: |
83+
~/.docker-images.tar
84+
key: docker-cache-${{ runner.os }}

0 commit comments

Comments
 (0)