Skip to content

Commit

Permalink
System tests tryout
Browse files Browse the repository at this point in the history
  • Loading branch information
jherbel committed Nov 28, 2023
1 parent 5ea979d commit b52cbdf
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
- analyse_changes
if: ${{ needs.analyse_changes.outputs.rcc_yaml_changed == 'true' }}
uses: ./.github/workflows/rcc.yaml
with:
artifact_name: rcc_ci

check_success:
if: always()
Expand Down
45 changes: 28 additions & 17 deletions .github/workflows/rcc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,34 @@ name: "RCC cached upload"

on:
workflow_call:
{}
inputs:
artifact_name:
required: true
type: string

env:
RCC_TAG: "v14.15.4"
GO_VERSION: "1.20.x"
RUBY_VERSION: "2.7"

jobs:
restore_from_cache:
check_cache:
runs-on: ubuntu-latest
outputs:
cache_hit: ${{ steps.restore-from-cache.outputs.cache-hit }}
steps:
- id: restore-from-cache
uses: actions/cache/restore@v3
with:
path: build
key: rcc-${{ env.RCC_TAG }}-${{ env.GO_VERSION }}-${{ env.RUBY_VERSION }}
path: build
lookup-only: true

build_and_test:
build_and_cache:
runs-on: ubuntu-latest
needs:
- restore_from_cache
if: ${{ needs.restore_from_cache.outputs.cache_hit != 'true' }}
- check_cache
if: ${{ needs.check_cache.outputs.cache_hit != 'true' }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -40,20 +44,27 @@ jobs:
ruby-version: ${{ env.RUBY_VERSION }}
- run: rake build
- run: rake test
- uses: actions/cache/save@v3
with:
key: rcc-${{ env.RCC_TAG }}-${{ env.GO_VERSION }}-${{ env.RUBY_VERSION }}
path: build

upload_and_cache:
upload:
runs-on: ubuntu-latest
needs: build_and_test
needs:
- build_and_cache
# See https://github.com/actions/runner/issues/491 for the following condition
if: |
always() &&
(needs.build_and_test.result == 'success' || needs.build_and_test.result == 'skipped')
(needs.build_and_cache.result == 'success' || needs.build_and_cache.result == 'skipped')
steps:
- uses: actions/cache/save@v3
with:
path: build
key: rcc-${{ env.RCC_TAG }}-${{ env.GO_VERSION }}-${{ env.RUBY_VERSION }}
- uses: actions/upload-artifact@v3
with:
path: build
if-no-files-found: error
- uses: actions/cache/restore@v3
with:
path: build
key: rcc-${{ env.RCC_TAG }}-${{ env.GO_VERSION }}-${{ env.RUBY_VERSION }}
fail-on-cache-miss: true
- uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact_name }}
path: build
if-no-files-found: error
7 changes: 6 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
uses: ./.github/workflows/tests.yaml
build_rcc:
uses: ./.github/workflows/rcc.yaml
with:
artifact_name: rcc_release
build_robotmk:
uses: ./.github/workflows/robotmk_build.yaml
release:
Expand All @@ -27,8 +29,11 @@ jobs:
# adjusted. Currently, everything uses the default branch.

- uses: actions/download-artifact@v3
with:
name: rcc_release
path: rcc_artifact

- run: zip -r executables.zip artifact
- run: zip -r executables.zip rcc_artifact

- name: "Push release tag"
# This is publicly visible and needs to be manually fixed if any
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/system_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: "System tests"

on: [push]

jobs:
rcc:
uses: ./.github/workflows/rcc.yaml
with:
artifact_name: rcc_system_test

tbd:
runs-on: windows-latest
needs:
- rcc
steps:
- uses: actions/download-artifact@v3
with:
name: rcc_system_test
path: C:\rcc
- uses: actions/checkout@v4
- uses: actions-rust-lang/[email protected]
with:
target: x86_64-pc-windows-gnu
- run: cargo build --target=x86_64-pc-windows-gnu --release
working-directory: ${{ github.workspace }}/v2/robotmk/
- run: Copy-Item "${{ github.workspace }}/v2/robotmk/system_tests/minimal_suite/" -Destination "C:\minimal_suite" -Recurse
- run: ${{ github.workspace }}/v2/robotmk/target/x86_64-pc-windows-gnu/release/robotmk.exe ${{ github.workspace }}/v2/robotmk/system_tests/config.json -vv
shell: cmd

31 changes: 31 additions & 0 deletions v2/robotmk/system_tests/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"working_directory": "C:\\working",
"results_directory": "C:\\results",
"rcc_binary_path": "C:\\rcc\\windows64\\rcc.exe",
"suites": {
"math": {
"robot_framework_config": {
"robot_target": "C:\\minimal_suite\\tasks.robot",
"command_line_args": []
},
"execution_config": {
"n_attempts_max": 1,
"retry_strategy": "Complete",
"execution_interval_seconds": 60,
"timeout": 5
},
"environment_config": {
"Rcc": {
"robot_yaml_path": "C:\\minimal_suite\\robot.yaml",
"build_timeout": 600,
"env_json_path": null
}
},
"session_config": "Current",
"working_directory_cleanup_config": {
"MaxExecutions": 5
},
"host": "Source"
}
}
}
8 changes: 8 additions & 0 deletions v2/robotmk/system_tests/minimal_suite/conda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
channels:
- conda-forge

dependencies:
- python=3.11.6
- pip=23.3.1
- pip:
- rpaframework==27.7.0
10 changes: 10 additions & 0 deletions v2/robotmk/system_tests/minimal_suite/lib/add.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def setup() -> None:
print("Setting up...")


def teardown() -> None:
print("Tearing down...")


def add(left: int, right: int) -> int:
return left + right
12 changes: 12 additions & 0 deletions v2/robotmk/system_tests/minimal_suite/robot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
tasks:
execute:
command:
- python
- --version

condaConfigFile: conda.yaml
artifactsDir: /tmp/outputdir # Leading slash is ignored, instead we get $(pwd)/tmp/outputdir/
PATH:
- .
PYTHONPATH:
- .
21 changes: 21 additions & 0 deletions v2/robotmk/system_tests/minimal_suite/tasks.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
*** Settings ***
Documentation Test file for configuring RobotFramework
Library ${CURDIR}/lib/add.py WITH NAME math

Suite Setup math.setup
Suite Teardown math.teardown


*** Test Cases ***
Addition One
${result}= math.add ${20} ${5}
Should Be Equal As Integers ${result} ${25}

Addition Two
${result}= math.add ${20} ${15}
Should Be Equal As Integers ${result} ${35}

Addition Three
${result}= math.add ${20} ${25}
Should Be Equal As Integers ${result} ${45}

0 comments on commit b52cbdf

Please sign in to comment.