Skip to content

update iam lambda user policy #35

update iam lambda user policy

update iam lambda user policy #35

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- main
jobs:
test-and-build-api-products:
name: Test and Build API
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.22.4'
- name: Sync modules
run: go work sync
working-directory: .
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
working-directory: ./api-products
run: go mod download
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6.0.1
with:
working-directory: .
args: --out-format colored-line-number ./api-products/...
- name: Run tests
working-directory: ./api-products
run: go test -coverprofile=coverage.out ./...
- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build API binary
working-directory: ./api-products
run: GOOS=linux GOARCH=amd64 go build -o bootstrap main.go
- name: Zip API binary
working-directory: ./api-products
run: zip api_products_lambda.zip bootstrap
- name: Upload API artifact
uses: actions/upload-artifact@v2
with:
name: api_products_lambda
path: ./api-products/api_products_lambda.zip
test-and-build-scraper:
name: Test and Build Scraper
runs-on: ubuntu-latest
needs: test-and-build-api-products
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.22.4'
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
working-directory: ./scraper
run: go mod download
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6.0.1
with:
working-directory: .
args: --out-format colored-line-number ./scraper/...
- name: Run tests
working-directory: ./scraper
run: go test -coverprofile=coverage.out ./...
- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build Scraper binary
working-directory: ./scraper
run: GOOS=linux GOARCH=amd64 go build -o bootstrap main.go
- name: Zip Scraper binary
working-directory: ./scraper
run: zip scraper_lambda.zip bootstrap
- name: Upload Scraper artifact
uses: actions/upload-artifact@v2
with:
name: scraper_lambda
path: ./scraper/scraper_lambda.zip
test-and-build-api-users:
name: Test and Build API Users
runs-on: ubuntu-latest
env:
JWT_SECRET: ${{ secrets.JWT_SECRET }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.22.4'
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
working-directory: ./api-users
run: go mod download
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6.0.1
with:
working-directory: .
args: --out-format colored-line-number ./api-users/...
- name: Run tests
working-directory: ./api-users
run: go test -coverprofile=coverage.out ./...
- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build API Users binary
working-directory: ./api-users
run: GOOS=linux GOARCH=amd64 go build -o bootstrap main.go
- name: Zip API Users binary
working-directory: ./api-users
run: zip api_users_lambda.zip bootstrap
- name: Upload API Users artifact
uses: actions/upload-artifact@v2
with:
name: api_users_lambda
path: ./api-users/api_users_lambda.zip
test-and-build-authorizer:
name: Test and Build Authorizer
runs-on: ubuntu-latest
needs: test-and-build-api-users
env:
JWT_SECRET: ${{ secrets.JWT_SECRET }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.22.4'
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
working-directory: ./authorizer
run: go mod download
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6.0.1
with:
working-directory: .
args: --out-format colored-line-number ./authorizer/...
- name: Run tests
working-directory: ./authorizer
run: go test -coverprofile=coverage.out ./...
- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build Authorizer binary
working-directory: ./authorizer
run: GOOS=linux GOARCH=amd64 go build -o bootstrap main.go
- name: Zip Authorizer binary
working-directory: ./authorizer
run: zip authorizer_lambda.zip bootstrap
- name: Upload Authorizer artifact
uses: actions/upload-artifact@v2
with:
name: authorizer_lambda
path: ./authorizer/authorizer_lambda.zip
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [test-and-build-api-products, test-and-build-scraper, test-and-build-api-users]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download API artifact
uses: actions/download-artifact@v2
with:
name: api_products_lambda
path: ./terraform
- name: Download Scraper artifact
uses: actions/download-artifact@v2
with:
name: scraper_lambda
path: ./terraform
- name: Download API Users artifact
uses: actions/download-artifact@v2
with:
name: api_users_lambda
path: ./terraform
- name: Download Authorizer artifact
uses: actions/download-artifact@v2
with:
name: authorizer_lambda
path: ./terraform
- name: Set up Terraform
uses: hashicorp/setup-terraform@v1
- name: Initialize Terraform
working-directory: ./terraform
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: terraform init
- name: Plan Terraform
working-directory: ./terraform
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: terraform plan
- name: Apply Terraform
working-directory: ./terraform
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: terraform apply -auto-approve