diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..dcc2599 --- /dev/null +++ b/.github/workflows/build.yaml @@ -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/redis-github-action@1.8.0 + # 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 diff --git a/.github/workflows/manual.yaml b/.github/workflows/manual.yaml new file mode 100644 index 0000000..ce776f0 --- /dev/null +++ b/.github/workflows/manual.yaml @@ -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 }} diff --git a/run-tests.sh b/run-tests.sh new file mode 100755 index 0000000..3e03281 --- /dev/null +++ b/run-tests.sh @@ -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