Skip to content

Commit

Permalink
split CI into test and build
Browse files Browse the repository at this point in the history
license moved
updating docs
  • Loading branch information
jankovicgd committed Dec 27, 2022
1 parent 1c16a3a commit 55c053c
Show file tree
Hide file tree
Showing 14 changed files with 258 additions and 308 deletions.
111 changes: 111 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: build
on:
push:
tags:
- "release-[0-9]+.[0-9]+.[0-9]+"
branches: [master]
jobs:
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Branch name
id: branch_name
run: |
echo ::set-output name=SOURCE_BRANCH:: $([[ $GITHUB_REF == refs/heads/* ]] && echo ${GITHUB_REF#refs/heads/} || echo "")
echo ::set-output name=SOURCE_TAG::$([[ $GITHUB_REF == refs/tags/* ]] && echo ${GITHUB_REF#refs/tags/} || echo "")
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: success()
- name: Tag docker latest image
run: |
docker tag eoxserver eoxa/eoxserver:latest
if: success() && steps.branch_name.outputs.SOURCE_BRANCH == 'master'
- name: Tag docker release image
run: |
docker tag eoxserver eoxa/eoxserver:${{ steps.branch_name.outputs.SOURCE_TAG }}
if: success() && steps.branch_name.outputs.SOURCE_TAG
- name: Push docker images
run: |
# TODO: --all-tags does not seem to work with the version on github-actions
# docker push --all-tags eoxa/eoxserver
for tag in $(docker image ls --format "{{.Tag}}" eoxa/eoxserver) ; do docker push "eoxa/eoxserver:$tag" ; done
if: success()
build-pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Branch name
id: branch_name
run: |
echo ::set-output name=SOURCE_BRANCH:: $([[ $GITHUB_REF == refs/heads/* ]] && echo ${GITHUB_REF#refs/heads/} || echo "")
echo ::set-output name=SOURCE_TAG::$([[ $GITHUB_REF == refs/tags/* ]] && echo ${GITHUB_REF#refs/tags/} || echo "")
- name: Build Python package
id: build_python_release
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
python setup.py sdist bdist_wheel
echo ::set-output name=WHEEL_FILE::$(ls dist/*.whl)
echo ::set-output name=SRC_DIST_FILE::$(ls dist/*.tar.gz)
if: startsWith(steps.branch_name.outputs.SOURCE_TAG, 'release-')
- name: Push package to pypi
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
if: success() && startsWith(steps.branch_name.outputs.SOURCE_TAG, 'release-')
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Branch name
id: branch_name
run: |
echo ::set-output name=SOURCE_BRANCH:: $([[ $GITHUB_REF == refs/heads/* ]] && echo ${GITHUB_REF#refs/heads/} || echo "")
echo ::set-output name=SOURCE_TAG::$([[ $GITHUB_REF == refs/tags/* ]] && echo ${GITHUB_REF#refs/tags/} || echo "")
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ steps.branch_name.outputs.SOURCE_TAG }}
draft: true
if: success() && startsWith(steps.branch_name.outputs.SOURCE_TAG, 'release-')
- name: Upload Release Asset Wheel
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.build_python_release.outputs.WHEEL_FILE }}
asset_name: ${{ steps.build_python_release.outputs.WHEEL_FILE }}
asset_content_type: application/x-wheel+zip
if: success() && startsWith(steps.branch_name.outputs.SOURCE_TAG, 'release-')
- name: Upload Release Asset Source Dist
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ steps.build_python_release.outputs.SRC_DIST_FILE }}
asset_name: ${{ steps.build_python_release.outputs.SRC_DIST_FILE }}
asset_content_type: application/tar+gzip
if: success() && matrix.latest && startsWith(steps.branch_name.outputs.SOURCE_TAG, 'release-')
notify:
runs-on: ubuntu-20.04
needs: release
steps:
- name: action-slack
uses: 8398a7/[email protected]
with:
status: ${{ needs.run.result }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()
159 changes: 0 additions & 159 deletions .github/workflows/ci.yml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: tests
on:
push:
paths:
- '.github/workflows/tests.yaml'
- 'setup.py'
- 'setup.cfg'
- 'MANIFEST.in'
- 'pyproject.toml'
- 'eoxserver/**'
pull_request:
branches: [master]
paths:
- '.github/workflows/tests.yaml'
- 'setup.py'
- 'setup.cfg'
- 'MANIFEST.in'
- 'pyproject.toml'
- 'eoxserver/**'
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- db: postgis
python_bin: python3
- db: spatialite
python_bin: python3
steps:
- uses: actions/checkout@v2
- name: Build the eoxserver docker image
run: |
docker build -t eoxserver .
- name: Run the tests
env:
COMPOSE_INTERACTIVE_NO_CLI: 1
run: |
echo "DB=${{ matrix.db }}" >> sample.env
docker-compose config
docker-compose up -d
docker-compose ps
docker exec -i eoxserver_autotest_1 pip3 install scipy
docker exec -i eoxserver_autotest_1 ${{ matrix.python_bin }} -m eoxserver.services.ows.wps.test_data_types
docker exec -i eoxserver_autotest_1 ${{ matrix.python_bin }} -m eoxserver.services.ows.wps.test_allowed_values
docker exec -i eoxserver_autotest_1 ${{ matrix.python_bin }} manage.py test --pythonpath=./eoxserver/ eoxserver.core -v2
docker exec -i eoxserver_autotest_1 ${{ matrix.python_bin }} manage.py test --pythonpath=./eoxserver/ eoxserver.backends -v2
docker exec -i eoxserver_autotest_1 ${{ matrix.python_bin }} manage.py test --pythonpath=./eoxserver/ eoxserver.services -v2
docker exec -i eoxserver_autotest_1 ${{ matrix.python_bin }} manage.py test --pythonpath=./eoxserver/ eoxserver.resources.coverages -v2
docker exec -i eoxserver_autotest_1 ${{ matrix.python_bin }} manage.py test autotest_services --tag wcs20 -v2
docker exec -i eoxserver_autotest_1 ${{ matrix.python_bin }} manage.py test autotest_services --tag wcs11 -v2
docker exec -i eoxserver_autotest_1 ${{ matrix.python_bin }} manage.py test autotest_services --tag wcs10 -v2
docker exec -i eoxserver_autotest_1 ${{ matrix.python_bin }} manage.py test autotest_services --tag wms -v2
docker exec -i eoxserver_autotest_1 ${{ matrix.python_bin }} manage.py test autotest_services --tag wps -v2
docker exec -i eoxserver_autotest_1 ${{ matrix.python_bin }} manage.py test autotest_services --tag opensearch -v2
- name: Upload logs and outputs of failed tests
uses: 'actions/upload-artifact@v2'
with:
name: logs ${{ matrix.python }} ${{ matrix.db }} ${{ matrix.django }}
path: |
autotest/autotest/logs/*.log
autotest/autotest/responses/*
retention-days: 5
if: failure()
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
EOxServer Open License
Version 1, 8 June 2011

Copyright (C) 2011 EOX IT Services GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the “Software”), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies
of this Software or works derived from this Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
EOxServer is a Python application and library for presenting Earth
Observation (EO) data and metadata.

![build](https://github.com/EOxServer/eoxserver/actions/workflows/ci.yml/badge.svg)
![build](https://github.com/EOxServer/eoxserver/actions/workflows/build.yml/badge.svg)
[![PyPi](https://badge.fury.io/py/EOxServer.svg)](https://pypi.org/project/EOxServer/)
[![ReadTheDocs](https://readthedocs.org/projects/eoxserver/badge/?version=master)](http://docs.eoxserver.org/en/master)

Expand Down
Loading

0 comments on commit 55c053c

Please sign in to comment.