Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mundialis linting workflow #59

Merged
merged 13 commits into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .flake8
Original file line number Diff line number Diff line change
@@ -4,14 +4,14 @@
# E501 line too long (83 > 79 characters)

per-file-ignores =
./actinia_module_plugin/api/modules/grass.py: E501
./actinia_module_plugin/api/processing.py: E501
./actinia_module_plugin/core/modules/actinia_common.py: E501
./actinia_module_plugin/core/modules/grass.py: E501
./actinia_module_plugin/core/templates/user_templates.py: E501
./actinia_module_plugin/endpoints.py: E501
./actinia_module_plugin/resources/config.py: F401
./actinia_module_plugin/wsgi.py: F401
./src/actinia_module_plugin/api/modules/grass.py: E501
./src/actinia_module_plugin/api/processing.py: E501
./src/actinia_module_plugin/core/modules/actinia_common.py: E501
./src/actinia_module_plugin/core/modules/grass.py: E501
./src/actinia_module_plugin/core/templates/user_templates.py: E501
./src/actinia_module_plugin/endpoints.py: E501
./src/actinia_module_plugin/resources/config.py: F401
./src/actinia_module_plugin/wsgi.py: F401

exclude =
./build
25 changes: 0 additions & 25 deletions .github/workflows/black.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/flake8.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Linting and code quality check

on: [push, pull_request]

jobs:
lint:
uses: mundialis/github-workflows/.github/workflows/linting.yml@main
with:
# set pylint-version to empty string to skip the pylint workflow
pylint-version: ''
BASH_SEVERITY: 'warning'
VALIDATE_DOCKERFILE_HADOLINT: false
VALIDATE_JSON: false
VALIDATE_HTML: false
VALIDATE_CSS: false
VALIDATE_BASH_EXEC: false
1 change: 1 addition & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Upload Python Package

on:
37 changes: 0 additions & 37 deletions .github/workflows/super-linter.yml

This file was deleted.

41 changes: 21 additions & 20 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
---
name: actinia tests

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]

# only one run per PR/branch happens at a time, cancelling the old run when a new one starts
# only one run per PR/branch happens at a time, cancelling the old run when a
# new one starts
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# with:
# path: "."
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Tests of actinia-module-plugin
id: docker_build
uses: docker/build-push-action@v6
with:
push: false
tags: actinia-module-plugin-test:alpine
context: .
file: docker/actinia-module-plugin-test/Dockerfile
no-cache: true
# pull: true
- name: Checkout
uses: actions/checkout@v4
# with:
# path: "."
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Tests of actinia-module-plugin
id: docker_build
uses: docker/build-push-action@v6
with:
push: false
tags: actinia-module-plugin-test:alpine
context: .
file: docker/actinia-module-plugin-test/Dockerfile
no-cache: true
# pull: true
22 changes: 10 additions & 12 deletions docker/actinia-module-plugin-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
FROM mundialis/actinia:latest as actinia_test
FROM mundialis/actinia:latest AS actinia_test

LABEL authors="Carmen Tawalika,Anika Weinmann"
LABEL maintainer="[email protected],[email protected]"

ENV ACTINIA_CUSTOM_TEST_CFG /etc/default/actinia-module-plugin-test
ENV ACTINIA_CUSTOM_TEST_CFG=/etc/default/actinia-module-plugin-test

# TODO do not set DEFAULT_CONFIG_PATH if this is fixed
ENV DEFAULT_CONFIG_PATH /etc/default/actinia-module-plugin-test
ENV DEFAULT_CONFIG_PATH=/etc/default/actinia-module-plugin-test
# set TEMPLATE_VALUE_ for testing
ENV TEMPLATE_VALUE_ENV_RASTER elevation
ENV TEMPLATE_VALUE_ENV_TYPE raster
ENV TEMPLATE_VALUE_ENV_RASTER=elevation
ENV TEMPLATE_VALUE_ENV_TYPE=raster

# install things only for tests
RUN apk add redis
RUN pip install --upgrade setuptools
RUN pip install pytest pytest-cov pwgen
RUN apk add --no-cache redis
RUN pip install --upgrade setuptools && pip install pytest pytest-cov pwgen

ENTRYPOINT ["/bin/sh"]
CMD ["/src/start.sh"]

RUN pip uninstall actinia-module-plugin.wsgi -y
RUN pip uninstall actinia-module-plugin -y
RUN pip uninstall actinia-module-plugin.wsgi actinia-module-plugin -y

# add data for tests
RUN grass -e -c 'EPSG:3358' /actinia_core/grassdb/nc_spm_08
@@ -30,13 +28,13 @@ RUN grass -e -c 'EPSG:3358' /actinia_core/grassdb/nc_spm_08
# mv nc_spm_08_micro /actinia_core/grassdb/nc_spm_08
# RUN grass -e -c 'EPSG:4326' /actinia_core/grassdb/latlong_wgs84

WORKDIR /src/actinia-module-plugin/

# copy needed files and configs for test
COPY docker/actinia-module-plugin-test/actinia-module-plugin-test.cfg /etc/default/actinia
COPY docker/actinia-module-plugin-test/actinia-module-plugin-test.cfg /etc/default/actinia-module-plugin-test
COPY . /src/actinia-module-plugin/

WORKDIR /src/actinia-module-plugin/

RUN chmod a+x tests_with_redis.sh
RUN pip install .

4 changes: 2 additions & 2 deletions docker/release/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:edge as build
FROM alpine:edge AS build

RUN apk add git python3 postgresql-dev gcc python3-dev musl-dev

@@ -30,7 +30,7 @@ ENV env_tag=$tag
ENV env_credentials=$credentials
ENV env_file=$file

RUN apk add curl jq
RUN apk add --no-cache curl jq

ENTRYPOINT ["/bin/sh"]
CMD ["./create_release_with_asset.sh"]
12 changes: 6 additions & 6 deletions docker/release/create_release_with_asset.sh
Original file line number Diff line number Diff line change
@@ -6,23 +6,23 @@
#env_credentials
#env_file

filefull=`ls $env_file`
filefull=`ls ${env_file:-}`
filename=$(basename $filefull)


echo "{\"tag_name\": \"$env_tag\",\"target_commitish\": \"master\",\"name\":\"$env_tag\",\"body\": \"Automatically created by CI\",\"draft\": false,\"prerelease\": false}" > /tmp/release_payload.json
echo "{\"tag_name\": \"${env_tag:-}\",\"target_commitish\": \"master\",\"name\":\"${env_tag:-}\",\"body\": \"Automatically created by CI\",\"draft\": false,\"prerelease\": false}" > /tmp/release_payload.json

# Create release
curl -u $env_credentials -X POST -H 'Content-Type: application/json' -d @/tmp/release_payload.json $env_release_url > resp.json && cat resp.json
curl -u ${env_credentials:-} -X POST -H 'Content-Type: application/json' -d @/tmp/release_payload.json ${env_release_url:-} > resp.json && cat resp.json

# parse response to create upload_url
upload_url=`cat resp.json | jq '.upload_url' | tr -d '"' | cut -d '{' -f1`
url=$upload_url?name=$filename
url="${upload_url}?name=${filename}"

if [ "$upload_url" == "null" ]
if [ "${upload_url}" = "null" ]
then
echo "Failed to create release, aborting."
exit 1
fi

curl -u $env_credentials -H "Accept: application/vnd.github.manifold-preview" -H "Content-Type: application/zip" --data-binary @$filefull "$url" > resp.json && cat resp.json
curl -u ${env_credentials:-} -H "Accept: application/vnd.github.manifold-preview" -H "Content-Type: application/zip" --data-binary @$filefull "$url" > resp.json && cat resp.json
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
"config:recommended"
]
}
Loading