Skip to content

🐳 fixing tests

🐳 fixing tests #46

Workflow file for this run

name: Test
on: [push, pull_request]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build Docker image
run: docker build -t my-jupyter-app .
- name: Test Docker image
run: |
docker run -d --name test-container -p 8888:8888 my-jupyter-app
- name: Check Jupyter startup
run: |
max_attempts=10
attempt=1
while [ $attempt -le $max_attempts ]; do
if docker logs test-container 2>&1 | grep -zq "Jupyter Server 2.14.2 is running at"; then
echo "Jupyter started successfully"
exit 0
fi
echo "Attempt $attempt: Jupyter not started yet, waiting..."
sleep 5
attempt=$((attempt+1))
done
echo "Jupyter failed to start after $max_attempts attempts"
echo "Full container logs:"
docker logs test-container
exit 1
- name: Stop Docker container
if: always()
run: docker stop test-container
docker-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Build Docker image
run: docker build -t my-jupyter-app-windows -f Dockerfile.windows .
- name: Test Docker image
run: |
docker run -d --name test-container-windows -p 8888:8888 my-jupyter-app-windows
- name: Check Jupyter startup
shell: pwsh
run: |
$maxAttempts = 10
$attempt = 1
while ($attempt -le $maxAttempts) {
$logs = docker logs test-container-windows 2>&1
if ($logs -match "Jupyter Server .* is running at") {
Write-Host "Jupyter started successfully"
exit 0
}
Write-Host "Attempt ${attempt}: Jupyter not started yet, waiting..."
Start-Sleep -Seconds 5
$attempt++
}
Write-Host "Jupyter failed to start after ${maxAttempts} attempts"
Write-Host "Full container logs:"
docker logs test-container-windows
exit 1
- name: Stop Docker container
if: always()
run: docker stop test-container-windows
docker-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Set up Docker
run: |
brew install docker
brew install colima
colima start || colima stop && colima start
sudo ln -sf $HOME/.colima/docker.sock /var/run/docker.sock
- name: Build Docker image
run: docker build -t my-jupyter-app-macos .
- name: Test Docker image
run: |
docker run -d --name test-container-macos -p 8888:8888 my-jupyter-app-macos
- name: Check Jupyter startup
run: |
max_attempts=10
attempt=1
while [ $attempt -le $max_attempts ]; do
if docker logs test-container-macos 2>&1 | grep -q "Jupyter Server .* is running at"; then
echo "Jupyter started successfully"
exit 0
fi
echo "Attempt $attempt: Jupyter not started yet, waiting..."
sleep 5
attempt=$((attempt+1))
done
echo "Jupyter failed to start after $max_attempts attempts"
echo "Full container logs:"
docker logs test-container-macos
exit 1
- name: Stop Docker container
if: always()
run: docker stop test-container-macos