Skip to content
Merged
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
64 changes: 37 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.11'

- name: Set up JDK
uses: actions/setup-java@v2
Expand All @@ -36,40 +41,45 @@ jobs:
- name: Set up Maven
run: sudo apt-get install -y maven

- name: Install localstack & awslocal
- name: Start LocalStack
uses: LocalStack/setup-localstack@v0.2.4
with:
image-tag: 'latest'
use-pro: 'true'
configuration: LS_LOG=trace
install-awslocal: 'true'
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}

- name: Install Terraform
uses: hashicorp/setup-terraform@v3

- name: Install tflocal
run: |
pip install localstack
pip install terraform-local
pip install awscli-local
pip install --upgrade terraform-local

- name: Build project
run: |
cd shipment-picture-lambda-validator
mvn clean package shade:shade

- name: Start LocalStack
run: |
docker pull localstack/localstack:latest
# Start LocalStack in the background
LS_LOG=trace localstack start -d
# Wait 30 seconds for the LocalStack container to become ready before timing out
echo "Waiting for LocalStack startup..."
localstack wait -t 15
echo "Startup complete"

- name: Run Terraform Config File
- name: Deploy using Terraform
run: |
cd terraform
bash run-tflocal.sh
tflocal init
tflocal plan
tflocal apply --auto-approve

- name: Build frontend
run: |
cd shipment-list-frontend
npm install
CI=false npm run build

- name: Check for Bucket
- name: Show LocalStack logs
if: always()
run: |
output=$(awslocal s3api list-buckets --query "Buckets[?contains(Name, 'shipment-picture-bucket')].Name" --output text)
if [ -z "$output" ]; then
echo "Created bucket not found."
exit 1
else echo "Bucket with random name was found: $output"
fi
localstack logs

- name: Send a Slack notification
if: failure() || github.event_name != 'pull_request'
Expand All @@ -91,7 +101,7 @@ jobs:

- name: Upload the Diagnostic Report
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: diagnose.json.gz
path: ./diagnose.json.gz
path: ./diagnose.json.gz
15 changes: 9 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ src/main/shipment-list-frontend/yarn-debug.log*
src/main/shipment-list-frontend/yarn-error.log*

# terraform

setup/terraform/terraform.tfstate
setup/terraform/.terraform.lock.hcl
setup/terraform/terraform.tfstate.backup
terraform/.terraform/
terraform/terraform.tfstate
terraform/.terraform.lock.hcl
terraform/terraform.tfstate.backup

# lambda module
/shipment-picture-lambda-validator/.idea
/shipment-picture-lambda-validator/target/
shipment-picture-lambda-validator/.idea
shipment-picture-lambda-validator/target/

# frontend
shipment-list-frontend/node_modules
1 change: 1 addition & 0 deletions shipment-list-frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
18 changes: 16 additions & 2 deletions shipment-picture-lambda-validator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
<version>1.18.30</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand All @@ -84,6 +84,20 @@
</resources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand All @@ -103,4 +117,4 @@
</plugins>
</build>

</project>
</project>
4 changes: 2 additions & 2 deletions src/main/resources/buckets.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
shipment-picture-bucket=shipment-picture-bucket-artistic-alpaca
shipment-picture-bucket-validator=shipment-picture-lambda-validator-bucket-artistic-alpaca
shipment-picture-bucket=shipment-picture-bucket-polite-ghoul
shipment-picture-bucket-validator=shipment-picture-lambda-validator-bucket-polite-ghoul
4 changes: 0 additions & 4 deletions terraform/cleanup.sh

This file was deleted.

5 changes: 0 additions & 5 deletions terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.59.0"
}

random = {
source = "hashicorp/random"
version = "~> 3.6.2"
Expand Down
3 changes: 0 additions & 3 deletions terraform/run-tflocal.sh

This file was deleted.