Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tags to docker image with release-please #88

Merged
merged 9 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Build and push docker image

on:
push:
branches:
- main
release:
types:
- published
workflow_dispatch:

jobs:
build-and-push:
Expand All @@ -20,6 +21,7 @@ jobs:
- name: install poetry
run: |
python -m pip install --no-cache-dir poetry==1.8 supervisor
poetry self add "poetry-dynamic-versioning[plugin]"

- name: set up docker
run: |
Expand All @@ -39,9 +41,10 @@ jobs:
run: make build-wheel

- name: Build and push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
ghcr.io/${{ github.repository }}:latest
15 changes: 15 additions & 0 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Ensure all PRs have conventional commit titles
on:
pull_request:
types:
- edited
- opened
- synchronize
- reopened

jobs:
conventional_commit_title:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chanzuckerberg/github-actions/.github/actions/conventional-commits@main
22 changes: 22 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Release Please

on:
push:
branches:
- main

jobs:
release:
name: Run release-please
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run release-please
uses: google-github-actions/release-please-action@v3
with:
release-type: python
token: ${{ secrets.GITHUB_TOKEN }}
bump-minor-pre-major: true
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ RUN apt update && \

COPY requirements.txt .
RUN pip install -r requirements.txt
COPY dist/platformics-0.1.0-py3-none-any.whl /tmp/platformics-0.1.0-py3-none-any.whl
RUN cd /tmp/ && pip install platformics-0.1.0-py3-none-any.whl && rm -rf /tmp/*.whl
COPY dist /tmp/dist
RUN cd /tmp/dist && pip install *.whl && rm -rf /tmp/*.whl

RUN mkdir -p /app
WORKDIR /app
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ The libraries and tools that make Platformics work:
## Roadmap
- [ ] Plugin hooks to add business logic to generated GQL resolvers
- [ ] Support arbitrary class inheritance hierarchies
- [ ] Package and publish to PyPI

## How to set up your own platformics API
1. Copy the test_app boilerplate code to your own repository.
Expand All @@ -43,6 +44,9 @@ The libraries and tools that make Platformics work:
4. Browse to http://localhost:9009/graphql to interact with your api!
5. Run `make token` to generate an authorization token that you can use to interact with the API. The `make` target copies the necessary headers to the system clipboard. Paste the token into the `headers` section at the bottom of the GraphQL explorer API

## Versioning platformics
Right now, platformics is used in downstream applications by using the platformics image as the base Docker image. To select a version of platformics, add the appropriate version tags to the docker image.

## Iterating on your schema
1. Make changes to `schema/schema.yml`
2. Run `make codegen` to re-run code gen and restart the API service
Expand Down
11 changes: 8 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[tool.poetry]
name = "platformics"
version = "0.1.0"
# placeholder version that will be replace by poetry-dynamic-versioning
version = "0.0.0"
description = "Platformics bio entities framework"
authors = ["CZI Infectious Disease Team <[email protected]>"]
license = "MIT License"
Expand Down Expand Up @@ -51,8 +52,12 @@ sqlalchemy_utils = "^0.41.1"
strawberry-graphql = "^0.217.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does poetry-dynamic-versioning figure out what version to use? Does it look at a git tag or something?

# a wrapper for poetry.core.masonry.api
build-backend = "poetry_dynamic_versioning.backend"

[tool.poetry-dynamic-versioning]
enable = true

[tool.black]
line-length = 120
Expand Down
Loading