Skip to content

Testi #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: feature/DEV-137
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .github/workflows/ci_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Run Robot Framework Tests and API Tests

on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Poetry (1.5.1)
run: |
curl -sSL https://install.python-poetry.org | python3 - --version 1.5.1
echo "export PATH=$HOME/.local/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "Poetry version: $(poetry --version)"

- name: Update Poetry Lock
run: |
poetry lock --no-update

- name: Install Dependencies
run: |
poetry install

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install Playwright Dependencies
run: |
pip install playwright
playwright install
playwright install-deps
npm install -g playwright
npx playwright install chromium

- name: Start services with Docker Compose
run: |
docker compose up -d --build
sleep 10

- name: Run Security Scan with Trivy
if: ${{ !env.ACT }} # Tämä estää ajon, jos käytät ACTia
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
input: '.'
ignore-unfixed: true
exit-code: 1
severity: 'HIGH,CRITICAL'
format: 'table'

- name: Verify Node.js and npm installation
run: |
node -v
npm -v

- name: Rfbrowser installation
run: |
poetry run rfbrowser init

- name: Run API Tests
run: |
poetry run pip install pytest-html
mkdir -p api_test_results
poetry run pytest --maxfail=3 --disable-warnings --junitxml=api_test_results/results.xml --html=api_test_results/report.html

- name: Install Playwright inside Poetry environment
run: |
poetry run playwright install

- name: Verify Playwright installation
run: |
playwright --version

- name: Run Robot Framework Tests
run: |
poetry run robot --outputdir robot_results robot_tests/

- name: Upload Robot Framework Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: robot-results
path: robot_results/

- name: Upload API Test Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: api-test-results
path: api_test_results/
Loading