Provides an entry point that builds and returns a combined LH + RH keyboard firmware when provided a keymap via a POST body. Wraps compilation with ccache, and includes a pre-warmed cache of the build in /tmp/ccache. To maximize chance of a direct cache hit, changes the lambda driver to always build in /tmp/build. some back of the envelope measurements (2012 xeon e3-1230v2, nixos) clean build, no cache -> 21.308 clean build, cache -> 7.145 modified keymap, clean build, cache -> 12.127
38 lines
1.4 KiB
YAML
38 lines
1.4 KiB
YAML
name: Clean up PR Compiler Service Container
|
|
|
|
on:
|
|
pull_request:
|
|
types: [closed]
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
if: github.repository == 'moergo-sc/zmk'
|
|
runs-on: ubuntu-latest
|
|
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
|
|
permissions:
|
|
id-token: write
|
|
contents: read
|
|
env:
|
|
ECR_REPOSITORY: zmk-builder-lambda
|
|
UPDATE_COMPILER_VERSIONS_FUNCTION: arn:aws:lambda:us-east-1:431227615537:function:Glove80FirmwarePipelineSt-UpdateCompilerVersions2A-CNxPOHb4VSuV
|
|
PR_NUMBER: ${{ github.event.number }}
|
|
steps:
|
|
- name: Extract image tag name
|
|
shell: bash
|
|
run: |
|
|
tag="pr${PR_NUMBER}.${GITHUB_HEAD_REF}"
|
|
# Replace / with . in container tag names
|
|
tag="${tag//\//.}"
|
|
echo "IMAGE_TAG=${tag}" >> $GITHUB_ENV
|
|
id: extract_name
|
|
- name: Configure AWS credentials
|
|
uses: aws-actions/configure-aws-credentials@v1
|
|
with:
|
|
role-to-assume: arn:aws:iam::431227615537:role/GithubCompilerLambdaBuilder
|
|
aws-region: us-east-1
|
|
- name: Delete the container image for the PR from ECR
|
|
run: aws ecr batch-delete-image --repository-name $ECR_REPOSITORY --image-ids imageTag=$IMAGE_TAG
|
|
- name: Notify the build pipeline that the compile containers have updated
|
|
run: aws lambda invoke --function-name $UPDATE_COMPILER_VERSIONS_FUNCTION /dev/null
|