Skip to content

Refactor Processing Function (Extract Artifacts) & Add Calibration Workflow #18

Refactor Processing Function (Extract Artifacts) & Add Calibration Workflow

Refactor Processing Function (Extract Artifacts) & Add Calibration Workflow #18

Workflow file for this run

name: Test Lambda Function Locally and Upload Artifacts
on: [pull_request]
jobs:
test-and-upload:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Build Lambda Docker Image
run: |
cd lambda_function
docker build -t processing_function:latest .
- name: Run Lambda Docker Container
run: |
docker run -d -p 9000:8080 -e USE_INSTRUMENT_TEST_DATA=True processing_function:latest
container_id=$(docker ps -qf "ancestor=processing_function:latest")
echo "Container ID: $container_id"
- name: Wait for Container to Initialize
run: sleep 5
- name: Test Lambda Function with curl
run: |
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d @lambda_function/tests/test_data/test_eea_event.json
- name: Copy Processed Files from Container
run: |
container_id=$(docker ps -qf "ancestor=processing_function:latest")
# Create a directory for processed files
mkdir processed_files
# Copy the files from the container to the host
docker cp $container_id:/test_data/. processed_files/
- name: Upload Processed Files as Artifact
id: artifact-upload-step
uses: actions/upload-artifact@v4
with:
name: processed-files
path: processed_files/
- name: Echo Artifact URL
run: echo "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.artifact-upload-step.outputs.artifact-id }}"
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '👋 Processed files are available at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.artifact-upload-step.outputs.artifact-id }}'
})