Skip to content

Commit

Permalink
parallel tests (#601)
Browse files Browse the repository at this point in the history
* parallel tests

* try with single build

* fix workflow

* checkout with lfs
  • Loading branch information
frostbyte73 authored Jan 31, 2024
1 parent fda24b8 commit c5eab0a
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 11 deletions.
55 changes: 48 additions & 7 deletions .github/workflows/test-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ on:
- go.mod

jobs:
integration:
build:
runs-on: buildjet-8vcpu-ubuntu-2204
outputs:
image: ${{ steps.docker-md.outputs.tags }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -51,25 +53,64 @@ jobs:
path: |
~/go/pkg/mod
~/go/bin
~/bin/protoc
~/.cache
key: egress
key: egress-integration-${{ hashFiles('**/go.sum') }}
restore-keys: egress-integration

- name: Docker metadata
id: docker-md
uses: docker/metadata-action@v5
with:
images: livekit/egress-integration
tags: |
type=sha
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.6

- name: Download Go modules
run: go mod download

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./build/test/Dockerfile
push: true
platforms: linux/amd64
tags: ${{ steps.docker-md.outputs.tags }}
labels: ${{ steps.docker-md.outputs.labels }}

test:
needs: build
strategy:
matrix:
integration_type: [room, web, participant, track_composite, track]
runs-on: buildjet-8vcpu-ubuntu-2204
steps:
- uses: shogo82148/actions-setup-redis@v1
with:
redis-version: '6.x'
auto-start: true
- run: redis-cli ping

- name: Build docker image
run: docker build -t egress-test -f ./build/test/Dockerfile .

- name: Run tests
env:
IMAGE: ${{needs.build.outputs.image}}
run: |
docker run --rm \
--network host \
-e GITHUB_WORKFLOW=1 \
-e EGRESS_CONFIG_STRING="$(echo ${{ secrets.EGRESS_CONFIG_STRING }} | base64 -d)" \
-e INTEGRATION_TYPE="${{ matrix.integration_type }}" \
-e S3_UPLOAD="$(echo ${{ secrets.S3_UPLOAD }} | base64 -d)" \
-e GCP_UPLOAD="$(echo ${{ secrets.GCP_UPLOAD }} | base64 -d)" \
egress-test
${{ env.IMAGE }}
28 changes: 24 additions & 4 deletions test/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,35 @@ func NewRunner(t *testing.T) *Runner {
confString = string(b)
}

r := &Runner{
RoomName: fmt.Sprintf("egress-integration-%d", rand.Intn(100)),
Muting: false,
}
r := &Runner{}
err := yaml.Unmarshal([]byte(confString), r)
require.NoError(t, err)

switch os.Getenv("INTEGRATION_TYPE") {
case "room":
r.RoomTestsOnly = true
r.RoomName = fmt.Sprintf("room-integration-%d", rand.Intn(100))
case "web":
r.WebTestsOnly = true
r.RoomName = fmt.Sprintf("web-integration-%d", rand.Intn(100))
case "participant":
r.ParticipantTestsOnly = true
r.RoomName = fmt.Sprintf("participant-integration-%d", rand.Intn(100))
case "track_composite":
r.TrackCompositeTestsOnly = true
r.RoomName = fmt.Sprintf("track-composite-integration-%d", rand.Intn(100))
case "track":
r.TrackTestsOnly = true
r.RoomName = fmt.Sprintf("track-integration-%d", rand.Intn(100))
default:
if r.RoomName == "" {
r.RoomName = fmt.Sprintf("egress-integration-%d", rand.Intn(100))
}
}

conf, err := config.NewServiceConfig(confString)
require.NoError(t, err)

r.ServiceConfig = conf

if conf.ApiKey == "" || conf.ApiSecret == "" || conf.WsUrl == "" {
Expand Down

0 comments on commit c5eab0a

Please sign in to comment.