DEV Community

Efren Mercado Jr
Efren Mercado Jr

Posted on

Localstack S3 in Github Actions

In your workflow yml file:

services:
  localstack:
    image: localstack/localstack
    env:
      SERVICES: s3
      DEFAULT_REGION: ap-northeast-1
      DATA_DIR: /tmp/localstack/data
    ports: ["4566:4566"]
steps:
  - name: Configure localstack
    run: |
      aws configure set aws_access_key_id localstack
      aws configure set aws_secret_access_key localstack
      aws configure set default.region ap-northeast-1
      aws mb s3://my-bucket --endpoint-url=http://localhost:4566
  - name: Run tests
    env:
      DEFAULT_REGION: ap-northeast-1
      AWS_ACCESS_KEY_ID: localstack
      AWS_SECRET_ACCESS_KEY: localstack
    run: # command to run your tests
Enter fullscreen mode Exit fullscreen mode

Discussion (0)