codecov #77
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: Build and Test | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
- feature/* | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Docker Compose | |
run: | | |
sudo curl -L "https://github.com/docker/compose/releases/download/v2.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
- name: Start MySQL with Docker Compose | |
run: docker-compose up -d | |
- name: Wait for MySQL to initialize | |
run: | | |
timeout 60s bash -c ' | |
CONTAINER_ID=$(docker ps -qf "name=mysql-container") | |
until docker exec $CONTAINER_ID mysqladmin ping -uroot -prootpassword --silent; do | |
echo "Waiting for MySQL to be ready..." | |
sleep 5 | |
done | |
' | |
- name: Verify MySQL Initialization | |
run: | | |
docker exec mysql-container mysql -uroot -prootpassword -e "SHOW TABLES;" sampledb || echo "No tables found" | |
- name: MySQL Container Logs | |
if: failure() | |
run: docker-compose logs mysql | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Build skeletonBatch | |
run: | | |
cd skeletonBatch | |
../gradlew | |
- name: Build dbAndCsvBatch | |
run: | | |
cd dbAndCsvBatch | |
../gradlew | |
- name: Upload coverage to Codecov for skeletonBatch | |
uses: codecov/codecov-action@v4 | |
with: | |
files: skeletonBatch/build/reports/jacoco/test/jacocoTestReport.xml | |
- name: Upload coverage to Codecov for dbAndCsvBatch | |
uses: codecov/codecov-action@v4 | |
with: | |
files: dbAndCsvBatch/build/reports/jacoco/test/jacocoTestReport.xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./*/build/reports/jacoco/test/jacocoTestReport.xml | |
- name: Archive Test Reports | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-reports | |
path: build/reports/tests/test |