Update main.yml #30
This file contains hidden or 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: CI for Cool-Graph | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| release: | |
| types: [published] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v2 | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.8 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| if [ -f "requirements.txt" ]; then | |
| pip install -r requirements.txt | |
| else | |
| echo "requirements.txt not found, skipping dependency installation." | |
| fi | |
| pip install wheel | |
| - name: Run tests | |
| run: | | |
| pytest | |
| continue-on-error: true | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v2 | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.8 | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install setuptools wheel | |
| - name: Build package | |
| run: | | |
| python setup.py sdist bdist_wheel | |
| - name: Publish to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: | | |
| python -m twine upload dist/* |