Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
793ee7c
Added CI yaml file for GitHub Actions
liamsaul Mar 31, 2025
d915492
Changed node version to 23
liamsaul Mar 31, 2025
aaacdda
changed CI workflow
liamsaul Mar 31, 2025
e8597ea
modified testing yml file
liamsaul Mar 31, 2025
215a7d5
changed port to 3000
liamsaul Mar 31, 2025
10903cd
yml file updated for test server
liamsaul Mar 31, 2025
7bb4fe6
fixed yml
liamsaul Mar 31, 2025
1259231
checking workflow
liamsaul Mar 31, 2025
633110f
yml workflow
liamsaul Mar 31, 2025
cb2f0d3
test developer push to main workflow
liamsaul Mar 31, 2025
531dad3
Merge pull request #1 from liamsaul/developer
Bashir-Warsame Mar 31, 2025
fdbcede
CICD Pipeline
liamsaul Apr 1, 2025
eed47b2
fixed
liamsaul Apr 1, 2025
069052b
changed CD workflow
liamsaul Apr 1, 2025
785862f
fixed install_dependencies script
liamsaul Apr 1, 2025
58c343d
new dependency script
liamsaul Apr 1, 2025
05d1c97
updated yml
liamsaul Apr 1, 2025
33b9995
loop to wait for install
liamsaul Apr 1, 2025
fea5938
package lock update
liamsaul Apr 1, 2025
2042197
updated
liamsaul Apr 1, 2025
036863b
new package
liamsaul Apr 1, 2025
89da4ee
changes
liamsaul Apr 1, 2025
c5e5574
nvm version
liamsaul Apr 1, 2025
9b4dc3d
new
liamsaul Apr 1, 2025
5ad5a3a
everything without mongo db
liamsaul Apr 1, 2025
700c759
install dependencies fixed
liamsaul Apr 2, 2025
b338f31
test
liamsaul Apr 2, 2025
0daf81a
please work
liamsaul Apr 2, 2025
27b0dea
please
liamsaul Apr 2, 2025
a114e00
new start server script
liamsaul Apr 2, 2025
16eac57
changed
liamsaul Apr 2, 2025
4fedb31
please work
liamsaul Apr 2, 2025
f80e386
new files
liamsaul Apr 2, 2025
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
69 changes: 69 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CD

on:
push:
branches:
- main # Trigger on pushes to main

jobs:
build_and_upload:
name: Build and Upload Artifact to S3
runs-on: ubuntu-latest
outputs:
latest_artifact: ${{ steps.upload.outputs.artifact_name }} # Store the artifact name
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 23

- name: Install Dependencies
run: npm install

- name: Build and Package Artifact
id: package
run: |
VERSION=$(date +%Y%m%d%H%M%S)
ARTIFACT_NAME="app-${VERSION}.zip"
zip -r $ARTIFACT_NAME .
echo "Artifact created: $ARTIFACT_NAME"
echo "artifact_name=$ARTIFACT_NAME" >> $GITHUB_ENV

- name: Upload Artifact to S3
id: upload
run: |
aws s3 cp ${{ env.artifact_name }} s3://dreamteam-bucket/${{ env.artifact_name }}
echo "artifact_name=${{ env.artifact_name }}" >> $GITHUB_ENV
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: eu-west-2

deploy:
name: Deploy to EC2
runs-on: ubuntu-latest
needs: build_and_upload
steps:
- name: Set up AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-2

- name: Get Latest Artifact from S3
id: latest_artifact
run: |
LATEST_FILE=$(aws s3 ls s3://dreamteam-bucket/ --recursive | sort | tail -n 1 | awk '{print $4}')
echo "Latest artifact: $LATEST_FILE"
echo "artifact_name=$LATEST_FILE" >> $GITHUB_ENV

- name: Deploy to EC2 via CodeDeploy
run: |
aws deploy create-deployment \
--application-name dreamteam-deploy \
--deployment-group-name production-group \
--s3-location bucket=dreamteam-bucket,key=${{ env.artifact_name }},bundleType=zip
63 changes: 63 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CI

on: push

jobs:
setup:
name: Test Environment Setup
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 23
cache: 'npm'

- name: Install Dependencies
run: npm install

lint:
name: Run Linter
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 23
cache: 'npm'

- name: Install Dependencies
run: npm install


test:
name: Run Tests
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:8.0
ports:
- 27017:27017
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install Dependencies
run: npm install

- name: Start Server and Run Integration Tests
run: npx start-server-and-test "npm run start:test" http://localhost:3030 "npm run test:integration"


19 changes: 19 additions & 0 deletions appspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 0.0
os: linux
files:
- source: /
destination: /home/ec2-user/myapp/
permissions:
- object: /home/ec2-user/myapp/
owner: ec2-user
group: ec2-user
mode: 755
hooks:
BeforeInstall:
- location: scripts/install_dependencies.sh
timeout: 300
runas: root
ApplicationStart:
- location: scripts/start_server.sh
timeout: 300
runas: ec2-user
Loading