Skip to content

Commit

Permalink
feat(workflows): add setup-docker-and-run-tests.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
basarbyz committed Jul 25, 2024
1 parent 37474ad commit f037ae0
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion .github/workflows/setup-docker-and-run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,48 @@ jobs:
sleep 5
done
- name: Get Docker container IP
id: get-ip
run: |
CONTAINER_ID = $(docker ps -q --filter "name=mqtt_gateway_api")
CONTAINER_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $CONTAINER_ID)
echo "CONTAINER_IP=$CONTAINER_IP" >> $GITHUB_ENV
- name: Save IP address
run: echo $CONTAINER_IP > container_ip.txt

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: container-ip
path: container_ip.txt

run-tests:
name: Run Tests
runs-on: ubuntu-latest
needs: setup-and-start-services

steps:
- name: Checkout code
uses: actions/checkout@4
uses: actions/checkout@v4

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: container-ip
path: .

- name: Read IP address
id: read-ip
run: |
CONTAINER_IP=$(cat container_ip.txt)
echo "CONTAINER_IP=$CONTAINER_IP" >> $GITHUB_ENV
- name: Create .env File
run: |
cd tests
cp .env.test.example .env
- name: Run tests
run: |
Expand Down

0 comments on commit f037ae0

Please sign in to comment.