Skip to content

Commit

Permalink
test-4
Browse files Browse the repository at this point in the history
  • Loading branch information
krrish-sehgal committed Dec 23, 2024
1 parent ff449c2 commit b1b38c0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
33 changes: 15 additions & 18 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,32 +154,29 @@ jobs:
run: poetry run xvfb-run --auto-servernum python manage.py test -v 3 --failfast

docker-test:
name: Run Tests (Docker)
needs: code-ql
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v3

- name: Set up Docker
run: |
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
# Add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# Set up the Docker stable repository
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Update apt package list and install Docker
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
docker --version
docker-compose --version
- name: Build Docker image
run: |
docker build -t my-docker-image .
docker build -t my-app .
- name: Run Docker container
run: |
docker run -d --name my-container my-app
- name: Run tests inside Docker container
run: |
docker exec my-container poetry run python manage.py test -v 3 --failfast
- name: Run tests inside Docker
- name: Clean up
run: |
docker run --rm my-docker-image poetry run python manage.py test -v 3 --failfast
docker stop my-container
docker rm my-container
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RUN apt-get update && \
COPY . /blt

# Convert line endings and set permissions
RUN dos2unix .env Dockerfile docker-compose.yml entrypoint.sh ./blt/settings.py
RUN dos2unix Dockerfile docker-compose.yml entrypoint.sh ./blt/settings.py
RUN chmod +x /blt/entrypoint.sh

ENTRYPOINT ["/blt/entrypoint.sh"]
Expand Down

0 comments on commit b1b38c0

Please sign in to comment.