Skip to content

Commit 6572d6d

Browse files
authored
Repo improvements (#18)
Enable Superlinter Restore Pipfile New badges style Install pre-commit Use Taskfile instead of make Fix broken FOR loop in atests
1 parent e965fea commit 6572d6d

File tree

11 files changed

+266
-37
lines changed

11 files changed

+266
-37
lines changed

.github/workflows/linter.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Lint Code Base
2+
3+
on:
4+
push:
5+
branches-ignore: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build:
11+
name: Lint Code Base
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout Code
15+
uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Lint Code Base
20+
uses: github/super-linter@v3
21+
env:
22+
VALIDATE_ALL_CODEBASE: false
23+
DEFAULT_BRANCH: master
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,5 @@ log.html
104104
output.xml
105105
report.html
106106

107-
Pipfile
108-
Pipfile.lock
107+
# VSCode repo level settings
108+
.vscode

.pre-commit-config.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v3.4.0
5+
hooks:
6+
- id: trailing-whitespace
7+
- id: end-of-file-fixer
8+
- id: check-docstring-first
9+
- id: debug-statements
10+
- id: name-tests-test
11+
- id: double-quote-string-fixer
12+
- repo: https://gitlab.com/pycqa/flake8
13+
rev: 3.8.4
14+
hooks:
15+
- id: flake8
16+
additional_dependencies:
17+
- flake8-typing-imports==1.10.0
18+
- repo: https://github.com/pre-commit/mirrors-autopep8
19+
rev: v1.5.4
20+
hooks:
21+
- id: autopep8
22+
- repo: https://github.com/asottile/pyupgrade
23+
rev: v2.10.0
24+
hooks:
25+
- id: pyupgrade
26+
args:
27+
- '--py36-plus'
28+
- repo: https://github.com/asottile/reorder_python_imports
29+
rev: v2.4.0
30+
hooks:
31+
- id: reorder-python-imports
32+
args:
33+
- '--py3-plus'
34+
- repo: https://github.com/asottile/add-trailing-comma
35+
rev: v2.1.0
36+
hooks:
37+
- id: add-trailing-comma
38+
args:
39+
- '--py36-plus'
40+
# - repo: https://github.com/asottile/setup-cfg-fmt
41+
# rev: v1.16.0
42+
# hooks:
43+
# - id: setup-cfg-fmt
44+
- repo: https://github.com/pre-commit/mirrors-mypy
45+
rev: v0.812
46+
hooks:
47+
- id: mypy

Makefile

Lines changed: 0 additions & 16 deletions
This file was deleted.

Pipfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
robotframework-jenkins = {editable = true, path = "."}
8+
9+
[dev-packages]
10+
autopep8 = "*"
11+
12+
[requires]
13+
python_version = "3.9"

Pipfile.lock

Lines changed: 128 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
[![PyPI version](https://badge.fury.io/py/robotframework-jenkins.svg)](https://badge.fury.io/py/robotframework-jenkins)
2-
![Supported Jenkins Version](https://img.shields.io/badge/Tested%20with%20jenkins-%3E2.176.1%20%3C2.234-blue)
3-
41
JenkinsLibrary for Robot Framework
52
==============================
63

4+
![PyPI](https://img.shields.io/pypi/v/robotframework-jenkins?style=for-the-badge&color=green)
5+
![Supported Jenkins Version](https://img.shields.io/badge/Tested%20with%20Jenkins-%3E2.176.1%20%3C2.234-blue?style=for-the-badge)
6+
77
Introduction
88
------------
99

@@ -38,4 +38,3 @@ Example
3838
[Setup] Set Jenkins Server url=http://example.com:8080 username=admin password=admin
3939
Create Jenkins Job test_job
4040
Start Jenkins Job test_job
41-

Taskfile.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: '3'
2+
3+
tasks:
4+
build:
5+
cmds:
6+
- python setup.py sdist bdist_wheel --universal
7+
8+
publish:
9+
cmds:
10+
- twine upload dist/*
11+
12+
test:docker:rf:
13+
cmds:
14+
- task: jenkins:docker:run
15+
- task: test:rf
16+
- task: jenkins:docker:stop
17+
18+
test:rf:
19+
cmds:
20+
- robot --loglevel DEBUG --pythonpath src/ atest/
21+
22+
jenkins:docker:run:
23+
cmds:
24+
- docker build --pull -t jenkins-robotframework-test atest/docker
25+
- docker run --rm --name jenkins-robotframework-test -p 127.0.0.1:8080:8080 -e JAVA_OPTS=-Djenkins.install.runSetupWizard=false -d jenkins-robotframework-test
26+
27+
jenkins:docker:stop:
28+
cmds:
29+
- docker stop jenkins-robotframework-test

atest/builds.robot

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Get Builds (existent jobs, no builds)
2828
Should Not Be True ${builds['lastBuild']}
2929
Should Be Equal As Integers 1 ${builds['nextBuildNumber']}
3030

31-
Check Finished Build Status
31+
Check Finished Build Status
3232
[Tags] job build
3333
[Setup] Create Job From Template ${test_job_name} ${job_sleep}
3434
[Teardown] Delete Jenkins Job ${test_job_name}
@@ -37,12 +37,12 @@ Check Finished Build Status
3737
${build_finished} = Is Build Finished ${test_job_name} ${build_number}
3838
Should Not Be True ${build_finished}
3939

40-
Check Running Build Status
40+
Check Running Build Status
4141
[Tags] job build
4242
[Setup] Create Job From Template ${test_job_name} ${job_sleep}
4343
[Teardown] Delete Jenkins Job ${test_job_name}
4444
${build_number} = Start Jenkins Job ${test_job_name}
45-
Wait Until Build Starts ${test_job_name} ${build_number} 60 sec
45+
Wait Until Build Starts ${test_job_name} ${build_number} 60 sec
4646
Wait Until Build Finishes ${test_job_name} ${build_number}
4747
${build_finished} = Is Build Finished ${test_job_name} ${build_number}
4848
Should Be True ${build_finished}
@@ -52,10 +52,11 @@ Get Next Build Number
5252
[Setup] Create Jenkins Job ${test_job_name}
5353
[Teardown] Delete Jenkins Job ${test_job_name}
5454
${random_int} = Evaluate random.randint(2, 10) modules=random
55-
:FOR ${run} IN RANGE ${random_int}
56-
\ ${next_build_before} = Get Next Build Number ${test_job_name}
57-
\ Should Be Equal As Integers ${run + 1} ${next_build_before}
58-
\ ${build_number} = Start Jenkins Job ${test_job_name}
59-
\ Wait Until Build Finishes ${test_job_name} ${build_number}
60-
\ ${next_build_after} = Get Next Build Number ${test_job_name}
61-
\ Should Be Equal As Integers ${run + 2} ${next_build_after}
55+
FOR ${run} IN RANGE ${random_int}
56+
${next_build_before} = Get Next Build Number ${test_job_name}
57+
Should Be Equal As Integers ${run + 1} ${next_build_before}
58+
${build_number} = Start Jenkins Job ${test_job_name}
59+
Wait Until Build Finishes ${test_job_name} ${build_number}
60+
${next_build_after} = Get Next Build Number ${test_job_name}
61+
Should Be Equal As Integers ${run + 2} ${next_build_after}
62+
END

atest/lib/jenkins_keywords.robot

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ Create Job From Template
3434
Create Job And Run Multiple Builds
3535
[Arguments] ${job_name} ${count}=2
3636
Create Jenkins Job ${job_name}
37-
:FOR ${run} IN RANGE ${count}
38-
\ ${build_number} = Start Jenkins Job ${job_name}
39-
\ Wait Until Build Finishes ${job_name} ${build_number}
37+
FOR ${run} IN RANGE ${count}
38+
${build_number} = Start Jenkins Job ${job_name}
39+
Wait Until Build Finishes ${job_name} ${build_number}
40+
END
4041

4142
Check Build Is Finished
4243
[Arguments] ${job_name} ${build_number}
@@ -51,9 +52,9 @@ Check Build Is Started
5152
Wait Until Build Finishes
5253
[Arguments] ${job_name} ${build_number} ${timeout}=20 sec ${period}=2 sec
5354
Wait Until Keyword Succeeds ${timeout} ${period}\
54-
... Check Build Is Finished ${test_job_name} ${build_number}
55+
... Check Build Is Finished ${test_job_name} ${build_number}
5556

5657
Wait Until Build Starts
5758
[Arguments] ${job_name} ${build_number} ${timeout}=20 sec ${period}=2 sec
5859
Wait Until Keyword Succeeds ${timeout} ${period}\
59-
... Check Build Is Started ${test_job_name} ${build_number}
60+
... Check Build Is Started ${test_job_name} ${build_number}

0 commit comments

Comments
 (0)