-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a398cf
commit fc721dc
Showing
7 changed files
with
80 additions
and
35 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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,24 @@ | ||
FROM debian:12-slim | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y wget apt-transport-https software-properties-common curl | ||
|
||
RUN curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc | ||
|
||
RUN wget https://packages.microsoft.com/config/debian/12/prod.list -O /etc/apt/sources.list.d/microsoft-prod.list | ||
|
||
RUN curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
dotnet-sdk-6.0 \ | ||
dotnet-sdk-7.0 \ | ||
dotnet-sdk-8.0 \ | ||
dotnet-sdk-9.0 | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN dotnet restore | ||
|
||
RUN dotnet build --configuration Release |
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,21 @@ | ||
DOCKER_IMAGE = smsapi-csharp-client-tests | ||
PROJECT_PATH = smsapiTests/smsapiTests.csproj | ||
DOTNET_VERSIONS = 6.0 7.0 8.0 9.0 | ||
|
||
.PHONY: build | ||
build: | ||
docker build -t $(DOCKER_IMAGE) -f Dockerfile ../ | ||
|
||
.PHONY: test | ||
test: | ||
@for version in $(DOTNET_VERSIONS); do \ | ||
echo "Running tests on .NET $$version"; \ | ||
docker run --rm \ | ||
-w /app \ | ||
$(DOCKER_IMAGE) \ | ||
dotnet test $(PROJECT_PATH) --configuration Release --no-build --framework net$$version; \ | ||
done | ||
|
||
.PHONY: clean | ||
clean: | ||
docker rmi -f $(DOCKER_IMAGE) |
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,32 @@ | ||
# Running Tests Locally with Makefile | ||
|
||
This project uses a `Makefile` to simplify the process of running tests locally. The `Makefile` defines the necessary commands to build the Docker image and run tests with multiple .NET versions. | ||
|
||
## Prerequisites | ||
|
||
Before running tests locally, ensure you have the following installed: | ||
|
||
- [Docker](https://www.docker.com/get-started): Docker is used to run the tests inside a container. | ||
- [Make](https://www.gnu.org/software/make/): Make is used to invoke commands defined in the `Makefile`. | ||
|
||
## Project Structure | ||
|
||
This project includes the following key files and directories: | ||
|
||
- `Makefile`: The file that defines the commands for building and testing the project. | ||
- `smsapiTests/`: The directory containing the test project (`smsapiTests.csproj`). | ||
- `Dockerfile`: The file that defines the Docker container used to run the tests. | ||
|
||
## Running Tests | ||
|
||
The tests are executed inside a Docker container, which ensures that the correct environment is used for all .NET versions specified. | ||
|
||
### 1. Build project | ||
```bash | ||
make build | ||
``` | ||
|
||
### 2. Run tests | ||
```bash | ||
make test | ||
``` |
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