Skip to content

Commit

Permalink
remove container startup from workflow files
Browse files Browse the repository at this point in the history
  • Loading branch information
pascal-fischer committed Jan 19, 2025
1 parent 3c820a2 commit 46ff4f4
Showing 1 changed file with 3 additions and 150 deletions.
153 changes: 3 additions & 150 deletions .github/workflows/golang-test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,61 +258,12 @@ jobs:
if: matrix.store == 'mysql'
run: docker pull mlsmaycon/warmed-mysql:8

- name: Start Postgres
if: matrix.store == 'postgres'
run: |
docker run -d \
-e POSTGRES_USER=root \
-e POSTGRES_PASSWORD=netbird \
-e POSTGRES_DB=netbird \
-p 5432:5432 \
--name my-postgres \
postgres:15-alpine
- name: Wait for Postgres
if: matrix.store == 'postgres'
run: |
for i in {1..10}; do
if nc -z localhost 5432; then
break
fi
echo "Waiting for Postgres..."
sleep 3
done
- name: Start MySQL
if: matrix.store == 'mysql'
run: |
docker run -d \
-p 3306:3306 \
--name my-mysql \
mlsmaycon/warmed-mysql:8
- name: Wait for MySQL
if: matrix.store == 'mysql'
run: |
for i in {1..10}; do
if nc -z localhost 3306; then
break
fi
echo "Waiting for MySQL..."
sleep 3
done
- name: Test
run: |
if [ "${{ matrix.store }}" = "postgres" ]; then
export NETBIRD_STORE_ENGINE_POSTGRES_DSN="postgres://root:netbird@localhost:5432/netbird?sslmode=disable"
fi
if [ "${{ matrix.store }}" = "mysql" ]; then
export NETBIRD_STORE_ENGINE_MYSQL_DSN="root:testing@tcp(localhost:3306)/testing"
fi
CGO_ENABLED=1 GOARCH=${{ matrix.arch }} \
NETBIRD_STORE_ENGINE=${{ matrix.store }} CI=true \
go test -tags devcert -run=^$ -bench=. \
-exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE,NETBIRD_STORE_ENGINE_POSTGRES_DSN,NETBIRD_STORE_ENGINE_MYSQL_DSN' \
-exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE' \
-timeout 10m ./...
api_benchmark:
Expand Down Expand Up @@ -372,61 +323,12 @@ jobs:
if: matrix.store == 'mysql'
run: docker pull mlsmaycon/warmed-mysql:8

- name: Start Postgres
if: matrix.store == 'postgres'
run: |
docker run -d \
-e POSTGRES_USER=root \
-e POSTGRES_PASSWORD=netbird \
-e POSTGRES_DB=netbird \
-p 5432:5432 \
--name my-postgres \
postgres:15-alpine
- name: Wait for Postgres
if: matrix.store == 'postgres'
run: |
for i in {1..10}; do
if nc -z localhost 5432; then
break
fi
echo "Waiting for Postgres..."
sleep 3
done
- name: Start MySQL
if: matrix.store == 'mysql'
run: |
docker run -d \
-p 3306:3306 \
--name my-mysql \
mlsmaycon/warmed-mysql:8
- name: Wait for MySQL
if: matrix.store == 'mysql'
run: |
for i in {1..10}; do
if nc -z localhost 3306; then
break
fi
echo "Waiting for MySQL..."
sleep 3
done
- name: Test
run: |
if [ "${{ matrix.store }}" = "postgres" ]; then
export NETBIRD_STORE_ENGINE_POSTGRES_DSN="postgres://root:netbird@localhost:5432/netbird?sslmode=disable"
fi
if [ "${{ matrix.store }}" = "mysql" ]; then
export NETBIRD_STORE_ENGINE_MYSQL_DSN="root:testing@tcp(localhost:3306)/testing"
fi
CGO_ENABLED=1 GOARCH=${{ matrix.arch }} \
NETBIRD_STORE_ENGINE=${{ matrix.store }} CI=true \
go test -tags=benchmark -run=^$ -bench=. \
-exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE,NETBIRD_STORE_ENGINE_POSTGRES_DSN,NETBIRD_STORE_ENGINE_MYSQL_DSN' \
-exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE' \
-timeout 10m $(go list ./... | grep /management)
api_integration_test:
Expand Down Expand Up @@ -475,61 +377,12 @@ jobs:
- name: check git status
run: git --no-pager diff --exit-code

- name: Start Postgres
if: matrix.store == 'postgres'
run: |
docker run -d \
-e POSTGRES_USER=root \
-e POSTGRES_PASSWORD=netbird \
-e POSTGRES_DB=netbird \
-p 5432:5432 \
--name my-postgres \
postgres:15-alpine
- name: Wait for Postgres
if: matrix.store == 'postgres'
run: |
for i in {1..10}; do
if nc -z localhost 5432; then
break
fi
echo "Waiting for Postgres..."
sleep 3
done
- name: Start MySQL
if: matrix.store == 'mysql'
run: |
docker run -d \
-p 3306:3306 \
--name my-mysql \
mlsmaycon/warmed-mysql:8
- name: Wait for MySQL
if: matrix.store == 'mysql'
run: |
for i in {1..10}; do
if nc -z localhost 3306; then
break
fi
echo "Waiting for MySQL..."
sleep 3
done
- name: Test
run: |
if [ "${{ matrix.store }}" = "postgres" ]; then
export NETBIRD_STORE_ENGINE_POSTGRES_DSN="postgres://root:netbird@localhost:5432/netbird?sslmode=disable"
fi
if [ "${{ matrix.store }}" = "mysql" ]; then
export NETBIRD_STORE_ENGINE_MYSQL_DSN="root:testing@tcp(localhost:3306)/testing"
fi
CGO_ENABLED=1 GOARCH=${{ matrix.arch }} \
NETBIRD_STORE_ENGINE=${{ matrix.store }} CI=true \
go test -p 1 \
-exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE,NETBIRD_STORE_ENGINE_POSTGRES_DSN,NETBIRD_STORE_ENGINE_MYSQL_DSN' \
-exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE' \
-timeout 10m -tags=integration $(go list ./... | grep /management)
test_client_on_docker:
Expand Down

0 comments on commit 46ff4f4

Please sign in to comment.