From de6591e8661b1315d9ca10eb3c2b222439f9bdfe Mon Sep 17 00:00:00 2001 From: Stanislav Pankevich Date: Sat, 11 Apr 2020 15:39:08 +0200 Subject: [PATCH] CI: GitHub Actions on Windows setup Closes #112 --- .github/workflows/ci-windows.yml | 66 ++++++++++++++++++++++++++++++++ tasks.py | 6 +-- tests/integration/lit.cfg | 3 +- 3 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci-windows.yml diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml new file mode 100644 index 0000000..7aa47c6 --- /dev/null +++ b/.github/workflows/ci-windows.yml @@ -0,0 +1,66 @@ +name: "FileCheck.py on Windows" + +on: [pull_request] + +jobs: + build: + runs-on: windows-latest + + strategy: + matrix: + python-version: [3.5, 3.6, 3.7, 3.8] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Upgrade pip + run: | + python -m pip install --upgrade pip + + - name: Install Poetry + run: | + (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python + + - name: "Poetry: add to %PATH%" + run: | + echo "::add-path::$env:USERPROFILE\.poetry\bin" + + - name: "Print PATH" + run: | + echo $env:USERPROFILE + echo $env:PATH + + - name: "Print PWD" + run: | + echo "$PWD" + + - name: "WIP: type" + run: | + type "D:/a/FileCheck.py/FileCheck.py/tests/i/filecheck.iii" + type "D:/a/FileCheck.py/FileCheck.py/tests/i/filecheck.iii" | echo + type "D:/a/FileCheck.py/FileCheck.py/tests/i/tests/check_commands/CHECK-EMPTY/01-error_CHECK_EMPTY_without_previous_CHECK/filecheck.input" + type "D:/a/FileCheck.py/FileCheck.py/tests/i/tests/check_commands/CHECK-EMPTY/01-error_CHECK_EMPTY_without_previous_CHECK/filecheck.input" | echo + python --version + $psversiontable + + - name: "Poetry: print version" + run: | + poetry --version + + - name: "Poetry: configure settings" + run: | + poetry config virtualenvs.in-project true + + - name: "Poetry: Install dependencies" + run: | + poetry install + + - name: Run tests + run: | + poetry run invoke test + shell: powershell diff --git a/tasks.py b/tasks.py index f85afa1..d96d146 100644 --- a/tasks.py +++ b/tasks.py @@ -27,7 +27,7 @@ def get_filecheck_tester_exec(): cwd = os.getcwd() os_string = get_os_filename_string() - template = '\\"{cwd}/tests/integration/tools/FileCheck/FileCheck-9.0.1-{os_string}\\"' + template = '\\"{cwd}/tests/i/tools/FileCheck/FileCheck-9.0.1-{os_string}\\"' return template.format(cwd=cwd, os_string=os_string) @@ -35,7 +35,7 @@ def get_filecheck_llvm_path(filecheck_exec): cwd = os.getcwd() os_string = get_os_filename_string() - template = '\\"{cwd}/tests/integration/tools/FileCheck/{filecheck_exec}-{os_string}\\"' + template = '\\"{cwd}/tests/i/tools/FileCheck/{filecheck_exec}-{os_string}\\"' return template.format( cwd=cwd, filecheck_exec=filecheck_exec, os_string=os_string ) @@ -61,7 +61,7 @@ def run_lit_tests(c, filecheck_exec, llvm_only): --param FILECHECK_EXEC="{filecheck_exec}" --param FILECHECK_TESTER_EXEC="{filecheck_tester_exec}" -v - {cwd}/tests/integration + {cwd}/tests/i """).format(cwd=cwd, filecheck_exec=filecheck_exec, filecheck_tester_exec=filecheck_tester_exec, diff --git a/tests/integration/lit.cfg b/tests/integration/lit.cfg index 32ddfe4..2e77468 100644 --- a/tests/integration/lit.cfg +++ b/tests/integration/lit.cfg @@ -25,7 +25,8 @@ real_only = lit_config.params['REAL_ONLY'] config.substitutions.append(('%FILECHECK_EXEC', filecheck_exec)) config.substitutions.append(('%FILECHECK_TESTER_EXEC', filecheck_tester_exec)) -cat_exec = "cat" if not is_windows() else "type" +shell = os.environ.get('SHELL', '') +cat_exec = "cat" if (not is_windows() or shell == "/bin/bash") else "type" config.substitutions.append(('%cat', cat_exec)) config.substitutions.append(('%expect_exit', 'python \"{}/tests/integration/tools/expect_exit.py\"'.format(current_dir)))