|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - pre/* |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: Build |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - name: Checkout repository |
| 15 | + uses: actions/checkout@v3 |
| 16 | + with: |
| 17 | + fetch-depth: 0 |
| 18 | + |
| 19 | + - name: Set up Python |
| 20 | + uses: actions/setup-python@v5 |
| 21 | + with: |
| 22 | + python-version: '3.10' |
| 23 | + |
| 24 | + - name: Install Poetry |
| 25 | + run: pip install poetry |
| 26 | + |
| 27 | + - name: Install dependencies |
| 28 | + run: poetry install --no-interaction --no-ansi |
| 29 | + |
| 30 | + - name: Build the package |
| 31 | + run: poetry build |
| 32 | + |
| 33 | + test: |
| 34 | + name: Test |
| 35 | + runs-on: ubuntu-latest |
| 36 | + needs: build |
| 37 | + steps: |
| 38 | + - name: Checkout repository |
| 39 | + uses: actions/checkout@v3 |
| 40 | + |
| 41 | + - name: Set up Python |
| 42 | + uses: actions/setup-python@v5 |
| 43 | + with: |
| 44 | + python-version: '3.10' |
| 45 | + |
| 46 | + - name: Install Poetry |
| 47 | + run: pip install poetry |
| 48 | + |
| 49 | + - name: Install dependencies |
| 50 | + run: poetry install --no-interaction --no-ansi |
| 51 | + |
| 52 | + - name: Run Linting and Formatting Checks |
| 53 | + run: | |
| 54 | + poetry run ruff check langchain_scrapegraph tests |
| 55 | + poetry run black --check langchain_scrapegraph tests |
| 56 | + poetry run isort --check-only langchain_scrapegraph tests |
| 57 | +
|
| 58 | + # - name: Run Type Checking |
| 59 | + # run: poetry run mypy langchain_scrapegraph tests |
| 60 | + |
| 61 | + - name: Run Tests |
| 62 | + run: | |
| 63 | + poetry run pytest --disable-socket --allow-unix-socket --asyncio-mode=auto tests/unit_tests |
| 64 | + poetry run pytest --asyncio-mode=auto tests/integration_tests |
| 65 | +
|
| 66 | + # - name: Upload Coverage to Codecov |
| 67 | + # uses: codecov/codecov-action@v3 |
| 68 | + # with: |
| 69 | + # files: coverage.xml |
| 70 | + # fail_ci_if_error: false |
| 71 | + # token: ${{ secrets.CODECOV_TOKEN }} |
| 72 | + |
| 73 | + release: |
| 74 | + name: Release |
| 75 | + runs-on: ubuntu-latest |
| 76 | + needs: [build, test] |
| 77 | + if: | |
| 78 | + github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/pre/')) || |
| 79 | + github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged && |
| 80 | + (github.event.pull_request.base.ref == 'main' || startsWith(github.event.pull_request.base.ref, 'pre/')) |
| 81 | + permissions: |
| 82 | + contents: write |
| 83 | + issues: write |
| 84 | + pull-requests: write |
| 85 | + id-token: write |
| 86 | + steps: |
| 87 | + - name: Checkout repository |
| 88 | + uses: actions/checkout@v3 |
| 89 | + with: |
| 90 | + fetch-depth: 0 |
| 91 | + |
| 92 | + - name: Set up Node.js |
| 93 | + uses: actions/setup-node@v4 |
| 94 | + with: |
| 95 | + node-version: '20' |
| 96 | + |
| 97 | + - name: Set up Python |
| 98 | + uses: actions/setup-python@v5 |
| 99 | + with: |
| 100 | + python-version: '3.10' |
| 101 | + |
| 102 | + - name: Install Poetry |
| 103 | + run: pip install poetry |
| 104 | + |
| 105 | + - name: Install dependencies |
| 106 | + run: poetry install --no-interaction --no-ansi |
| 107 | + |
| 108 | + - name: Semantic Release |
| 109 | + uses: cycjimmy/semantic-release-action@v4.1.0 |
| 110 | + with: |
| 111 | + semantic_version: 23 |
| 112 | + extra_plugins: | |
| 113 | + semantic-release-pypi@3 |
| 114 | + @semantic-release/git |
| 115 | + @semantic-release/commit-analyzer@12 |
| 116 | + @semantic-release/release-notes-generator@13 |
| 117 | + @semantic-release/github@10 |
| 118 | + @semantic-release/changelog@6 |
| 119 | + conventional-changelog-conventionalcommits@7 |
| 120 | + env: |
| 121 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 122 | + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} |
0 commit comments