|
| 1 | +name: Package and Publish |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + python-tests: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + python-version: ["3.10", "3.11", "3.12"] |
| 14 | + |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v3 |
| 17 | + |
| 18 | + - name: Set up Python ${{ matrix.python-version }} |
| 19 | + uses: actions/setup-python@v3 |
| 20 | + with: |
| 21 | + python-version: ${{ matrix.python-version }} |
| 22 | + |
| 23 | + - name: Install dependencies |
| 24 | + run: | |
| 25 | + python -m pip install --upgrade pip |
| 26 | + pip install .[dev] |
| 27 | + |
| 28 | + - name: Lint with flake8 |
| 29 | + run: | |
| 30 | + # stop the build if there are Python syntax errors or undefined names |
| 31 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 32 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 33 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 34 | + |
| 35 | + - name: Test with pytest |
| 36 | + run: | |
| 37 | + pytest --cov=chartlets |
| 38 | + |
| 39 | + - name: Upload coverage reports to Codecov |
| 40 | + uses: codecov/codecov-action@v3 |
| 41 | + env: |
| 42 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 43 | + |
| 44 | + PyPi-Deploy: |
| 45 | + name: Publish Python Package to PyPI |
| 46 | + runs-on: ubuntu-latest |
| 47 | + needs: python-tests |
| 48 | + |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v4 |
| 51 | + |
| 52 | + - name: Set up Python |
| 53 | + uses: actions/setup-python@v5 |
| 54 | + with: |
| 55 | + python-version: '3.x' |
| 56 | + |
| 57 | + - name: Install dependencies |
| 58 | + run: | |
| 59 | + python -m pip install --upgrade pip |
| 60 | + pip install build |
| 61 | + |
| 62 | + - name: Build package |
| 63 | + run: | |
| 64 | + python -m build |
| 65 | + |
| 66 | + - name: Publish to PyPI |
| 67 | + run: | |
| 68 | + pip install twine |
| 69 | + python -m twine upload --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} dist/* |
| 70 | +
|
| 71 | + npm-tests: |
| 72 | + runs-on: ubuntu-latest |
| 73 | + |
| 74 | + strategy: |
| 75 | + matrix: |
| 76 | + node-version: [16.x, 18.x, 20.x] |
| 77 | + # See supported Node.js release schedule at |
| 78 | + # https://nodejs.org/en/about/releases/ |
| 79 | + |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@v3 |
| 82 | + - name: Use Node.js ${{ matrix.node-version }} |
| 83 | + uses: actions/setup-node@v3 |
| 84 | + with: |
| 85 | + node-version: ${{ matrix.node-version }} |
| 86 | + cache: 'npm' |
| 87 | + - run: npm ci |
| 88 | + - run: npm run lint |
| 89 | + - run: npm run build |
| 90 | + - run: npm run test |
| 91 | + |
| 92 | + npm-Deploy: |
| 93 | + name: Publish TS-React Package to npmjs |
| 94 | + runs-on: ubuntu-latest |
| 95 | + needs: npm-tests |
| 96 | + |
| 97 | + steps: |
| 98 | + - uses: actions/checkout@v4 |
| 99 | + |
| 100 | + - name: Set up Node.js |
| 101 | + uses: actions/setup-node@v4 |
| 102 | + with: |
| 103 | + node-version: '18.x' |
| 104 | + registry-url: 'https://registry.npmjs.org' |
| 105 | + - run: npm ci |
| 106 | + - run: npm run build |
| 107 | + - run: npm publish --access public |
| 108 | + env: |
| 109 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments