Infrastructure pipeline creation

* Setting up test infrastructure pipeline

* Setting up test infrastructure pipeline v1

* Setting up test infrastructure pipeline v2

* Setting up test infrastructure pipeline v3

* Setting up test infrastructure pipeline v4

* Setting up test infrastructure pipeline v5

* Setting up test infrastructure pipeline v6
This commit is contained in:
Piasecki-grid 2025-03-28 09:34:02 +01:00 committed by GitHub
parent c217451296
commit 4760262059
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 136 additions and 64 deletions

View file

@ -1,32 +0,0 @@
name: Deploy and Test Cluster
on:
# push:
# branches: [main]
# paths:
# - 'k8s/**'
# pull_request:
# branches: [main]
# paths:
# - 'k8s/**'
workflow_dispatch:
jobs:
deploy-and-test-cluster:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1
- name: Deploy application
run: |
kubectl apply -f k8s/
- name: Wait for Pods to be ready
run: |
kubectl wait --for=condition=ready pod -l app=demo-db --timeout=180s
kubectl wait --for=condition=ready pod -l app=petclinic --timeout=180s

View file

@ -1,32 +0,0 @@
# This workflow will build a Java project with Gradle, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '17' ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v4
with:
java-version: ${{matrix.java}}
distribution: 'adopt'
cache: maven
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle
run: ./gradlew build

View file

@ -0,0 +1,77 @@
name: Pull request pipeline
on:
pull_request:
types:
- opened
branches:
- 'main'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '17' ]
steps:
- uses: actions/checkout@v4
name: Checkout code
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v4
with:
java-version: ${{matrix.java}}
distribution: 'temurin'
cache: maven
- name: Add executable permissions
run: chmod a+x mvnw
- name: Maven install dependencies
run: ./mvnw clean package
- name: Upload JAR artifact
uses: actions/upload-artifact@v4
with:
name: grid-capstone
path: ./target/*.jar
test:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '17' ]
steps:
- uses: actions/checkout@v4
name: Checkout code
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v4
with:
java-version: ${{matrix.java}}
distribution: 'temurin'
cache: maven
- name: Add executable permissions
run: chmod a+x mvnw
- name: Run tests
run: ./mvnw test
- name: Generate HTML report
run: ./mvnw surefire-report:report
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: test-reports
path: target/site/

View file

@ -0,0 +1,59 @@
name: Setup cloud infrastructure
on:
workflow_dispatch:
push:
branches:
- 'feature-branch'
jobs:
infrastructure:
runs-on: ubuntu-latest
steps:
- uses: azure/login@v2
name: Azure Login
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setting up terraform
uses: hashicorp/setup-terraform@v3
- name: Setup git configuration
run: |
git config --global user.name 'Kacper Piasecki'
git config --global user.email 'k.r.piasecki2@gmail.com'
- name: Clone git repository of infrastructure
run: |
rm -Rf .git
mkdir cicd
cd cicd
git clone https://x-access-token:${{ secrets.INFRA_GITHUB_TOKEN }}@github.com/Piasecki-grid/grid-capstone-terraform-infra.git
- name: Terraform Init
run: |
cd cicd/grid-capstone-terraform-infra
terraform init
- name: Terraform Format & Validate
run: |
cd cicd/grid-capstone-terraform-infra
terraform fmt -check
terraform validate
- name: Terraform Apply
run: |
cd cicd/grid-capstone-terraform-infra
terraform apply --auto-approve