|
| 1 | +name: main |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + |
| 8 | +permissions: |
| 9 | + id-token: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + sdist: |
| 13 | + name: Build source distribution |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + submodules: "recursive" |
| 20 | + - uses: actions/setup-python@v5 |
| 21 | + - name: Prep repo |
| 22 | + run: | |
| 23 | + pip install -r requirements.txt |
| 24 | + make |
| 25 | + - name: Build sdist |
| 26 | + run: python -m build --sdist |
| 27 | + - uses: actions/upload-artifact@v4 |
| 28 | + with: |
| 29 | + name: sdist |
| 30 | + path: dist/*.tar.gz |
| 31 | + |
| 32 | + publish-testpypi: |
| 33 | + name: Publish to testpypi |
| 34 | + needs: [sdist] |
| 35 | + runs-on: ubuntu-latest |
| 36 | + environment: |
| 37 | + name: testpypi |
| 38 | + url: https://test.pypi.org/legacy/ |
| 39 | + permissions: |
| 40 | + id-token: write |
| 41 | + steps: |
| 42 | + - uses: actions/download-artifact@v4 |
| 43 | + with: |
| 44 | + name: sdist |
| 45 | + path: dist |
| 46 | + |
| 47 | + - name: List files |
| 48 | + run: ls -la dist/ |
| 49 | + |
| 50 | + - name: Publish package distributions to testpypi |
| 51 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 52 | + with: |
| 53 | + repository-url: https://test.pypi.org/legacy/ |
| 54 | + verbose: true |
| 55 | + |
| 56 | + validate-test-pypi-release: |
| 57 | + runs-on: ubuntu-latest |
| 58 | + needs: publish-testpypi |
| 59 | + steps: |
| 60 | + - name: wait for package to be available |
| 61 | + run: sleep 30 |
| 62 | + |
| 63 | + - name: install test pypi release |
| 64 | + run: | |
| 65 | + # Get version from GitHub ref (removes 'refs/tags/v' prefix) |
| 66 | + VERSION=${GITHUB_REF_NAME#v} |
| 67 | + pip install --extra-index-url https://test.pypi.org/simple/ science-synapse==$VERSION |
| 68 | +
|
| 69 | + - name: validate |
| 70 | + run: | |
| 71 | + # Run Help |
| 72 | + synapsectl --help |
| 73 | +
|
| 74 | + # Run Simulator |
| 75 | + synapse-sim --iface-ip 127.0.0.1 --rpc-port 50051 & |
| 76 | + sleep 2 |
| 77 | +
|
| 78 | + synapsectl -u 127.0.0.1:50051 info |
| 79 | +
|
| 80 | + # Kill Simulator |
| 81 | + kill $(jobs -p) |
| 82 | +
|
| 83 | + publish-pypi: |
| 84 | + name: Publish to pypi |
| 85 | + needs: [validate-test-pypi-release] |
| 86 | + runs-on: ubuntu-latest |
| 87 | + environment: |
| 88 | + name: pypi |
| 89 | + url: https://pypi.org/p/science-synapse/ |
| 90 | + permissions: |
| 91 | + id-token: write |
| 92 | + steps: |
| 93 | + - uses: actions/download-artifact@v4 |
| 94 | + with: |
| 95 | + name: sdist |
| 96 | + path: dist |
| 97 | + |
| 98 | + - name: Publish package distributions to pypi |
| 99 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 100 | + with: |
| 101 | + verbose: true |
0 commit comments