├── README.md ├── action.yml └── test.sh /README.md: -------------------------------------------------------------------------------- 1 | # Robot Framework Docker Action 2 | 3 | This action runs Robot Framework tests using [ppodgorsek](https://github.com/ppodgorsek/docker-robot-framework) image. 4 | 5 | ## Example usage 6 | 7 | Run with chrome: 8 | 9 | ```jobs: 10 | robot_test: 11 | runs-on: ubuntu-latest 12 | name: Run Robot Framework Tests 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v2 16 | - name: Robot Framework 17 | uses: joonvena/robotframework-docker-action@v1.0 18 | ``` 19 | 20 | Run with firefox and in parallel: 21 | 22 | ```jobs: 23 | robot_test: 24 | runs-on: ubuntu-latest 25 | name: Run Robot Framework Tests 26 | steps: 27 | - name: Checkout 28 | uses: actions/checkout@v2 29 | - name: Robot Framework 30 | uses: joonvena/robotframework-docker-action@v1.0 31 | with: 32 | browser: 'firefox' 33 | robot_threads: 2 34 | ``` 35 | 36 | Available configurations in with block: 37 | 38 | | Name | Default | Description | 39 | | ------------------------ | ----------------------------------- | ---------------------------------------------------- | 40 | | allowed_shared_memory | '1g' | How much container can use shared memory | 41 | | browser | 'chrome' | Available options chrome / firefox | 42 | | robot_threads | 1 | Change this > 1 if you want to run tests in parallel | 43 | | pabot_options | '' | These are only used if robot_threads > 1 | 44 | | robot_options | '' | Pass extra settings for robot command | 45 | | screen_color_depth | 24 | Color depth of the virtual screen | 46 | | screen_height | 1080 | Height of the virtual screen | 47 | | screen_width | 1920 | Width of the virtual screen | 48 | | robot_tests_dir | 'robot_tests' | Location of tests inside repository | 49 | | robot_reports_dir | 'reports' | Location of report output from test execution | 50 | | robot_runner_image | 'ppodgorsek/robot-framework:latest' | Docker image which will be used to execute the tests | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Robot Framework' 2 | description: 'Run Robot Framework tests' 3 | inputs: 4 | allowed_shared_memory: 5 | description: 'Shared memory that Docker container is allowed to use' 6 | required: true 7 | default: '1g' 8 | browser: 9 | description: 'Browser to use' 10 | required: true 11 | default: 'chrome' 12 | robot_threads: 13 | description: 'Execute tests in parallel' 14 | required: true 15 | default: 1 16 | pabot_options: 17 | description: 'Extra settings for parallel execution. https://github.com/mkorpela/pabot#command-line-options' 18 | required: true 19 | default: '' 20 | robot_options: 21 | description: 'Extra options for robot command' 22 | required: true 23 | default: '' 24 | screen_color_depth: 25 | description: 'Color depth of the virtual screen' 26 | required: true 27 | default: 24 28 | screen_height: 29 | description: 'Height of the virtual screen' 30 | required: true 31 | default: 1080 32 | screen_width: 33 | description: 'Width of the virtual screen' 34 | required: true 35 | default: 1920 36 | robot_tests_dir: 37 | description: 'Directory where Robot tests are located in the repository' 38 | required: true 39 | default: 'robot_tests' 40 | robot_reports_dir: 41 | description: 'Where will the report from test be saved' 42 | required: true 43 | default: 'reports' 44 | robot_runner_image: 45 | description: 'The docker image which will be used to execute the tests' 46 | required: true 47 | default: 'ppodgorsek/robot-framework:latest' 48 | 49 | 50 | runs: 51 | using: 'composite' 52 | steps: 53 | - shell: bash 54 | run: ${{ github.action_path }}/test.sh 55 | env: 56 | ALLOWED_SHARED_MEMORY: ${{ inputs.allowed_shared_memory }} 57 | BROWSER: ${{ inputs.browser }} 58 | ROBOT_THREADS: ${{ inputs.robot_threads }} 59 | PABOT_OPTIONS: ${{ inputs.pabot_options }} 60 | ROBOT_OPTIONS: ${{ inputs.robot_options }} 61 | SCREEN_COLOR_DEPTH: ${{ inputs.screen_color_depth }} 62 | SCREEN_HEIGHT: ${{ inputs.screen_height }} 63 | SCREEN_WIDTH: ${{ inputs.screen_width }} 64 | ROBOT_TESTS_DIR: ${{ inputs.robot_tests_dir }} 65 | ROBOT_REPORTS_DIR: ${{ inputs.robot_reports_dir }} 66 | ROBOT_RUNNER_IMAGE: ${{ inputs.robot_runner_image }} 67 | -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | # Create reports folder 2 | REPORTS_DIR=$(pwd)/$ROBOT_REPORTS_DIR 3 | TESTS_DIR=$(pwd)/$ROBOT_TESTS_DIR 4 | sudo mkdir $REPORTS_DIR && sudo chmod 777 $REPORTS_DIR 5 | 6 | docker run --shm-size=$ALLOWED_SHARED_MEMORY \ 7 | -e BROWSER=$BROWSER \ 8 | -e ROBOT_THREADS=$ROBOT_THREADS \ 9 | -e PABOT_OPTIONS="$PABOT_OPTIONS" \ 10 | -e ROBOT_OPTIONS="$ROBOT_OPTIONS" \ 11 | -v $REPORTS_DIR:/opt/robotframework/reports:Z \ 12 | -v $TESTS_DIR:/opt/robotframework/tests:Z \ 13 | --user $(id -u):$(id -g) \ 14 | $ROBOT_RUNNER_IMAGE 15 | --------------------------------------------------------------------------------