|
| 1 | +name: Test and deploy gha-log-uploader |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - ".github/workflows/gha-log-uploader-lambda.yml" |
| 9 | + - "aws/lambda/gha-log-uploader/**" |
| 10 | + - "aws/lambda/call-log-classifier/**" |
| 11 | + pull_request: |
| 12 | + paths: |
| 13 | + - ".github/workflows/gha-log-uploader-lambda.yml" |
| 14 | + - "aws/lambda/gha-log-uploader/**" |
| 15 | + - "aws/lambda/call-log-classifier/**" |
| 16 | + |
| 17 | +jobs: |
| 18 | + test: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 22 | + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 |
| 23 | + with: |
| 24 | + python-version: '3.12' |
| 25 | + cache: pip |
| 26 | + - name: Test gha-log-uploader |
| 27 | + working-directory: aws/lambda/gha-log-uploader/ |
| 28 | + run: | |
| 29 | + pip3 install -r requirements.txt pytest |
| 30 | + pytest -v test_lambda_function.py |
| 31 | + - name: Test call-log-classifier |
| 32 | + working-directory: aws/lambda/call-log-classifier/ |
| 33 | + run: | |
| 34 | + pip3 install boto3 pytest |
| 35 | + pytest -v test_lambda_function.py |
| 36 | +
|
| 37 | + deploy: |
| 38 | + needs: test |
| 39 | + runs-on: ubuntu-latest |
| 40 | + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} |
| 41 | + permissions: |
| 42 | + id-token: write |
| 43 | + contents: read |
| 44 | + steps: |
| 45 | + - name: configure aws credentials |
| 46 | + uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # v1.7.0 |
| 47 | + with: |
| 48 | + role-to-assume: arn:aws:iam::308535385114:role/gha_workflow_gha-log-uploader-lambda |
| 49 | + aws-region: us-east-1 |
| 50 | + |
| 51 | + - name: Check out test infra |
| 52 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 53 | + |
| 54 | + - name: Setup python |
| 55 | + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 |
| 56 | + |
| 57 | + - uses: nick-fields/retry@3e91a01664abd3c5cd539100d10d33b9c5b68482 # v2.8.2 |
| 58 | + name: Setup dependencies |
| 59 | + with: |
| 60 | + shell: bash |
| 61 | + timeout_minutes: 10 |
| 62 | + max_attempts: 3 |
| 63 | + retry_wait_seconds: 30 |
| 64 | + command: | |
| 65 | + set -eux |
| 66 | + python3 -m pip install awscli |
| 67 | +
|
| 68 | + - name: Deploy gha-log-uploader |
| 69 | + working-directory: aws/lambda/gha-log-uploader/ |
| 70 | + run: make deploy |
| 71 | + |
| 72 | + - name: Deploy call-log-classifier |
| 73 | + working-directory: aws/lambda/call-log-classifier/ |
| 74 | + run: make deploy |
0 commit comments