chore: code cleanup #248
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Tests | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker BuildX | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Set up Docker Compose | |
uses: hoverkraft-tech/[email protected] | |
with: | |
compose-file: "docker-compose-test.yml" | |
up-flags: "--build" | |
- name: Check Docker Containers | |
run: | | |
echo "🔍 Checking Docker Containers..." | |
docker compose -f "docker-compose-test.yml" ps | |
- name: Check Relay Service Logs | |
run: | | |
echo "🔍 Checking Relay Service Logs..." | |
sleep 30 && docker compose -f docker-compose-test.yml logs relay-service | |
# docker compose -f docker-compose-test.yml logs relay-service | grep "Actual listen addresses: " | |
- name: Running-Tests | |
run: | | |
echo "🧪 Running tests..." | |
docker compose -f docker-compose-test.yml exec relay-service npm test | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Tag Docker Image | |
run: | | |
echo "🔖 Tagging Docker Image..." | |
VERSION=$(node -p "require('./relay/package.json').version") | |
docker tag libp2p-relay-relay-service ${{ secrets.DOCKER_USERNAME }}/libp2p-relay-relay-service:v$VERSION | |
- name: Push Docker Image | |
run: | | |
echo "📤 Pushing Docker Image to Docker Hub..." | |
VERSION=$(node -p "require('./relay/package.json').version") | |
docker push ${{ secrets.DOCKER_USERNAME }}/libp2p-relay-relay-service:v$VERSION | |
- name: Build Docker Image | |
run: | | |
docker build -t libp2p-relay-relay-service:latest . |