diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bf392dc5..f276f23e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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() diff --git a/.github/workflows/rcc.yaml b/.github/workflows/rcc.yaml index 4801d251..da0a1911 100644 --- a/.github/workflows/rcc.yaml +++ b/.github/workflows/rcc.yaml @@ -3,7 +3,10 @@ name: "RCC cached upload" on: workflow_call: - {} + inputs: + artifact_name: + required: true + type: string env: RCC_TAG: "v14.15.4" @@ -11,7 +14,7 @@ env: RUBY_VERSION: "2.7" jobs: - restore_from_cache: + check_cache: runs-on: ubuntu-latest outputs: cache_hit: ${{ steps.restore-from-cache.outputs.cache-hit }} @@ -19,14 +22,15 @@ jobs: - 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: @@ -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 \ No newline at end of file + - 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 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9174788a..b1430145 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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: @@ -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 diff --git a/.github/workflows/system_test.yaml b/.github/workflows/system_test.yaml new file mode 100644 index 00000000..c0c25ef7 --- /dev/null +++ b/.github/workflows/system_test.yaml @@ -0,0 +1,32 @@ +--- +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/setup-rust-toolchain@v1.5.0 + 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 + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + \ No newline at end of file diff --git a/v2/robotmk/system_tests/config.json b/v2/robotmk/system_tests/config.json new file mode 100644 index 00000000..51aa8c47 --- /dev/null +++ b/v2/robotmk/system_tests/config.json @@ -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" + } + } +} diff --git a/v2/robotmk/system_tests/minimal_suite/conda.yaml b/v2/robotmk/system_tests/minimal_suite/conda.yaml new file mode 100644 index 00000000..d21d4702 --- /dev/null +++ b/v2/robotmk/system_tests/minimal_suite/conda.yaml @@ -0,0 +1,8 @@ +channels: + - conda-forge + +dependencies: + - python=3.6.11 + - pip=23.3.1 + - pip: + - rpaframework==27.7.0 diff --git a/v2/robotmk/system_tests/minimal_suite/lib/add.py b/v2/robotmk/system_tests/minimal_suite/lib/add.py new file mode 100644 index 00000000..c61a5f10 --- /dev/null +++ b/v2/robotmk/system_tests/minimal_suite/lib/add.py @@ -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 diff --git a/v2/robotmk/system_tests/minimal_suite/robot.yaml b/v2/robotmk/system_tests/minimal_suite/robot.yaml new file mode 100644 index 00000000..6ee4ca61 --- /dev/null +++ b/v2/robotmk/system_tests/minimal_suite/robot.yaml @@ -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: + - . diff --git a/v2/robotmk/system_tests/minimal_suite/tasks.robot b/v2/robotmk/system_tests/minimal_suite/tasks.robot new file mode 100644 index 00000000..e9f09f3c --- /dev/null +++ b/v2/robotmk/system_tests/minimal_suite/tasks.robot @@ -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}