Skip to content

Commit

Permalink
run-tests.sh and basic GH actions added
Browse files Browse the repository at this point in the history
  • Loading branch information
thlava-cesnet committed Sep 2, 2024
1 parent 8766793 commit 8d4e21c
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build

on:
workflow_call:
inputs:
oarepo:
description: OARepo version (11, 12, ...)
required: true
default: 12
type: string

env:
OAREPO_VERSION: ${{ inputs.oarepo }}

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:

- name: Show oarepo version
run: |
echo "OAREPO_VERSION: >>>$OAREPO_VERSION<<<"
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Cache pip
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
#- name: Runs Opensearch
# uses: ankane/setup-opensearch@v1
# with:
# opensearch-version: 2
# plugins: analysis-icu

#- name: Start Redis
# uses: supercharge/[email protected]
# with:
# redis-version: ${{ matrix.redis-version }}


- name: Run tests
run: |
./run-tests.sh
- name: Freeze packages
run: |
pip freeze > requirements.txt
- name: Build package to publish
run: |
pip install -U setuptools pip wheel
python setup.py sdist bdist_wheel
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist

- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: requirements.txt
path: requirements.txt
14 changes: 14 additions & 0 deletions .github/workflows/manual.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Manual test

on:
workflow_dispatch:
inputs:
oarepo:
description: OARepo version (11, 12, ...)
required: true
default: 12
jobs:
build:
uses: ./.github/workflows/build.yaml
with:
oarepo: ${{ github.event.inputs.oarepo }}
21 changes: 21 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -e

OAREPO_VERSION="${OAREPO_VERSION:-12}"

VENV=".venv"

if test -d $VENV ; then
rm -rf $VENV
fi

python3 -m venv $VENV
. $VENV/bin/activate
pip install -U setuptools pip wheel pytest

#echo "Installing oarepo version $OAREPO_VERSION"
#pip install "oarepo==${OAREPO_VERSION}.*"
pip install -e ".[tests]"

pytest -v -x tests

0 comments on commit 8d4e21c

Please sign in to comment.