Skip to content

Commit

Permalink
test ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshod5 committed May 15, 2024
1 parent d4870d4 commit e038a26
Showing 1 changed file with 9 additions and 36 deletions.
45 changes: 9 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,20 @@
name: CI
on: [push, pull_request]
on: [ push, pull_request ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Run tests
run: |
pip install pytest
pytest
- name: Shutdown
run: |
docker-compose down
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
run: |
docker-compose --env-file dev/docker/.env.dev -f dev/docker/docker-compose.yml build
docker-compose --env-file dev/docker/.env.dev -f dev/docker/docker-compose.yml push
run-tests:
needs: build
runs-on: ubuntu-latest
steps:
- name: Pull Docker image from DockerHub
run: docker pull your-dockerhub-username/your-image-name:latest
- name: Run tests inside Docker container
run: |
docker run -d --name my-container your-dockerhub-username/your-image-name:latest
docker exec my-container pip install pytest
docker exec my-container pytest
- name: Shutdown container
run: docker stop my-container && docker rm my-container

0 comments on commit e038a26

Please sign in to comment.