Add pagination to Monte Carlo getMonitors call (#1050) #746
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: CD | |
env: | |
PYTHON_VERSION: 3.9 | |
POETRY_VERSION: 1.8.3 | |
NODE_VERSION: 20 | |
DOCKER_IMAGE: metaphordata/connectors | |
permissions: | |
contents: read | |
# Run this build workflow after a new PR is merged | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
version: | |
name: Get version | |
runs-on: ubuntu-latest | |
outputs: | |
full: ${{ steps.get-version.outputs.full }} | |
major: ${{ steps.get-version.outputs.major }} | |
minor: ${{ steps.get-version.outputs.minor }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- run: npm install toml | |
- id: get-version | |
name: Get version | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const fs = require('fs'); | |
const toml = require('toml'); | |
const pyproject = toml.parse(fs.readFileSync('pyproject.toml')); | |
const version = pyproject.tool.poetry.version; | |
core.setOutput('full', version); | |
core.setOutput('major', version.split('.').slice(0, 1).join('.')); | |
core.setOutput('minor', version.split('.').slice(0, 2).join('.')); | |
publish-coverage: | |
name: Publish coverage stats | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Setup Poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- name: Setup dev libs | |
run: | | |
sudo apt-get install libsasl2-dev | |
- name: Test | |
run: | | |
poetry install -E all | |
poetry run coverage run --source=metaphor -m pytest | |
poetry run coverage xml | |
- name: Codecov | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
pypi: | |
name: Publish to PyPI | |
runs-on: ubuntu-latest | |
needs: version | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Setup Poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- name: Publish to PyPI | |
run: > | |
poetry publish --build --skip-existing | |
-u ${{ secrets.PYPI_USERNAME }} | |
-p ${{ secrets.PYPI_PASSWORD }} | |
- name: Create tag | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
const version = '${{ needs.version.outputs.full }}'; | |
core.notice(`Tagging ${{ github.sha }} as ${version}`); | |
try { | |
await github.rest.git.deleteRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: `tags/${ version }` | |
}); | |
} catch (err) {} | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: `refs/tags/${ version }`, | |
sha: "${{ github.sha }}" | |
}) | |
docker: | |
name: Publish to Docker | |
runs-on: ubuntu-latest | |
needs: version | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Check existing version | |
id: check | |
continue-on-error: true | |
run: docker manifest inspect ${{ env.DOCKER_IMAGE }}:${{ needs.version.outputs.full }} > /dev/null | |
- name: Build Docker image | |
if: steps.check.outcome == 'failure' | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: | | |
${{ env.DOCKER_IMAGE }}:latest | |
${{ env.DOCKER_IMAGE }}:${{ needs.version.outputs.full }} | |
${{ env.DOCKER_IMAGE }}:${{ needs.version.outputs.major }} | |
${{ env.DOCKER_IMAGE }}:${{ needs.version.outputs.minor }} |