Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: CI Build

on:
# To enable build on push to main or pr to main, uncomment below
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]

# Allow invocation of this workflow through the GitHub.com UI
workflow_dispatch: {}

env:
PR_NUMBER: ${{ github.event.pull_request.number }}
NODE_ENV: production
DISABLE_OPENCOLLECTIVE: true
SAM_CLI_TELEMETRY: 0
AWS_REGION: us-east-2
SAM_BUCKET: ''

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Use Node.js 14
uses: actions/setup-node@v2
with:
node-version: 14
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: Use Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: Install awscli
run: |
pip3 install aws-sam-cli --upgrade --user

- name: Install Node Modules
run: npm ci
env:
NODE_ENV: development

- name: Audit Node Modules
run: npm audit --audit-level=moderate

- name: Install Node Modules
run: npm run lint

- name: Build
run: npm run build

# To deploy to AWS:
# Set SAM_BUCKET to your S3 Bucket for SAM artifacts
# Set org-level or repo-level secrets:
# AWS_ACCESS_KEY_ID
# AWS_SECRET_ACCESS_KEY
# Attaching the following policies to the user / role used by this
# workflow would be sufficient, but also overly broad:
# - AWSLambda_FullAccess
# - AmazonS3FullAccess
- if: ${{ env.SAM_BUCKET != '' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
name: Deploy
run: npm run deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Sharp for AWS Lambda (with HEIC support)
AWS Lambda Layer providing [sharp](https://github.com/lovell/sharp) with HEIC (and WebP) support

![Build Status](https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiKzJabytWb002SWpGcnVPMFp2K2VIZVR3QTZkYkx5L1gyZmFyV281emxnNzRFeklPdWF6ZDdBVllBczA4MVFxdDhpZnBaMnNneFk5WWx4Y3ZxUkplejIwPSIsIml2UGFyYW1ldGVyU3BlYyI6IkJKYlVqRVNSQlk2am5rUmwiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=main)
![CodeBuild Build Status](https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiKzJabytWb002SWpGcnVPMFp2K2VIZVR3QTZkYkx5L1gyZmFyV281emxnNzRFeklPdWF6ZDdBVllBczA4MVFxdDhpZnBaMnNneFk5WWx4Y3ZxUkplejIwPSIsIml2UGFyYW1ldGVyU3BlYyI6IkJKYlVqRVNSQlk2am5rUmwiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=main)
![GitHub Actions Build Status](https://github.com/zoellner/sharp-heic-lambda-layer/workflows/CI%20Build/badge.svg)

## Prerequisites

Expand All @@ -14,7 +15,7 @@ Due to potential license concerns for the HEVC patent group, this repo can't be

But you can compile and deploy this lambda layer yourself at your own risk and use it wihin your own accounts. All you need is an S3 bucket to deploy the compiled code to (replace `your-s3-bucket` in the code snippet below). Please see the note below regarding the build process.

It is recommended to automate this process using AWS CodeBuild. A buildspec file is provided in the repo. In that case you'll have to set the `SAM_BUCKET` environment variable in CodeBuild. For other environment variables see the table below.
It is recommended to automate this process using AWS CodeBuild or GitHub Actions. A `buildspec.yaml` file is provided as an example for CodeBuild and `.github/workflows/ci.yml` is provided as an example for GitHub Actions. In that case you'll have to set the `SAM_BUCKET` environment variable in CodeBuild. For other environment variables see the table below.

```bash
npm run build
Expand Down
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
###### Requirements without Version Specifiers ######
aws-sam-cli