Skip to content

Commit

Permalink
chore: 테스트 workflow 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
mirageoasis committed Aug 21, 2024
1 parent 70d5f61 commit e4ab74b
Showing 1 changed file with 48 additions and 3 deletions.
51 changes: 48 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
name: unit test on push
name: test on push
on: [ pull_request ]

jobs:
deploy:
name: unit test
name: test
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0.32
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ticketing
options: >-
--health-cmd "mysqladmin ping -u root -proot"
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7.0.11
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: checkout
uses: actions/checkout@v3
Expand All @@ -18,7 +42,28 @@ jobs:
distribution: 'temurin'
java-version: '17'

- name: Set /etc/hosts for MySQL and Redis
run: |
echo "127.0.0.1 mysql" | sudo tee -a /etc/hosts
echo "127.0.0.1 redis" | sudo tee -a /etc/hosts
- name: Wait for MySQL to be ready
run: |
until mysqladmin ping -h mysql -u root -proot --silent; do
echo 'waiting for mysql...'
sleep 5
done
- name: Wait for Redis to be ready
run: |
until nc -zv redis 6379; do
echo 'waiting for redis...'
sleep 5
done
- name: Build with Gradle
run: |
chmod +x ./gradlew
./gradlew --info test
./gradlew copyYml
./gradlew test

0 comments on commit e4ab74b

Please sign in to comment.