-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Add] action to run integration tests
- Loading branch information
samatstarion
committed
Aug 16, 2024
1 parent
be63b28
commit e97c6c3
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |