feat(ci): Add GitHub Actions workflows for test automation and status badges

Add comprehensive test automation setup with GitHub Actions:
- Create test.yml for running tests on main/develop branches
- Add pr-test.yml for PR validation with test results comments
- Add update-badges.yml for dynamic test status badge updates
- Configure code coverage reporting with Codecov integration

Documentation:
- Add BADGE_SETUP.md with instructions for configuring test status badges
- Add WORKFLOWS_GUIDE.md explaining CI/CD workflow setup
- Update README.md with build and test status badges

Test Framework:
- Configure test project to use .NET 9.0
- Set up test coverage reporting with coverlet
- Add integration tests with WireMock for API mocking
- Add unit tests for configuration and HTTP client components
- Document testing strategy in TestingStrategy.md

Build:
- Add Dockerfile.test for containerized testing
- Update .gitignore for test artifacts
- Configure test dependencies in VRCAuthProxy.Tests.csproj

This change enables automated testing on PRs and branches, with visual status indicators and detailed test results in PR comments.
This commit is contained in:
MiscFrizzy 2025-04-07 06:30:31 -04:00
parent 23b5a504b5
commit 319f1071bf
18 changed files with 939 additions and 12 deletions

View file

@ -1,6 +1,9 @@
# VRCAuthProxy
#### A VRChat API Authorization Proxy Service
[![Build](https://github.com/PrideVRInc/VRCAuthProxy/actions/workflows/build.yml/badge.svg)](https://github.com/PrideVRInc/VRCAuthProxy/actions/workflows/build.yml)
[![Tests](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/USER_PLACEHOLDER/GIST_ID_PLACEHOLDER/raw/vrcauthproxy-tests.json)](https://github.com/PrideVRInc/VRCAuthProxy/actions/workflows/test.yml)
This authorization proxy service is for consuming the VRChat API in a multi-application / microservice architecture. Configure the proxy with the credentials for accounts you use to make API calls and direct your API clients to the proxy service instead of the VRChat API. The proxy server will handle the authorization call flow and caching of the authorization tokens for subsequent authorized calls.
## Build Steps
@ -49,6 +52,72 @@ services:
timeout: 10s
```
## Testing
This section provides instructions on how to run the unit and integration tests for the VRCAuthProxy project.
### Running Tests Locally
To run the tests locally, ensure you have the .NET SDK installed. You can execute the tests using the following command:
```bash
dotnet test
```
For code coverage reports, you can use:
```bash
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info
```
### Running Tests in a Docker Container
To run the tests in a Docker container, follow these steps:
1. **Build the Docker Image**: Ensure you have the Dockerfile set up correctly in your project root. Build the Docker image using the following command:
```bash
docker build -t vrcauthproxy-test -f Dockerfile.test .
```
2. **Run the Tests**: Execute the tests inside the Docker container with the following command:
```bash
docker run --rm vrcauthproxy-test dotnet test
```
This command will run the tests in the container and output the results to your terminal.
### Creating a Dockerfile.test
You can create a dedicated Dockerfile for testing:
```dockerfile
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /app
# Copy csproj and restore dependencies
COPY *.sln ./
COPY VRCAuthProxy/*.csproj ./VRCAuthProxy/
COPY Tests/*.csproj ./Tests/
RUN dotnet restore
# Copy the remaining files
COPY . ./
# Run tests
ENTRYPOINT ["dotnet", "test", "--logger:console"]
```
### Continuous Integration
The test suite is designed to be run in CI/CD pipelines. Include the following in your GitHub workflow:
```yaml
- name: Test
run: dotnet test --no-restore --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info
```
## LICENSE
MPL-2.0 with Addendum