Skip to content

Investigate windows build #1076

Investigate windows build

Investigate windows build #1076

Workflow file for this run

name: testing
on:
push:
branches:
- main
- 'version-**'
tags: "*"
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build-test-cmake:
name: CMake
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest'] #['ubuntu-latest', 'macos-13', 'macos-latest']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
# required for `git describe --tags` to work
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python3 -m pip install "conan<2"
- name: Build
run: |
python3 -m pip install -r requirements.txt
mkdir cmake-build
cmake -S . -B cmake-build -DBUILD_TESTS=ON -DRST_DOC=ON
cmake --build cmake-build
- name: Run tests
run: |
cd cmake-build
export DYLD_LIBRARY_PATH=$PWD/lib
ctest --output-on-failure
env:
RD_SKIP_SIGNAL: absolutely
ERT_SHOW_BACKTRACE: yes please!
build-test-wheel:
name: Python
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'windows-2019'] #['ubuntu-latest', 'macos-13', 'macos-latest', 'windows-2019']
python: ['3.11'] #['3.8', '3.9', '3.10', '3.11', '3.12']
exclude:
- os: macos-latest
python: '3.8'
- os: macos-latest
python: '3.9'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
# required for `git describe --tags` to work
fetch-depth: 0
- name: Build Linux Wheel
if: matrix.os == 'ubuntu-latest'
uses: docker://quay.io/pypa/manylinux2014_x86_64
with:
entrypoint: /github/workspace/ci/github/build_linux_wheel.sh
args: ${{ matrix.python }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Build macOS Wheel
if: runner.os == 'macOS'
run: pip wheel . --no-deps -w dist
- name: Build Windows Wheel
if: runner.os == 'windows'
run: |
python.exe -m pip install -U pip delvewheel
python.exe -m pip wheel . --no-deps -w dist
- name: Upload wheel as artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }} Python ${{ matrix.python }} wheel
path: dist/*
- name: Install for non Windows
if: runner.os != 'windows'
run: pip install dist/*
- name: Install for Windows
if: runner.os == 'windows'
run: |
pip install (get-item .\dist\*)
python -c "import resdata"
- name: Run Python tests non Windows
if: runner.os != 'windows'
run: |
# Runs tests on installed distribution from an empty directory
python -m pip install pytest
# pytest adds every directory up-to and including python/ into sys.path,
# meaning that "import resdata" will import python/resdata and not the installed
# one. This doesn't work because the resdata.so library only exists in
# site-packages, so we copy directories required by the tests out into its
# own temporary directory.
mkdir test-run; cd test-run
mkdir -p {.git,python}
ln -s {..,$PWD}/bin
ln -s {..,$PWD}/lib
ln -s {..,$PWD}/test-data
cp -R {..,$PWD}/python/tests
# Env vars
export RD_SKIP_SIGNAL=1
export ERT_SHOW_BACKTRACE=1
# Run tests
python -m pytest python/tests
- name: Run Python tests Windows
if: runner.os == 'windows'
run: |
# Install pytest
python -m pip install pytest
# Create a new directory for the tests to ensure we import the installed package
New-Item -ItemType Directory -Force -Path test-run
cd test-run
Copy-Item -Recurse ..\bin -Destination .\bin
Copy-Item -Recurse ..\lib -Destination .\lib
Copy-Item -Recurse ..\test-data -Destination .\test-data
Copy-Item -Recurse ..\python\tests -Destination .\python\tests
dir
dir python
dir python\tests
# Set environment variables
$env:RD_SKIP_SIGNAL = "1"
$env:ERT_SHOW_BACKTRACE = "1"
# Run the tests
python -m pytest python\tests
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [build-test-wheel]
# If this is a tagged release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- name: Get wheels
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move to dist/
run: |
mkdir dist
find artifacts -name "*.whl" -exec mv '{}' dist/ \;
- name: Publish to PyPI
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_TOKEN_RESDATA }}
skip-existing: true