Skip to content

Commit

Permalink
Add a docker-compose file to set up presto and trino servers for unit…
Browse files Browse the repository at this point in the history
… testing and use those servers in github action
  • Loading branch information
jarodmeng committed Jan 3, 2025
1 parent 0009cc1 commit ad26c95
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/check-standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch: {}

name: R-CMD-check

Expand All @@ -27,6 +28,8 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
PRESTO_VERSION: "${{ matrix.config.presto_version || 'latest' }}"
TRINO_VERSION: "${{ matrix.config.trino_version || 'latest' }}"

steps:
- uses: actions/checkout@v2
Expand All @@ -44,6 +47,36 @@ jobs:
extra-packages: any::rcmdcheck
needs: check

# Install Docker and Docker Compose on macOS
- name: Install Docker on macOS
if: matrix.config.os == 'macOS-latest'
run: |
brew install --cask docker
brew install docker-compose
# Start Docker Compose services
- name: Start services with Docker Compose
if: matrix.config.os == 'ubuntu-latest' || matrix.config.os == 'macOS-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' || matrix.config.os == 'macOS-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: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
services:
presto:
image: prestodb/presto:${PRESTO_VERSION:-latest}
container_name: presto
ports:
- "8080:8080"
volumes:
- ./prestodb_presto/etc:/opt/presto-server/etc
restart: unless-stopped

trino:
image: trinodb/trino:${TRINO_VERSION:-latest}
container_name: trino
ports:
- "8090:8080"
volumes:
- ./trinodb_trino/etc:/usr/lib/trino/etc
restart: unless-stopped

0 comments on commit ad26c95

Please sign in to comment.