correcting logging method (error() -> exception() #85
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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* ]]' |