diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml new file mode 100644 index 00000000..18b52f6e --- /dev/null +++ b/.github/workflows/integration-tests.yml @@ -0,0 +1,78 @@ +name: Run Integration Tests and Post Results + +on: + push: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker + uses: docker/setup-buildx-action@v3 + + - name: cdp4-test-database-community-edition Image + run: docker pull stariongroup/cdp4-test-database-community-edition:3.4.0 + + - name: Start PostgreSQL Container + run: | + docker run -it -d \ + -e POSTGRES_PASSWORD=postgres \ + -p 5432:5432 \ + --tmpfs /var/lib/postgresql/data:rw \ + --name comet-db \ + stariongroup/cdp4-test-database-community-edition:3.4.0 + + - name: Wait for PostgreSQL to be ready + run: | + until docker exec comet-db pg_isready -U postgres; do + echo "Waiting for PostgreSQL to be ready..." + sleep 5 + done + + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: add Starion GitHub nuget feed + run: dotnet nuget add source https://nuget.pkg.github.com/STARIONGROUP/index.json -n GHRHEA -u gh -p ${{ secrets.GH_PR_TOKEN }} --store-password-in-clear-text + + - name: Restore dependencies + run: dotnet restore COMET-WebServices.sln + + - name: Build COMET-WebServices + run: dotnet build COMET-WebServices.sln -c Release + + - name: Start API + run: dotnet run dotnet run --project CometServer/CometServer.csproj -c Release & + + - name: Wait for API to start + run: sleep 10 # Adjust as necessary to ensure the API is up + + - name: Checkout Integration Test Suite + uses: actions/checkout@v4 + with: + repository: STARIONGROUP/ecss-10-25-annexc-integration-tests + path: integration-tests + + - name: Zip Integration Test Results + run: | + cd integration-tests/Data + zip -r Data.zip . + + - name: Post Zipped Results to REST API + run: | + curl --form file=@"integration-tests/Data/Data.zip" http://localhost:5000/Data/Exchange + + - name: Restore Dependencies for Integration Tests + run: dotnet restore integration-tests/IntegrationTestSuite/WebservicesIntegrationTests.sln + + - name: Run Integration Tests + run: dotnet test integration-tests/IntegrationTestSuite/WebservicesIntegrationTests.sln --logger "trx;LogFileName=test_results.trx" --verbosity detailed + + - name: Stop PostgreSQL Container + run: docker stop comet-db && docker rm comet-db