├── entrypoint.sh ├── Dockerfile ├── README.md └── LICENSE /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | args=$@ 3 | shopt -s nullglob 4 | requirements=(requirement*.txt) 5 | for requirement in "${requirements[@]}" 6 | do 7 | command="pip install -r $requirement" 8 | echo ${command} 9 | ${command} 10 | done 11 | command="nosetests $args" 12 | echo ${command} 13 | ${command} 14 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jfloff/alpine-python 2 | 3 | LABEL "com.github.actions.name"="python-nose-test" 4 | LABEL "com.github.actions.description"="Run nose tests for Python codes." 5 | LABEL "com.github.actions.icon"="check-circle" 6 | LABEL "com.github.actions.color"="black" 7 | 8 | LABEL "repository"="https://github.com/CyberZHG/github-action-python-test.git" 9 | LABEL "homepage"="https://github.com/CyberZHG/github-action-python-test" 10 | LABEL "maintainer"="CyberZHG " 11 | 12 | RUN pip install --upgrade pip 13 | RUN pip install nose 14 | 15 | ADD entrypoint.sh /entrypoint.sh 16 | ENTRYPOINT ["/entrypoint.sh"] 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Python Test Action 2 | ================== 3 | 4 | GitHub action that runs `nosetests`. 5 | 6 | ## Usage 7 | 8 | Dependencies in `requirements.txt` will be installed. Run test with default setting: 9 | 10 | ``` 11 | workflow "Python Test" { 12 | on = "push" 13 | resolves = ["python-test"] 14 | } 15 | 16 | action "python-test" { 17 | uses = "CyberZHG@github-action-python-test@master" 18 | } 19 | ``` 20 | 21 | Add arguments: 22 | 23 | ``` 24 | workflow "Python Test" { 25 | on = "push" 26 | resolves = ["python-test"] 27 | } 28 | 29 | action "python-test" { 30 | uses = "CyberZHG/github-action-python-test@master" 31 | args = "--with-coverage source_folder_1_name source_folder_2_name ..." 32 | } 33 | ``` 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Zhao HG 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------