mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 12:15:50 +00:00
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:
parent
c217451296
commit
4760262059
4 changed files with 136 additions and 64 deletions
32
.github/workflows/deploy-and-test-cluster.yml
vendored
32
.github/workflows/deploy-and-test-cluster.yml
vendored
|
@ -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
|
||||
|
32
.github/workflows/gradle-build.yml
vendored
32
.github/workflows/gradle-build.yml
vendored
|
@ -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
|
77
.github/workflows/pull-request-pipeline.yml
vendored
Normal file
77
.github/workflows/pull-request-pipeline.yml
vendored
Normal 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/
|
||||
|
||||
|
||||
|
||||
|
59
.github/workflows/setup-infra-pipeline.yml
vendored
Normal file
59
.github/workflows/setup-infra-pipeline.yml
vendored
Normal 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
|
||||
|
||||
|
||||
|
Loading…
Reference in a new issue