Skip to content

Commit ea353a6

Browse files
committed
Migrate to rye
1 parent 6987889 commit ea353a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+350
-2022
lines changed

.github/workflows/build.yml

Lines changed: 70 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: build
1+
name: Build
22

33
on:
44
push:
@@ -9,68 +9,73 @@ on:
99
branches: [ master ]
1010

1111
jobs:
12-
publish:
13-
runs-on: ubuntu-22.04
14-
12+
build:
13+
name: Build
14+
runs-on: ubuntu-24.04
1515
steps:
16-
- uses: actions/checkout@v4
17-
- name: Decide image tags
18-
id: info
19-
shell: python
20-
run: |
21-
import os
22-
import itertools
23-
24-
registries = ['docker.io', 'ghcr.io']
25-
repos = ['${{ github.repository }}'.lower()]
26-
if '${{ github.ref_type }}' == 'branch':
27-
tags = ['latest']
28-
elif '${{ github.ref_type }}' == 'tag':
29-
version = '${{ github.ref_name }}'[1:]
30-
tags = ['latest', version]
31-
else:
32-
tags = []
33-
34-
def join_tag(t):
35-
registry, repo, tag = t
36-
return f'{registry}/{repo}:{tag}'
37-
38-
product = itertools.product(registries, repos, tags)
39-
tags_csv = ','.join(map(join_tag, product))
40-
push = 'true' if tags_csv else 'false'
41-
42-
with open(os.environ['GITHUB_OUTPUT'], 'a') as out:
43-
out.write(f'tags={tags_csv}\n')
44-
out.write(f'push={push}\n')
45-
46-
- uses: docker/setup-buildx-action@v3
47-
- name: Login to DockerHub
48-
if: github.event_name == 'push' || github.event_name == 'release'
49-
id: dockerhub_login
50-
uses: docker/login-action@v3
51-
with:
52-
username: ${{ secrets.DOCKERHUB_USERNAME }}
53-
password: ${{ secrets.DOCKERHUB_PASSWORD }}
54-
- name: Login to GitHub Container Registry
55-
if: github.event_name == 'push' || github.event_name == 'release'
56-
uses: docker/login-action@v3
57-
with:
58-
registry: ghcr.io
59-
username: ${{ github.repository_owner }}
60-
password: ${{ secrets.GITHUB_TOKEN }}
61-
- name: Build image
62-
uses: docker/build-push-action@v5
63-
with:
64-
context: .
65-
platforms: linux/amd64,linux/ppc64le,linux/arm64
66-
tags: ${{ steps.info.outputs.tags }}
67-
push: ${{ steps.info.outputs.push }}
68-
cache-from: type=gha
69-
cache-to: type=gha,mode=max
70-
- name: Update DockerHub description
71-
uses: peter-evans/dockerhub-description@v3
72-
if: ${{ steps.info.outputs.push }}
73-
with:
74-
username: ${{ secrets.DOCKERHUB_USERNAME }}
75-
password: ${{ secrets.DOCKERHUB_PASSWORD }}
76-
short-description: ${{ github.event.repository.description }}
16+
- uses: actions/checkout@v4
17+
- name: Install rye
18+
uses: eifinger/setup-rye@d4c3ac7b15d8bf2e0b45e2d257c6b5cdbebc3643 # v4.2.1
19+
with:
20+
version: '0.36.0'
21+
enable-cache: true
22+
cache-prefix: ${{ github.workflow }}
23+
- name: Decide image tags
24+
id: info
25+
shell: python
26+
run: |
27+
import os
28+
import itertools
29+
30+
registries = ['docker.io', 'ghcr.io']
31+
repos = ['${{ github.repository }}'.lower()]
32+
if '${{ github.ref_type }}' == 'branch':
33+
tags = ['latest']
34+
elif '${{ github.ref_type }}' == 'tag':
35+
version = '${{ github.ref_name }}'[1:]
36+
tags = ['latest', version]
37+
else:
38+
tags = []
39+
40+
def join_tag(t):
41+
registry, repo, tag = t
42+
return f'{registry}/{repo}:{tag}'
43+
44+
product = itertools.product(registries, repos, tags)
45+
tags_csv = ','.join(map(join_tag, product))
46+
push = 'true' if tags_csv else 'false'
47+
48+
with open(os.environ['GITHUB_OUTPUT'], 'a') as out:
49+
out.write(f'tags={tags_csv}\n')
50+
out.write(f'push={push}\n')
51+
- name: Build Python wheel
52+
run: rye build --wheel --clean
53+
- uses: docker/setup-buildx-action@v3
54+
- name: Login to DockerHub
55+
if: github.event_name == 'push' || github.event_name == 'release'
56+
id: dockerhub_login
57+
uses: docker/login-action@v3
58+
with:
59+
username: ${{ secrets.DOCKERHUB_USERNAME }}
60+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
61+
- name: Login to GitHub Container Registry
62+
if: github.event_name == 'push' || github.event_name == 'release'
63+
uses: docker/login-action@v3
64+
with:
65+
registry: ghcr.io
66+
username: ${{ github.repository_owner }}
67+
password: ${{ secrets.GITHUB_TOKEN }}
68+
- name: Build image
69+
uses: docker/build-push-action@v6
70+
with:
71+
context: .
72+
platforms: linux/amd64,linux/ppc64le,linux/arm64
73+
tags: ${{ steps.info.outputs.tags }}
74+
push: ${{ steps.info.outputs.push }}
75+
- name: Update DockerHub description
76+
uses: peter-evans/dockerhub-description@v4
77+
if: ${{ steps.info.outputs.push }}
78+
with:
79+
username: ${{ secrets.DOCKERHUB_USERNAME }}
80+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
81+
short-description: ${{ github.event.repository.description }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.venv/
33
__pycache__/
44
*.egg-info/
5+
dist/

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.prospector.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12.3

Dockerfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
FROM docker.io/fnndsc/python-poetry:1.5.1
1+
# Build instructions: see https://rye.astral.sh/guide/docker/
2+
3+
FROM python:3.12.3-alpine
4+
5+
RUN --mount=source=dist,target=/dist PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir /dist/*.whl
26

37
LABEL org.opencontainers.image.authors="Jennings Zhang <[email protected]>, FNNDSC <[email protected]>" \
48
org.opencontainers.image.title="ChRISomatic" \
@@ -7,11 +11,5 @@ LABEL org.opencontainers.image.authors="Jennings Zhang <Jennings.Zhang@childrens
711
org.opencontainers.image.source="https://github.com/FNNDSC/chrisomatic" \
812
org.opencontainers.image.licenses="MIT"
913

10-
WORKDIR /usr/local/src/chrisomatic
11-
COPY . .
12-
RUN poetry install --no-dev
13-
1414
WORKDIR /
15-
# needs to write to docker daemon
16-
USER root
1715
CMD ["chrisomatic"]

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021-2023 FNNDSC / BCH
3+
Copyright (c) 2021-2024 FNNDSC / BCH
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[![Version](https://img.shields.io/docker/v/fnndsc/chrisomatic?sort=semver)](https://hub.docker.com/r/fnndsc/chrisomatic)
44
[![MIT License](https://img.shields.io/github/license/fnndsc/chrisomatic)](https://github.com/FNNDSC/chrisomatic/blob/master/LICENSE)
55
[![Build](https://github.com/FNNDSC/chrisomatic/actions/workflows/build.yml/badge.svg)](https://github.com/FNNDSC/chrisomatic/actions)
6-
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
76

87
`chrisomatic` is a tool for automatic administration of _ChRIS_ backends.
98
It is particularly useful for the recreation of setups for testing or development,

dev.Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM python:3.12.3-alpine
2+
3+
WORKDIR /app
4+
COPY requirements-dev.lock requirements-dev.lock
5+
RUN --mount=type=cache,sharing=locked,target=/root/.cache/pip \
6+
sed -i' ' -e '/-e file:\./d' requirements-dev.lock \
7+
&& env PYTHONDONTWRITEBYTECODE=1 pip install -r requirements-dev.lock
8+
9+
CMD ["pytest"]

0 commit comments

Comments
 (0)