Skip to content

feat: tweak piecewise-linear fragment (#132) #162

feat: tweak piecewise-linear fragment (#132)

feat: tweak piecewise-linear fragment (#132) #162

Workflow file for this run

name: CI
on:
push:
branches:
- main
paths-ignore:
- '**.md'
jobs:
test:
name: Test and maybe tag
timeout-minutes: 5
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_DB: default_db
POSTGRES_USER: default_user
POSTGRES_PASSWORD: default_pass
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
server:
image: opvious/api-server
env:
DB_URL: postgres://default_user:default_pass@postgres/default_db
OPVIOUS_API_IMAGE_EULA: accepted
REDIS_URL: redis://redis
STATIC_TOKENS: test@opvious.io=testing
ports:
- 8080:8080
env:
OPVIOUS_ENDPOINT: http://localhost:8080
OPVIOUS_TOKEN: static:testing
steps:
- name: Check out
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Setup poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: '1.2.2'
- name: Extract version
id: extract-version
run: |
PACKAGE_VERSION="$(./scripts/version.sh show)"
echo "::set-output name=version::$PACKAGE_VERSION"
- name: Install dependencies
run: poetry install --all-extras
- name: Lint
run: |
poetry run black . --check
poetry run flake8
poetry run mypy .
- name: Register specifications
run: ./scripts/specifications.sh register
- name: Test
run: poetry run pytest
- name: Check if tag exists
uses: mukunku/tag-exists-action@v1.1.0
id: check-version
with:
tag: v${{ steps.extract-version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish
if: steps.check-version.outputs.exists == 'false'
run: poetry publish --build
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
- name: Create tag
if: steps.check-version.outputs.exists == 'false'
uses: pkgdeps/git-tag-action@v2
with:
git_commit_sha: ${{ github.sha }}
git_tag_prefix: v
github_repo: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ steps.extract-version.outputs.version }}