Skip to content

CI pipeline triggered by @constantinius #604

CI pipeline triggered by @constantinius

CI pipeline triggered by @constantinius #604

Workflow file for this run

name: CI
run-name: CI pipeline triggered by @${{ github.actor }}
on:
push:
paths:
- '.github/workflows/**'
- 'setup.py'
- 'setup.cfg'
- 'MANIFEST.in'
- 'pyproject.toml'
- 'eoxserver/**'
- 'autotest/**'
jobs:
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the eoxserver docker image
run: |
docker pull eoxa/eoxserver:latest || true
docker build --cache-from eoxa/eoxserver:latest -t eoxserver .
docker save eoxserver | gzip > eoxserver.tar.gz
- name: Save image to cache
uses: actions/cache/save@v3
with:
path: eoxserver.tar.gz
key: eoxserver.tar.gz-${{ github.run_id }}-${{ github.run_number }}
- name: Slack Notify
uses: 8398a7/action-slack@v3.8.0
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: failure()
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
command:
- "-m eoxserver.services.ows.wps.test_data_types"
- "-m eoxserver.services.ows.wps.test_allowed_values"
- "manage.py test --pythonpath=./eoxserver/ eoxserver.core -v2"
- "manage.py test --pythonpath=./eoxserver/ eoxserver.backends -v2"
- "manage.py test --pythonpath=./eoxserver/ eoxserver.services -v2"
- "manage.py test --pythonpath=./eoxserver/ eoxserver.resources.coverages -v2"
- "manage.py test autotest_services --tag wcs20 -v2"
- "manage.py test autotest_services --tag wcs11 -v2"
- "manage.py test autotest_services --tag wcs10 -v2"
- "manage.py test autotest_services --tag wms -v2"
- "manage.py test autotest_services --tag wps -v2"
- "manage.py test autotest_services --tag opensearch -v2"
needs: build-docker
steps:
- uses: actions/checkout@v3
- uses: actions/cache/restore@v3
id: cache
with:
path: eoxserver.tar.gz
key: eoxserver.tar.gz-${{ github.run_id }}-${{ github.run_number }}
- name: Import docker image and name it autotest
run: |
docker load --input eoxserver.tar.gz
docker tag eoxserver:latest eoxserver:autotest
- name: Start the services and install test dependencies
run: |
echo "DB=spatialite" >> sample.env
docker-compose config
docker-compose up -d
docker-compose ps
docker exec -i eoxserver_autotest_1 pip3 install scipy
- name: Run the tests
env:
COMPOSE_INTERACTIVE_NO_CLI: 1
run: |
docker exec -i eoxserver_autotest_1 python3 ${{ matrix.command }}
- name: Upload logs and outputs of failed tests
uses: 'actions/upload-artifact@v2'
with:
name: logs ${{ matrix.command }}
path: |
autotest/autotest/logs/*.log
autotest/autotest/responses/*
retention-days: 5
if: failure()
- name: Slack Notify
uses: 8398a7/action-slack@v3.8.0
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: failure()
publish-docker:
runs-on: ubuntu-latest
needs: test
if: contains(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- uses: actions/cache/restore@v3
id: cache
with:
path: eoxserver.tar.gz
key: eoxserver.tar.gz-${{ github.run_id }}-${{ github.run_number }}
- name: Branch name
id: branch_name
run: |
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: Import docker image
run: |
docker load --input eoxserver.tar.gz
- name: Tag docker latest image
run: |
docker tag eoxserver eoxa/eoxserver:latest
if: github.ref == 'refs/heads/master'
- name: Tag docker release image
run: |
docker tag eoxserver eoxa/eoxserver:${{ steps.branch_name.outputs.SOURCE_TAG }}
if: 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()
- name: Slack Notify
uses: 8398a7/action-slack@v3.8.0
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: failure()
publish-pypi:
runs-on: ubuntu-latest
needs: test
if: contains(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Branch name
id: branch_name
run: |
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
sudo apt-get install -y gdal-bin
python setup.py sdist bdist_wheel
- uses: actions/upload-artifact@v3
with:
name: eoxserver-dist
path: ./dist/
retention-days: 2
- name: Push package to pypi
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
if: success()
- name: Slack Notify
uses: 8398a7/action-slack@v3.8.0
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: failure()
publish-github:
runs-on: ubuntu-latest
needs: publish-pypi
if: contains(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3.0.1
with:
name: eoxserver-dist
- name: Branch name
id: branch_name
run: |
echo ::set-output name=SOURCE_TAG::$([[ $GITHUB_REF == refs/tags/* ]] && echo ${GITHUB_REF#refs/tags/} || echo "")
echo ::set-output name=WHEEL_FILE::$(ls *.whl)
echo ::set-output name=SRC_DIST_FILE::$(ls *.tar.gz)
- name: Draft 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
- 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.branch_name.outputs.WHEEL_FILE }}
asset_name: ${{ steps.branch_name.outputs.WHEEL_FILE }}
asset_content_type: application/x-wheel+zip
if: success()
- 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.branch_name.outputs.SRC_DIST_FILE }}
asset_name: ${{ steps.branch_name.outputs.SRC_DIST_FILE }}
asset_content_type: application/tar+gzip
if: success()
- name: Slack Notify
uses: 8398a7/action-slack@v3.8.0
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: failure()
notify:
runs-on: ubuntu-20.04
needs: [publish-github, publish-docker]
steps:
- name: Slack Notify
uses: 8398a7/action-slack@v3.8.0
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
custom_payload: |
{
attachments: [{
text: `Publish tag finished`,
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()