-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove integration tests project * Rename test files * Convert to tests dir * Remove scripts * Add root bin dir
- Loading branch information
1 parent
30e7c1e
commit 247f29b
Showing
83 changed files
with
185 additions
and
297 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 |
---|---|---|
@@ -1,12 +1,5 @@ | ||
* | ||
!run.sh | ||
!src/Exercism.Representers.FSharp | ||
src/Exercism.Representers.FSharp/bin | ||
src/Exercism.Representers.FSharp/obj | ||
.appends | ||
.git | ||
.github | ||
.gitignore | ||
.gitattributes | ||
.dockerignore | ||
Dockerfile | ||
!/bin/run.sh | ||
!/src/Exercism.Representers.FSharp | ||
/src/Exercism.Representers.FSharp/bin | ||
/src/Exercism.Representers.FSharp/obj |
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 |
---|---|---|
|
@@ -8,11 +8,27 @@ on: | |
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-18.04 | ||
build: | ||
name: Tests | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b | ||
- uses: actions/[email protected] | ||
- name: Checkout code | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 | ||
with: | ||
install: true | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 | ||
with: | ||
dotnet-version: "3.1.300" | ||
- run: pwsh ./test.ps1 | ||
context: . | ||
push: false | ||
load: true | ||
tags: exercism/fsharp-representer | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Run Tests in Docker | ||
run: bin/run-tests-in-docker.sh |
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 |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
.dotnet | ||
*.DotSettings.user | ||
representation.txt | ||
representation.json | ||
mapping.json | ||
bin/ | ||
obj/ | ||
!/bin |
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
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,45 @@ | ||
#!/usr/bin/env sh | ||
set -e | ||
|
||
# Synopsis: | ||
# Run the representer on a solution using the representer Docker image. | ||
# The representer Docker image is built automatically. | ||
|
||
# Arguments: | ||
# $1: exercise slug | ||
# $2: path to solution folder | ||
# $3: path to output directory | ||
|
||
# Output: | ||
# Writes the representation to a representation.txt and representation.json file | ||
# in the passed-in output directory. | ||
# The output files are formatted according to the specifications at https://github.com/exercism/docs/blob/main/building/tooling/representers/interface.md | ||
|
||
# Example: | ||
# ./bin/run-in-docker.sh two-fer path/to/solution/folder/ path/to/output/directory/ | ||
|
||
# If any required arguments is missing, print the usage and exit | ||
if [ "$#" -lt 3 ]; then | ||
echo "usage: ./bin/run-in-docker.sh exercise-slug path/to/solution/folder/ path/to/output/directory/" | ||
exit 1 | ||
fi | ||
|
||
slug="$1" | ||
solution_dir=$(realpath "${2%/}") | ||
output_dir=$(realpath "${3%/}") | ||
|
||
# Create the output directory if it doesn't exist | ||
mkdir -p "${output_dir}" | ||
|
||
# Build the Docker image | ||
docker build --rm -t exercism/csharp-representer . | ||
|
||
# Run the Docker image using the settings mimicking the production environment | ||
docker run \ | ||
--rm \ | ||
--network none \ | ||
--read-only \ | ||
--mount type=bind,src="${solution_dir}",dst=/solution \ | ||
--mount type=bind,src="${output_dir}",dst=/output \ | ||
--mount type=tmpfs,dst=/tmp \ | ||
exercism/csharp-representer "${slug}" /solution /output |
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,29 @@ | ||
#!/usr/bin/env sh | ||
set -e | ||
|
||
# Synopsis: | ||
# Test the representer Docker image by running it against a predefined set of | ||
# solutions with an expected output. | ||
# The representer Docker image is built automatically. | ||
|
||
# Output: | ||
# Outputs the diff of the expected representation files against the actual | ||
# representation files generated by the test runner Docker image. | ||
|
||
# Example: | ||
# ./bin/run-tests-in-docker.sh | ||
|
||
# Build the Docker image | ||
docker build --rm -t exercism/fsharp-representer . | ||
|
||
# Run the Docker image using the settings mimicking the production environment | ||
docker run \ | ||
--rm \ | ||
--network none \ | ||
--read-only \ | ||
--mount type=bind,src="${PWD}/tests",dst=/opt/representer/tests \ | ||
--mount type=tmpfs,dst=/tmp \ | ||
--volume "${PWD}/bin/run-tests.sh:/opt/representer/bin/run-tests.sh" \ | ||
--workdir /opt/representer \ | ||
--entrypoint /opt/representer/bin/run-tests.sh \ | ||
exercism/fsharp-representer |
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,37 @@ | ||
#!/usr/bin/env sh | ||
|
||
# Synopsis: | ||
# Test the representer by running it against a predefined set of solutions | ||
# with an expected output. | ||
|
||
# Output: | ||
# Outputs the diff of the expected representation files against the | ||
# actual representation files generated by the test runner. | ||
|
||
# Example: | ||
# ./bin/run-tests.sh | ||
|
||
exit_code=0 | ||
filenames="representation.txt representation.json mapping.json" | ||
|
||
# Iterate over all test directories | ||
for test_dir in tests/*/*; do | ||
test_dir_name=$(basename "${test_dir}") | ||
test_dir_path=$(realpath "${test_dir}") | ||
|
||
bin/run.sh "${test_dir_name}" "${test_dir_path}" "${test_dir_path}" | ||
|
||
for filename in $filenames; do | ||
actual_filepath="${test_dir_path}/${filename}" | ||
expected_filepath="${test_dir_path}/expected_${filename}" | ||
|
||
echo "${test_dir_name}: comparing ${filename} to expected_${filename}" | ||
diff "${actual_filepath}" "${expected_filepath}" | ||
|
||
if [ $? -ne 0 ]; then | ||
exit_code=1 | ||
fi | ||
done | ||
done | ||
|
||
exit ${exit_code} |
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,26 @@ | ||
#!/usr/bin/env sh | ||
|
||
# Synopsis: | ||
# Run the representer on a solution. | ||
|
||
# Arguments: | ||
# $1: exercise slug | ||
# $2: path to solution folder | ||
# $3: path to output directory | ||
|
||
# Output: | ||
# Writes the representation to a representation.txt and representation.json file | ||
# in the passed-in output directory. | ||
# The output files are formatted according to the specifications at https://github.com/exercism/docs/blob/main/building/tooling/representers/interface.md | ||
|
||
# Example: | ||
# ./bin/run.sh two-fer path/to/solution/folder/ path/to/output/directory/ | ||
|
||
# If any required arguments is missing, print the usage and exit | ||
if [ "$#" -lt 3 ]; then | ||
echo "usage: ./bin/run.sh exercise-slug path/to/solution/folder/ path/to/output/directory/" | ||
exit 1 | ||
fi | ||
|
||
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true | ||
/opt/representer/Exercism.Representers.FSharp $1 $2 $3 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.