feat: paralellize jobs #3
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
name: Tests | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10.x' | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
- name: Install dependencies | |
run: poetry install | |
- name: Build the project | |
run: | | |
poetry build | |
- name: Cache Poetry dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pypoetry | |
~/.venv | |
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry- | |
- name: Upload poetry virtual environment | |
uses: actions/upload-artifact@v3 | |
with: | |
name: poetry-env | |
path: ~/.venv | |
main_test: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download poetry virtual environment | |
uses: actions/download-artifact@v3 | |
with: | |
name: poetry-env | |
path: ~/.venv | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10.x' | |
- name: Run tests for file1 | |
env: | |
NVM_API_KEY: ${{ secrets.NVM_API_KEY }} | |
NVM_API_KEY2: ${{ secrets.NVM_API_KEY2 }} | |
run: | | |
poetry run pytest tests/main_test.py | |
protocol_test: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download poetry virtual environment | |
uses: actions/download-artifact@v3 | |
with: | |
name: poetry-env | |
path: ~/.venv | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10.x' | |
- name: Run tests for file2 | |
env: | |
NVM_API_KEY: ${{ secrets.NVM_API_KEY }} | |
NVM_API_KEY2: ${{ secrets.NVM_API_KEY2 }} | |
run: | | |
poetry run pytest tests/protocol_test.py |