diff --git a/.github/workflows/BatchTest.yml b/.github/workflows/BatchTest.yml new file mode 100644 index 0000000..99427d4 --- /dev/null +++ b/.github/workflows/BatchTest.yml @@ -0,0 +1,36 @@ +name: BatchTest + +on: + pull_request: + branches: [masterTests] + push: + branches: [masterTests] + +env: + # Path to the solution file relative to the root of the project. + BATCH_FILE: UnitTest/MyBatchFile.bat + +jobs: + test: + runs-on: windows-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Run Batch File + shell: cmd + run: | + call %BATCH_FILE% + timeout /t 5 /nobreak > nul + if exist result.txt ( + powershell -Command "if ((Get-Content result.txt).Trim() -eq 'True') { exit 0 } else { exit 1 }" + if %errorlevel%==0 ( + echo Test passed. + ) else ( + echo Test failed. + exit 1 + ) + ) else ( + echo Result file not found. + exit 1 + ) diff --git a/.github/workflows/PRCheck.yml b/.github/workflows/PRCheck.yml new file mode 100644 index 0000000..0720132 --- /dev/null +++ b/.github/workflows/PRCheck.yml @@ -0,0 +1,32 @@ +name: PR Format Check + +on: + pull_request: + types: [opened, edited] + branches: [masterTests] + + +jobs: + check-pr-format: + runs-on: ubuntu-latest + + steps: + - name: Check out the repository + uses: actions/checkout@v2 + + - name: Validate PR title and description + run: | + if [[ ! "${{ github.event.pull_request.title }}" =~ ^INVA- ]]; then + echo "Error: PR title must start with 'INVA-'." + exit 1 + fi + + if [[ -z "${{ github.event.pull_request.body }}" ]]; then + echo "Error: PR description must not be empty." + exit 1 + fi + + if [[ ! "${{ github.event.pull_request.head.ref }}" =~ INVA ]]; then + echo "Error: Branch name must include 'INVA'." + exit 1 + fi \ No newline at end of file diff --git a/UnitTest/MyBatchFile.bat b/UnitTest/MyBatchFile.bat new file mode 100644 index 0000000..25b45c9 --- /dev/null +++ b/UnitTest/MyBatchFile.bat @@ -0,0 +1,4 @@ +@echo on +echo "writing to file" +echo True > result.txt +