Skip to content

[Feature Update] Optional raw text support #949

[Feature Update] Optional raw text support

[Feature Update] Optional raw text support #949

Workflow file for this run

name: Pytest
on: [pull_request, workflow_dispatch]
jobs:
build:
runs-on: self-hosted
strategy:
matrix:
python-version: ["3.7"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -e .
pip install pyyaml
- name: Get changed files using defaults
id: changed-files
uses: tj-actions/changed-files@v23.1
- name: List all changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_and_modified_files }}; do
echo "$file was changed"
done
- name: Test with pytest, if triggered by PR
run: |
if ${{ github.event_name == 'pull_request' }}
then
dataset_list=()
for path in ${{ steps.changed-files.outputs.all_changed_and_modified_files }}; do
dir="$(dirname "${path}")" ;
if [ ! -d "$dir" ]; then
echo "$dir doesn't exist, continue"
continue;
fi
dataset=$(echo $path | grep "datasets" | sed -r 's/datasets\/([_a-zA-Z0-9-]+)\/.*/\1/')
if [ -z "$dataset" ]; then continue; fi
if [[ ! " ${dataset_list[*]} " =~ " ${dataset} " ]]; then
echo "add dataset: $dataset"
dataset_list+=($dataset)
fi
done
echo "datasets list is ${dataset_list[*]}"
mkdir temp
echo "${dataset_list[*]}" > temp/changed_datasets
python tests/preprocess.py
pytest tests/
fi
- name: Test all datasets with pytest, if triggered by workflow_dispatch
run: |
if ${{ github.event_name == 'workflow_dispatch' }}
then
python tests/preprocess.py
pytest tests/
fi