Repository navigation
Update the LocalStack sandbox steps in .github/workflows/main.yml #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy on LocalStack | |
| on: | |
| push: | |
| paths-ignore: | |
| - 'README.md' | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| sam: | |
| name: Deploy the SAM application | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install lstk | |
| run: | | |
| npm install -g @localstack/lstk | |
| lstk setup aws --force --non-interactive | |
| - name: Install dependencies | |
| run: make install | |
| # >>> localstack-platform: start (project "lambda-sam-authorizer", proj_b1e4056f) | |
| - name: Start LocalStack in a platform sandbox | |
| id: localstack-platform | |
| env: | |
| LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_PLATFORM_AUTH_TOKEN }} | |
| LSTK_PROJECT_REVIEW_LEG: ${{ strategy.job-index == 0 }} | |
| run: | | |
| pipx install --force "https://localstack-artifacts-internal.s3.eu-central-1.amazonaws.com/packages/lstk-project/lstk_project-0.1.1-py3-none-any.whl" > /dev/null | |
| npm install -g @localstack/lstk > /dev/null | |
| lstk-project start "lambda-sam-authorizer" | |
| # <<< localstack-platform: start | |
| - name: Deploy the SAM application | |
| run: make deploy | |
| - name: Run tests | |
| run: make test | |
| - name: Show LocalStack logs | |
| if: failure() | |
| run: lstk-project logs "lambda-sam-authorizer" | tail -200 # localstack-platform (was: lstk logs) | |
| # >>> localstack-platform: shutdown (project "lambda-sam-authorizer", proj_b1e4056f) | |
| - name: Report to LocalStack and release the sandbox | |
| if: always() | |
| env: | |
| LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_PLATFORM_AUTH_TOKEN }} | |
| LSTK_PROJECT_REVIEW_LEG: ${{ strategy.job-index == 0 }} | |
| run: lstk-project shutdown "lambda-sam-authorizer" --status ${{ job.status }} --wait | |
| # <<< localstack-platform: shutdown |