-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (65 loc) · 2.47 KB
/
pylint-pytest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# SPDX-FileCopyrightText: 2022 Renaissance Computing Institute. All rights reserved.
# SPDX-FileCopyrightText: 2023 Renaissance Computing Institute. All rights reserved.
# SPDX-FileCopyrightText: 2024 Renaissance Computing Institute. All rights reserved.
#
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-License-Identifier: LicenseRef-RENCI
# SPDX-License-Identifier: MIT
name: Pylint and Pytest the codebase
# trigger event is a push to the main repo branch (or a manual launch)
on:
workflow_dispatch:
push:
branches:
- main
# job definitions
jobs:
# runs pylint
lint:
name: Execute pylint
runs-on: ubuntu-latest
# job steps
steps:
# checkout the codebase
- name: Checkout the repository
uses: actions/checkout@v3
# build the image
- name: Build docker image
run: docker build -t archiver-testing -f Dockerfile.test .
# run pylint
- name: Run pylint and get the output
run: |
echo 'LINT_OUTPUT<<EOF' >> $GITHUB_ENV
echo "$(docker run archiver-testing pylint --rcfile=.pylintrc --recursive=y ./)" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
# runs pytest
test:
name: Execute pytest
runs-on: ubuntu-latest
# get the geoserver secrets into env params
env:
GEOSERVER_HOST: ${{ secrets.GEOSERVER_HOST }}
GEOSERVER_PASSWORD: ${{ secrets.GEOSERVER_PASSWORD }}
GEOSERVER_URL: ${{ secrets.GEOSERVER_URL }}
GEOSERVER_USER: ${{ secrets.GEOSERVER_USER }}
GEOSERVER_WORKSPACE: ${{ secrets.GEOSERVER_WORKSPACE }}
GEOSERVER_PROJ_PATH: ${{ secrets.GEOSERVER_PROJ_PATH }}
FILESERVER_OBS_PATH: ${{ secrets.FILESERVER_OBS_PATH }}
# job steps
steps:
# checkout the codebase
- name: Checkout the repository
uses: actions/checkout@v3
# build the image
- name: Build docker image
run: docker build -t archiver-testing -f Dockerfile.test .
# run pylint
- name: Run tests and get output
run: |
echo 'TEST_OUTPUT<<EOF' >> $GITHUB_ENV
echo "$(docker run -e GEOSERVER_HOST=$GEOSERVER_HOST -e GEOSERVER_WORKSPACE=$GEOSERVER_WORKSPACE -e GEOSERVER_USER=$GEOSERVER_USER \
-e GEOSERVER_PASSWORD=$GEOSERVER_PASSWORD -e GEOSERVER_URL=$GEOSERVER_URL archiver-testing pytest --cov)" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
# check for any issues
- name: Exit if there are any test failures
run: '[[ $TEST_OUTPUT != *FAILED* ]]'