Skip to content

tests

tests #620

Workflow file for this run

# (C) Copyright 2020 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.
name: Build Windows
on:
workflow_dispatch: {}
release:
types: [created]
# repository_dispatch:
# types: [eccodes-updated, magics-updated]
push:
paths:
- 'scripts/common.sh'
- 'scripts/build-windows.sh'
- 'scripts/wheel-windows.sh'
- 'tools/copy-licences.py'
- 'tools/copy-dlls.py'
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
architecture: ["x64"]
defaults:
run:
shell: bash
name: Build on ${{ matrix.architecture }}
env:
WINARCH: ${{ matrix.architecture }}
steps:
- uses: actions/checkout@v2
- uses: seanmiddleditch/gha-setup-vsdevenv@master
with:
arch: ${{ matrix.architecture }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
architecture: ${{ matrix.architecture }}
- name: Apply mirror
if: false
run: |
import os
a = "repo.msys2.org"
b = "mirror.yandex.ru/mirrors/msys2"
for root, _, files in os.walk("c:/vcpkg"):
for f in files:
if f.endswith(".cmake"):
path = os.path.join(root, f)
with open(path) as f:
text = f.read()
changed = text.replace(a, b)
if text != changed:
print("CHANGED", path)
with open(path, "w") as f:
f.write(changed)
shell: python
- run: ./scripts/build-windows.sh
env:
WINARCH: ${{ matrix.architecture }}
################################################################
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7
architecture: ${{ matrix.architecture }}
- run: ./scripts/wheel-windows.sh 3.7
- uses: actions/upload-artifact@v2
name: Upload wheel 3.7
with:
name: wheel-windows-3.7-${{ matrix.architecture }}
path: wheelhouse/*.whl
################################################################
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
architecture: ${{ matrix.architecture }}
- run: ./scripts/wheel-windows.sh 3.8
- uses: actions/upload-artifact@v2
name: Upload wheel 3.8
with:
name: wheel-windows-3.8-${{ matrix.architecture }}
path: wheelhouse/*.whl
################################################################
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
architecture: ${{ matrix.architecture }}
- run: ./scripts/wheel-windows.sh 3.9
- uses: actions/upload-artifact@v2
name: Upload wheel 3.9
with:
name: wheel-windows-3.9-${{ matrix.architecture }}
path: wheelhouse/*.whl
################################################################
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
architecture: ${{ matrix.architecture }}
- run: ./scripts/wheel-windows.sh "3.10"
- uses: actions/upload-artifact@v2
name: Upload wheel 3.10
with:
name: wheel-windows-3.10-${{ matrix.architecture }}
path: wheelhouse/*.whl
################################################################
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
architecture: ${{ matrix.architecture }}
- run: ./scripts/wheel-windows.sh "3.11"
- uses: actions/upload-artifact@v2
name: Upload wheel 3.11
with:
name: wheel-windows-3.11-${{ matrix.architecture }}
path: wheelhouse/*.whl
test:
needs: build
runs-on: windows-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
architecture: ["x64"]
defaults:
run:
shell: bash
name: Test with Python ${{ matrix.python-version }} ${{ matrix.architecture }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- uses: actions/download-artifact@v2
with:
name: wheel-windows-${{ matrix.python-version }}-${{ matrix.architecture }}
- run: pip install *.whl
- run: pip install -r tests/requirements.txt
- run: pip freeze
- name: Get some data
run: |
curl -L https://get.ecmwf.int/repository/test-data/metview/gallery/2m_temperature.grib -o data.grib
curl -L https://github.com/ecmwf/climetlab/raw/main/docs/examples/test.grib -o climetlab.grib
curl -L https://github.com/ecmwf/climetlab/raw/main/docs/examples/test.nc -o climetlab.nc
ls -l
working-directory: tests
- run: pytest --verbose -s
working-directory: tests
timeout-minutes: 2
- uses: actions/upload-artifact@v2
with:
name: tests-windows-${{ matrix.python-version }}-${{ matrix.architecture }}
path: tests/*.png
deploy:
if: ${{ github.event_name == 'release' }}
needs: [test, build]
name: Deploy wheel ${{ matrix.python-version }} ${{ matrix.architecture }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
architecture: ["x64"]
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: pip install twine
- uses: actions/download-artifact@v2
with:
name: wheel-windows-${{ matrix.python-version }}-${{ matrix.architecture }}
- run: twine upload *.whl
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
notify:
if: ${{ github.event_name == 'release' }}
# This is done here because the windows build is the slowest
name: Notify universal
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: mvasigh/dispatch-action@main
with:
token: ${{ secrets.NOTIFY_ECMWFLIBS }}
repo: ecmwflibs
owner: ecmwf
event_type: ecmwflibs-windows-uploaded