Skip to content

expand introduction #1063

expand introduction

expand introduction #1063

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
pull_request:
branches: [master]
env:
ROOT_DIR: ${{github.workspace}}/data
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
build-method: ["manual", "docker"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
shell: bash
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --max-complexity=10 --max-line-length=127 --statistics
- name: Install package
shell: bash
run: |
pip install -e .
- name: Run unit tests
shell: bash
run: |
pytest
- name: Start HSDS (Manual)
shell: bash
if: ${{matrix.build-method == 'manual'}}
env:
ADMIN_PASSWORD: admin
ADMIN_USERNAME: admin
USER_NAME: test_user1
USER_PASSWORD: test
USER2_NAME: test_user2
USER2_PASSWORD: test
HSDS_ENDPOINT: http://127.0.0.1:5101
BUCKET_NAME: hsdstest
LOG_LEVEL: DEBUG
run: |
cp admin/config/groups.default admin/config/groups.txt
cp admin/config/passwd.default admin/config/passwd.txt
hsds --root_dir data --host localhost --port 5101 --password_file admin/config/passwd.txt --logfile hs.log --loglevel DEBUG --config_dir=admin/config --count=4 &
- name: Start HSDS (Docker)
shell: bash
if: ${{matrix.build-method == 'docker' && matrix.os != 'windows-latest'}}
env:
ADMIN_PASSWORD: admin
ADMIN_USERNAME: admin
USER_NAME: test_user1
USER_PASSWORD: test
USER2_NAME: test_user2
USER2_PASSWORD: test
HSDS_ENDPOINT: http://127.0.0.1:5101
BUCKET_NAME: hsdstest
LOG_LEVEL: DEBUG
run: |
cp admin/config/groups.default admin/config/groups.txt
cp admin/config/passwd.default admin/config/passwd.txt
./build.sh --nolint
./runall.sh
- name: Wait for node startup
shell: bash
run: |
sleep 45
- name: Run HSDS tests
if: ${{!(matrix.build-method == 'docker' && matrix.os == 'windows-latest')}}
id: hsds-tests
shell: bash
env:
ADMIN_PASSWORD: admin
ADMIN_USERNAME: admin
USER_NAME: test_user1
USER_PASSWORD: test
USER2_NAME: test_user2
USER2_PASSWORD: test
BUCKET_NAME: hsdstest
LOG_LEVEL: DEBUG
run: |
python testall.py
- name: Show HSDS Logs on Fail (Docker)
# Only run if the whole workflow failed due to HSDS tests
if: ${{failure() && steps.hsds-tests.outcome == 'failure' && (matrix.build-method == 'docker' && matrix.os != 'windows-latest')}}
run: |
docker logs hsds-sn-1 >&1
docker logs hsds-dn-1 >&1
docker logs hsds-dn-2 >&1
docker logs hsds-dn-3 >&1
docker logs hsds-dn-4 >&1
- name: Show HSDS Logs on Fail (Manual)
# Only run if the whole workflow failed due to HSDS tests
if: ${{failure() && steps.hsds-tests.outcome == 'failure' && (matrix.build-method == 'manual')}}
run: |
cat hs.log
- name: Checkout h5pyd
if: ${{ ( matrix.os != 'windows-latest' ) }}
uses: actions/checkout@v4
with:
repository: HDFGroup/h5pyd
path: ${{github.workspace}}/h5pyd
- name: Install h5pyd
if: ${{ ( matrix.os != 'windows-latest' ) }}
working-directory: ${{github.workspace}}/h5pyd
run: |
pip install . -v
- name: Create h5pyd test folder
if: ${{ ( matrix.os != 'windows-latest' ) }}
working-directory: ${{github.workspace}}/h5pyd
env:
HS_USERNAME: test_user1
HS_PASSWORD: test
TEST2_USERNAME: test_user1
TEST2_PASSWORD: test
H5PYD_TEST_FOLDER: /home/test_user1/h5pyd_tests/
HS_ENDPOINT: http://127.0.0.1:5101
run: |
hstouch -e $HS_ENDPOINT /home/test_user1/h5pyd_tests/
- name: Run h5pyd tests
if: ${{ ( matrix.os != 'windows-latest' ) }}
working-directory: ${{github.workspace}}/h5pyd
env:
HS_USERNAME: test_user1
HS_PASSWORD: test
TEST2_USERNAME: test_user1
TEST2_PASSWORD: test
H5PYD_TEST_FOLDER: /home/test_user1/h5pyd_tests/
HS_ENDPOINT: http://127.0.0.1:5101
run: |
python testall.py
- name: Shut down Docker
if: ${{matrix.build-method == 'docker' && matrix.os != 'windows-latest'}}
run: |
./stopall.sh
build-and-test-socket:
env:
ADMIN_PASSWORD: admin
ADMIN_USERNAME: admin
USER_NAME: test_user1
USER_PASSWORD: test
USER2_NAME: test_user2
USER2_PASSWORD: test
HSDS_USERNAME: test_user1
HSDS_PASSWORD: test
HSDS_PATH: /home/test_user1/
HDF5_API_TEST_PATH_PREFIX: /home/test_user1/
HSDS_ENDPOINT: http+unix://%2Ftmp%2Fhs%2Fsn_1.sock
HDF5_VOL_CONNECTOR: REST
ROOT_DIR: ${{github.workspace}}/hsdsdata
BUCKET_NAME: hsdstest
name: Test HSDS with socket
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install HSDS dependencies
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install HSDS package
shell: bash
run: |
pip install -e .
# Requests 2.32.0 breaks requests-unixsocket, used by HSDS for socket connections
# - name: Fix requests version
# run: |
# pip install requests==2.31.0
- name: Run HSDS unit tests
shell: bash
run: |
pytest
- name: Start HSDS
run: |
mkdir ${{github.workspace}}/hsdsdata
mkdir ${{github.workspace}}/hsdsdata/hsdstest
cp admin/config/groups.default admin/config/groups.txt
cp admin/config/passwd.default admin/config/passwd.txt
ROOT_DIR=${{github.workspace}}/hsdsdata ./runall.sh --no-docker 1 &
sleep 10
- name: Test HSDS setup
run: |
python tests/integ/setup_test.py
- name: Test HSDS
run : |
python testall.py