From c943012ccb3881fc05b7482837b94cf2cdd8ec21 Mon Sep 17 00:00:00 2001 From: Tattoo Date: Tue, 17 Oct 2023 16:46:27 +0300 Subject: [PATCH] CICD: refactor pipeline --- .github/workflows/action.yml | 23 +++++++++++++++++++++++ .github/workflows/tests-simple.yml | 13 +++---------- tasks.py | 7 +++---- 3 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/action.yml diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml new file mode 100644 index 0000000..2e67738 --- /dev/null +++ b/.github/workflows/action.yml @@ -0,0 +1,23 @@ +name: 'Run tests' +inputs: + python-version: + required: true + rf-version: + required: true +runs: + using: 'composite' + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: ${{ python-version }} + cache: 'pip' + - name: Install dependencies + run: | + pip install -r requirements.txt + pip install robotframework==${{ rf-version }} + - name: Run tests + run: | + invoke test diff --git a/.github/workflows/tests-simple.yml b/.github/workflows/tests-simple.yml index dbe6ed1..40c0fae 100644 --- a/.github/workflows/tests-simple.yml +++ b/.github/workflows/tests-simple.yml @@ -36,15 +36,8 @@ jobs: steps: - name: Checkout the repository uses: actions/checkout@v4 - - name: Install Python - uses: actions/setup-python@v4 + - name: "Run tests" + uses: ./.github/workflows with: python-version: ${{ matrix.python }} - cache: 'pip' - - name: Install dependencies - run: | - pip install -r requirements.txt - pip install robotframework==${{ matrix.rf-version }} - - name: Run tests - run: | - invoke test + rf-version: ${{ matrix.rf-version }} diff --git a/tasks.py b/tasks.py index fbb0092..f912f0b 100644 --- a/tasks.py +++ b/tasks.py @@ -62,14 +62,13 @@ def coverage(context, in_nix=False): 'single string. E.g: invoke atest --rf "--name my_suite"' }) def atest(context, rf=''): - cmd = (f'robot ' + run(f'robot ' f'--pythonpath {str(SRCPATH)} ' f'--dotted ' f'{rf} ' f'--listener oxygen.listener ' - f'{str(CURDIR / "tests" / "atest")}') - print(cmd) - run(cmd, pty=(not system() == 'Windows')) + f'{str(CURDIR / "tests" / "atest")}', + pty=(not system() == 'Windows')) @task(help={ 'in_nix': IN_NIX_HELP