Feat: freeFromCategory #228
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: spring_test | |
on: | |
pull_request: | |
branches: | |
- dev | |
- weekly/* | |
- Review | |
jobs: | |
build_and_test: # Added job ID here | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: make .env file | |
run: | | |
cd ./docker | |
cat <<EOF > .env | |
DB_PARAMS=? | |
DB_USERNAME=ci_tester | |
DB_PASSWORD=plz | |
DB_ROOT_PASSWORD=never_use_in_root | |
DB_HOST_PORT=3306 | |
DB_CONTAINER_PORT=3306 | |
DB_NAME=super_poo | |
DB_CONTAINER_NAME=super_poo_container | |
JWT_SECRET_KEY=top_secret_key_for_ci | |
SERVICE_KEY = test_key | |
REDIS_PORT = 1111 | |
REDIS_URL = jdbc:redis://aaa/superfoo:1111 | |
REDIS_HOST = yeah | |
REDIS_ID = hello | |
REDIS_PASSWORD = redis | |
SHOP_CLIENT_ID = whatthe | |
SHOP_CLIENT_SECRET = hotpotato | |
GPT_SECRET_KEY = last_secret_key | |
EOF | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'corretto' | |
java-version: '21' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-version: 8.10 | |
- name: Start Docker Compose and wait for database | |
run: | | |
chmod +x ./gradlew | |
cd ./docker | |
docker compose up -d | |
# Wait for database to be ready | |
echo "Waiting for database to be ready..." | |
timeout 60s bash -c 'until docker exec -i $(docker ps -q --filter "name=super_poo") mysqladmin ping -h "127.0.0.1" --silent; do sleep 1; done' | |
- name: Install dependencies | |
run: ./gradlew build -x test | |
- name: Run Tests | |
run: ./gradlew test | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@v3 | |
if: success() || failure() | |
with: | |
report_paths: '**/build/test-results/test/TEST-*.xml' | |
- name: Package the application | |
run: ./gradlew assemble | |
- name: Cleanup | |
if: always() | |
run: | | |
cd ./docker | |
docker compose down |