Skip to content

mul-ci

mul-ci #13

Workflow file for this run

name: Java CI with Gradle V0.1
on:
pull_request_target:
types: [opened, reopened, synchronize, labeled]
permissions:
contents: read
jobs:
build:
if: |
(github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize') &&
contains(github.event.pull_request.labels.*.name, 'CI') &&
github.event.pull_request.base.ref == 'main'
runs-on: ubuntu-latest
services:
redis:
image: redis:latest
ports:
- 6379:6379
# mysql:
# image: mysql:8
# env:
# MYSQL_ROOT_PASSWORD: root_password
# MYSQL_DATABASE: testdb
# MYSQL_USER: test_user
# MYSQL_PASSWORD: test_password
# ports:
# - "3306:3306"
# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
- name: Set test yml
uses: microsoft/variable-substitution@v1
with:
files: ./src/test/resources/application.yml
env:
spring.security.jwt.secret: ${{ secrets.JWT_SECRET_KEY }}
spring.data.mongodb.uri: ${{ secrets.MONGO_TEST_URI }}
custom.domain.image.baseUrl: ${{ secrets.BASE_URL }}
cloud.aws.s3.bucket: ${{ secrets.S3_BUCKET_NAME }}
cloud.aws.region.static: ${{ secrets.S3_REGION }}
cloud.aws.credentials.accessKey: ${{ secrets.AWS_ACCESS_KEY }}
cloud.aws.credentials.secretKey: ${{ secrets.AWS_ACCESS_SECRET }}
- name: Set up admin-api test application.yml
uses: microsoft/variable-substitution@v1
with:
files: ./admin-api/src/test/resources/application.yml
env:
spring.security.jwt.secret: ${{ secrets.JWT_SECRET_KEY }}
spring.data.mongodb.uri: ${{ secrets.MONGO_TEST_URI }}
custom.domain.image.baseUrl: ${{ secrets.BASE_URL }}
cloud.aws.s3.bucket: ${{ secrets.S3_BUCKET_NAME }}
cloud.aws.region.static: ${{ secrets.S3_REGION }}
cloud.aws.credentials.accessKey: ${{ secrets.AWS_ACCESS_KEY }}
cloud.aws.credentials.secretKey: ${{ secrets.AWS_ACCESS_SECRET }}
- name: Set up domain-mongodb test application.yml
uses: microsoft/variable-substitution@v1
with:
files: ./domain-mongodb/src/test/resources/application.yml
env:
spring.data.mongodb.uri: ${{ secrets.MONGO_TEST_URI }}
- name: Set up domain-mysql test application.yml
uses: microsoft/variable-substitution@v1
with:
files: ./domain-mysql/src/test/resources/application.yml
env:
spring.security.jwt.secret: ${{ secrets.JWT_SECRET_KEY }}
- name: Set up member-api test application.yml
uses: microsoft/variable-substitution@v1
with:
files: ./member-api/src/test/resources/application.yml
env:
# TEST_DB_URL: jdbc:mysql://localhost:3306/testdb
# TEST_DB_HOST: test_user
# TEST_DB_PASSWORD: test_password
TEST_DB_URL: ${{ secrets.TEST_DB_URL }}
TEST_DB_HOST: ${{ secrets.TEST_DB_HOST }}
TEST_DB_PASSWORD: ${{ secrets.TEST_DB_PASSWORD }}
# spring.datasource.url: ${{ secrets.TEST_DB_URL }}
# spring.datasource.username: ${{ secrets.TEST_DB_HOST }}
# spring.datasource.password: ${{ secrets.TEST_DB_PASSWORD }}
spring.security.jwt.secret: ${{ secrets.JWT_SECRET_KEY }}
spring.data.mongodb.uri: ${{ secrets.MONGO_TEST_URI }}
custom.domain.image.baseUrl: ${{ secrets.BASE_URL }}
cloud.aws.s3.bucket: ${{ secrets.S3_BUCKET_NAME }}
cloud.aws.region.static: ${{ secrets.S3_REGION }}
cloud.aws.credentials.accessKey: ${{ secrets.AWS_ACCESS_KEY }}
cloud.aws.credentials.secretKey: ${{ secrets.AWS_ACCESS_SECRET }}
- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew
- name: Docker Compose For Test
run: |
touch docker-compose.yml
echo "${{ secrets.CI_DOCKER_COMPOSE }}" > docker-compose.yml
echo docker-compose.yml
docker-compose up -d
docker ps
- name: Test with Gradle
run: ./gradlew test