diff --git a/.github/workflows/check-standard.yaml b/.github/workflows/check-standard.yaml index 4d28972..6ad44e8 100644 --- a/.github/workflows/check-standard.yaml +++ b/.github/workflows/check-standard.yaml @@ -47,35 +47,10 @@ jobs: extra-packages: any::rcmdcheck needs: check - # Install Docker Compose on Ubuntu - - name: Install Docker Compose on Ubuntu + # Install docker-compose and set up presto/trino servers + - name: Setup Presto and Trino servers if: matrix.config.os == 'ubuntu-latest' - run: | - sudo apt-get update - sudo apt-get install -y docker-compose - - # Start Docker Compose services - - name: Start services with Docker Compose - if: matrix.config.os == 'ubuntu-latest' - run: | - docker-compose up -d - - # Ensure Presto and Trino servers are running - - name: Wait for Presto and Trino to be ready - if: matrix.config.os == 'ubuntu-latest' - run: | - for i in {1..30}; do - if curl -s http://localhost:8080/v1/info && curl -s http://localhost:8090/v1/info; then - echo "Presto and Trino are up and running." - break - fi - echo "Waiting for Presto and Trino to be ready..." - sleep 5 - done - if ! curl -s http://localhost:8080/v1/info || ! curl -s http://localhost:8090/v1/info; then - echo "Presto or Trino did not start in time. Exiting." - exit 1 - fi + uses: ./.github/workflows/setup-presto-trino-servers.yaml - uses: r-lib/actions/check-r-package@v2 with: diff --git a/.github/workflows/setup-presto-trino-servers.yaml b/.github/workflows/setup-presto-trino-servers.yaml new file mode 100644 index 0000000..26d8c28 --- /dev/null +++ b/.github/workflows/setup-presto-trino-servers.yaml @@ -0,0 +1,35 @@ +name: Set up Presto and Trino servers + +on: + workflow_call: + +jobs: + setup-presto-trino-servers: + runs-on: ubuntu-latest + steps: + # Install Docker Compose on Ubuntu + - name: Install Docker Compose on Ubuntu + run: | + sudo apt-get update + sudo apt-get install -y docker-compose + + # Start Docker Compose services + - name: Start services with Docker Compose + run: | + docker-compose up -d + + # Ensure Presto and Trino servers are running + - name: Wait for Presto and Trino to be ready + run: | + for i in {1..30}; do + if curl -s http://localhost:8080/v1/info && curl -s http://localhost:8090/v1/info; then + echo "Presto and Trino are up and running." + break + fi + echo "Waiting for Presto and Trino to be ready..." + sleep 5 + done + if ! curl -s http://localhost:8080/v1/info || ! curl -s http://localhost:8090/v1/info; then + echo "Presto or Trino did not start in time. Exiting." + exit 1 + fi diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 4b65418..c59ae28 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -26,6 +26,16 @@ jobs: extra-packages: any::covr needs: coverage + # Install docker-compose and set up presto/trino servers + - name: Setup Presto and Trino servers + uses: ./.github/workflows/setup-presto-trino-servers.yaml + - name: Test coverage run: covr::codecov(quiet = FALSE) shell: Rscript {0} + + # Stop and remove Docker containers + - name: Stop and remove Docker containers + run: | + docker stop $(docker ps -q) || true + docker rm $(docker ps -aq) || true