diff --git a/cases/cloneScenario.sh b/cases/cloneScenario.sh new file mode 100755 index 0000000..492fa94 --- /dev/null +++ b/cases/cloneScenario.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# https://stackoverflow.com/a/28776166 +(return 0 2>/dev/null) || (echo "This script should be sourced, not executed."; exit 1) + +set -exo pipefail + +# We're assuming that $PWD is the directory containing scenario.json. + +SCENARIO_REPO=$1 +SCENARIO_NAME=$(basename $PWD) +SOLUTION_DIR=../../solutions/$SCENARIO_NAME + +if ! test -d $SOLUTION_DIR; then + git clone --filter blob:none $SCENARIO_REPO $SOLUTION_DIR +fi + +cd $SOLUTION_DIR +git clean -fdx +git reset --hard HEAD + +if test -z "$SCENARIO_REF"; then + SCENARIO_REF=$(git rev-parse HEAD) + echo "##vso[task.setvariable variable=SCENARIO_REF]$SCENARIO_REF" +else + git fetch origin $SCENARIO_REF + git switch --detach FETCH_HEAD +fi diff --git a/cases/scenarios/mui-docs-1/scenario.json b/cases/scenarios/mui-docs-1/scenario.json new file mode 100644 index 0000000..d551942 --- /dev/null +++ b/cases/scenarios/mui-docs-1/scenario.json @@ -0,0 +1,13 @@ +{ + "name": "mui-docs-1", + "kind": "tsc", + "args": [ + "-p", + "${suiteDirectory}/mui-docs-1/docs", + "--outdir", + "${outDirectory}" + ], + "platforms": [ + "linux" + ] +} diff --git a/cases/scenarios/mui-docs-1/setup.sh b/cases/scenarios/mui-docs-1/setup.sh new file mode 100755 index 0000000..45e22dd --- /dev/null +++ b/cases/scenarios/mui-docs-1/setup.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -exo pipefail +cd "${0%/*}" + +export SCENARIO_REF=48a29227cb737c6f008a62f9c8c4c47aedd99c43 +source ../../cloneScenario.sh https://github.com/mui/material-ui.git + +pnpm install --ignore-scripts diff --git a/cases/scenarios/mui-docs/setup.sh b/cases/scenarios/mui-docs/setup.sh index 35aba05..ed180d9 100755 --- a/cases/scenarios/mui-docs/setup.sh +++ b/cases/scenarios/mui-docs/setup.sh @@ -1,17 +1,8 @@ #!/usr/bin/env bash set -exo pipefail - cd "${0%/*}" -SCENARIO_NAME=$(basename $PWD) -SOLUTION_DIR=../../solutions/$SCENARIO_NAME -if ! test -d $SOLUTION_DIR; then - git clone --filter blob:none https://github.com/mui/material-ui.git $SOLUTION_DIR -fi +source ../../cloneScenario.sh https://github.com/mui/material-ui.git -cd $SOLUTION_DIR -git clean -fdx -git reset --hard HEAD -git switch --detach 48a29227cb737c6f008a62f9c8c4c47aedd99c43 pnpm install --ignore-scripts diff --git a/cases/scenarios/self-build-src/setup.sh b/cases/scenarios/self-build-src/setup.sh index 9eb0c80..cfc0326 100755 --- a/cases/scenarios/self-build-src/setup.sh +++ b/cases/scenarios/self-build-src/setup.sh @@ -1,19 +1,10 @@ #!/usr/bin/env bash set -exo pipefail - cd "${0%/*}" -SCENARIO_NAME=$(basename $PWD) -SOLUTION_DIR=../../solutions/$SCENARIO_NAME -if ! test -d $SOLUTION_DIR; then - git clone --filter blob:none https://github.com/microsoft/TypeScript.git $SOLUTION_DIR -fi +export SCENARIO_REF=$TYPESCRIPT_COMMIT +source ../../cloneScenario.sh https://github.com/microsoft/TypeScript.git -cd $SOLUTION_DIR -git clean -fdx -git reset --hard HEAD -git fetch origin ${TYPESCRIPT_COMMIT} -git switch --detach FETCH_HEAD npm ci npx hereby generate-diagnostics diff --git a/cases/scenarios/self-compiler/setup.sh b/cases/scenarios/self-compiler/setup.sh index 9eb0c80..cfc0326 100755 --- a/cases/scenarios/self-compiler/setup.sh +++ b/cases/scenarios/self-compiler/setup.sh @@ -1,19 +1,10 @@ #!/usr/bin/env bash set -exo pipefail - cd "${0%/*}" -SCENARIO_NAME=$(basename $PWD) -SOLUTION_DIR=../../solutions/$SCENARIO_NAME -if ! test -d $SOLUTION_DIR; then - git clone --filter blob:none https://github.com/microsoft/TypeScript.git $SOLUTION_DIR -fi +export SCENARIO_REF=$TYPESCRIPT_COMMIT +source ../../cloneScenario.sh https://github.com/microsoft/TypeScript.git -cd $SOLUTION_DIR -git clean -fdx -git reset --hard HEAD -git fetch origin ${TYPESCRIPT_COMMIT} -git switch --detach FETCH_HEAD npm ci npx hereby generate-diagnostics diff --git a/cases/scenarios/vscode-1/scenario.json b/cases/scenarios/vscode-1/scenario.json new file mode 100644 index 0000000..17d4d0f --- /dev/null +++ b/cases/scenarios/vscode-1/scenario.json @@ -0,0 +1,13 @@ +{ + "name": "vscode-1", + "kind": "tsc", + "args": [ + "-p", + "${suiteDirectory}/vscode-1/src", + "--outdir", + "${outDirectory}" + ], + "platforms": [ + "linux" + ] +} diff --git a/cases/scenarios/vscode-1/setup.sh b/cases/scenarios/vscode-1/setup.sh new file mode 100755 index 0000000..86b01cf --- /dev/null +++ b/cases/scenarios/vscode-1/setup.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -exo pipefail +cd "${0%/*}" + +export SCENARIO_REF=f88bce8fe6a6d2ccd27cbd64bb26853cd8779afa +source ../../cloneScenario.sh https://github.com/microsoft/vscode.git + +COREPACK_ENABLE_STRICT=0 corepack yarn@1.22.21 install --ignore-scripts diff --git a/cases/scenarios/vscode/setup.sh b/cases/scenarios/vscode/setup.sh index 95ac8ed..0f5ca47 100755 --- a/cases/scenarios/vscode/setup.sh +++ b/cases/scenarios/vscode/setup.sh @@ -1,17 +1,8 @@ #!/usr/bin/env bash set -exo pipefail - cd "${0%/*}" -SCENARIO_NAME=$(basename $PWD) -SOLUTION_DIR=../../solutions/$SCENARIO_NAME -if ! test -d $SOLUTION_DIR; then - git clone --filter blob:none https://github.com/microsoft/vscode.git $SOLUTION_DIR -fi +source ../../cloneScenario.sh https://github.com/microsoft/vscode.git -cd $SOLUTION_DIR -git clean -fdx -git reset --hard HEAD -git switch --detach f88bce8fe6a6d2ccd27cbd64bb26853cd8779afa COREPACK_ENABLE_STRICT=0 corepack yarn@1.22.21 install --ignore-scripts diff --git a/cases/scenarios/webpack-1/scenario.json b/cases/scenarios/webpack-1/scenario.json new file mode 100644 index 0000000..6fd3715 --- /dev/null +++ b/cases/scenarios/webpack-1/scenario.json @@ -0,0 +1,13 @@ +{ + "name": "webpack-1", + "kind": "tsc", + "args": [ + "-p", + "${suiteDirectory}/webpack-1", + "--outdir", + "${outDirectory}" + ], + "platforms": [ + "linux" + ] +} diff --git a/cases/scenarios/webpack-1/setup.sh b/cases/scenarios/webpack-1/setup.sh new file mode 100755 index 0000000..fdbc8a3 --- /dev/null +++ b/cases/scenarios/webpack-1/setup.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -exo pipefail +cd "${0%/*}" + +export SCENARIO_REF=228fc69f40c3e9ec6d99a5105fdc85b5bca4ce43 +source ../../cloneScenario.sh https://github.com/webpack/webpack.git + +COREPACK_ENABLE_STRICT=0 corepack yarn@1.22.21 install --ignore-scripts + +# https://github.com/webpack/webpack/blob/228fc69f40c3e9ec6d99a5105fdc85b5bca4ce43/.github/workflows/test.yml#L135 +LINK_FOLDER=$PWD/node_modules/.yarn-link +COREPACK_ENABLE_STRICT=0 corepack yarn@1.22.21 link --link-folder $LINK_FOLDER +COREPACK_ENABLE_STRICT=0 corepack yarn@1.22.21 link --link-folder $LINK_FOLDER webpack diff --git a/cases/scenarios/webpack/setup.sh b/cases/scenarios/webpack/setup.sh index 987b9ba..73a63bd 100755 --- a/cases/scenarios/webpack/setup.sh +++ b/cases/scenarios/webpack/setup.sh @@ -1,19 +1,10 @@ #!/usr/bin/env bash set -exo pipefail - cd "${0%/*}" -SCENARIO_NAME=$(basename $PWD) -SOLUTION_DIR=../../solutions/$SCENARIO_NAME -if ! test -d $SOLUTION_DIR; then - git clone --filter blob:none https://github.com/webpack/webpack.git $SOLUTION_DIR -fi +source ../../cloneScenario.sh https://github.com/webpack/webpack.git -cd $SOLUTION_DIR -git clean -fdx -git reset --hard HEAD -git switch --detach 228fc69f40c3e9ec6d99a5105fdc85b5bca4ce43 COREPACK_ENABLE_STRICT=0 corepack yarn@1.22.21 install --ignore-scripts # https://github.com/webpack/webpack/blob/228fc69f40c3e9ec6d99a5105fdc85b5bca4ce43/.github/workflows/test.yml#L135 diff --git a/cases/solutions/.gitignore b/cases/solutions/.gitignore index 12798cc..95c20ba 100644 --- a/cases/solutions/.gitignore +++ b/cases/solutions/.gitignore @@ -1,5 +1,2 @@ -/vscode/ -/self-compiler/ -/self-build-src/ -/mui-docs/ -/webpack/ +# Ignore all directories; manually add new dirs as unignored if needed. +/*/