-
Notifications
You must be signed in to change notification settings - Fork 33
66 lines (56 loc) · 1.79 KB
/
lambda.yaml
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
name: Build and deploy lambda function
on:
workflow_dispatch:
push:
tags:
- 'v*'
jobs:
build-upload-lambda-function:
name: Build and deploy
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Checkout resctl-demo repository
uses: actions/checkout@v2
with:
path: 'resctl-demo'
- name: Install musl toolchain
run: sudo apt install -y musl-tools
- name: Add musl target
run: rustup target add x86_64-unknown-linux-musl
- name: Build with all features
env:
CC_x86_64_unknown_linux_musl: musl-gcc
run: >
cd ${GITHUB_WORKSPACE}/resctl-demo &&
cargo build --release --features lambda --target x86_64-unknown-linux-musl
- name: Package for AWS lambda
run: >
find ;
cp resctl-demo/target/x86_64-unknown-linux-musl/release/resctl-bench ./bootstrap &&
zip -j resctl-bench-lambda.zip bootstrap
- name: Publish artifact
uses: actions/upload-artifact@v2
with:
name: resctl-bench-lambda
retention-days: 14
if-no-files-found: error
path: |
bootstrap
- name: Prepare AWS environment
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 1200
aws-region: ${{ secrets.AWS_REGION }}
- name: Update lambda function
run: >
aws lambda update-function-code --function-name "iocost-submit" --zip-file fileb://resctl-bench-lambda.zip