Major Refactor + E2E test for webpage (#4) #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: https://github.com/stanford-crfm/helm/blob/main/.github/workflows/test.yml | |
name: Test | |
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- 'experimental/**' | |
pull_request: | |
paths-ignore: | |
- 'experimental/**' | |
jobs: | |
install: | |
name: Install dependencies and perform small run | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: pip-${{ hashFiles('requirements.txt') }}-${{ matrix.python-version }} | |
restore-keys: | | |
pip- | |
# Installs dependencies and performs static code checks | |
- name: Install pip dependencies | |
run: python3 -m pip install virtualenv && python3 -m virtualenv -p python3 venv && source venv/bin/activate && pip install -r requirements.txt && pip install --upgrade pip && pip install -e ".[all,dev]" && pip check | |
- name: Install additional dependencies | |
run: source venv/bin/activate && sudo sh ./install.sh | |
- name: Run static code checks | |
run: source venv/bin/activate && ./pre-commit.sh | |
- name: Collect 10 webpages | |
run: source venv/bin/activate && image2structure-collect --category html --num-instances 10 webpage --timeout 30 --port 4000 --max_size_kb 100 | |
test: | |
name: Run all tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10"] | |
steps: | |
- name: Clear free space | |
run: | | |
sudo rm -rf /opt/ghc | |
df -h | |
- uses: actions/checkout@v2 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
pip- | |
# Installs dependencies and performs static code checks | |
- name: Install pip dependencies | |
run: python3 -m pip install virtualenv && python3 -m virtualenv -p python3 venv && source venv/bin/activate && pip install -r requirements.txt && pip install --upgrade pip && pip install -e ".[all,dev]" | |
- name: Install additional dependencies | |
run: source venv/bin/activate && sudo sh ./install.sh | |
- name: Run tests | |
run: source venv/bin/activate && pytest --durations=20 | |
env: | |
TOKEN_GITHUB: ${{ secrets.TOKEN_GITHUB }} | |
TEST: ${{ matrix.test }} | |
VERSION: ${{ github.head_ref || 'main' }} |