Skip to content

Commit ebc499f

Browse files
authored
Merge pull request #2 from regro/rerender
feat: add rerender
2 parents 0643000 + 015f712 commit ebc499f

16 files changed

+1651
-6
lines changed

.github/workflows/release.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: regro/conda-forge-feedstock-ops
10+
11+
concurrency:
12+
group: release
13+
cancel-in-progress: false
14+
15+
jobs:
16+
release:
17+
name: release
18+
runs-on: "ubuntu-latest"
19+
steps:
20+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: log into ghcr.io
25+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
26+
with:
27+
registry: ${{ env.REGISTRY }}
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: build docker metadata
32+
id: meta
33+
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5
34+
with:
35+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
36+
flavor: |
37+
latest=false
38+
tags: |
39+
type=raw,value=${{ github.ref_name }}
40+
type=raw,value=latest
41+
42+
- name: build and push image
43+
uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755 # v6
44+
with:
45+
context: .
46+
push: true
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/tests.yml

+21-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ jobs:
3030

3131
- name: configure conda and install code
3232
run: |
33-
micromamba install \
34-
pip setuptools setuptools_scm python-build \
35-
pytest \
36-
flaky
3733
pip install --no-deps --no-build-isolation -e .
3834
3935
- name: test versions
@@ -52,3 +48,24 @@ jobs:
5248
pip uninstall conda-forge-feedstock-ops --yes
5349
5450
python -m pip install -v --no-deps --no-build-isolation -e .
51+
52+
- name: set up docker buildx
53+
uses: docker/setup-buildx-action@v3
54+
55+
- name: build docker image
56+
uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755 # v6
57+
with:
58+
context: .
59+
push: false
60+
load: true
61+
tags: conda-forge-feedstock-ops:test
62+
cache-from: type=gha
63+
cache-to: type=gha,mode=max
64+
65+
- name: run tests
66+
run: |
67+
pytest -vvs tests
68+
69+
- name: ensure cli runs
70+
run: |
71+
conda-forge-feedstock-ops-container --help

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,5 @@ cython_debug/
160160
# and can be added to the global gitignore or merged into this file. For a more nuclear
161161
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162162
#.idea/
163+
164+
conda_forge_feedstock_ops/_version.py

Dockerfile

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
FROM quay.io/condaforge/linux-anvil-cos7-x86_64:latest
2+
3+
# baseline env
4+
ENV TMPDIR=/tmp
5+
ENV CF_FEEDSTOCK_OPS_DIR=/opt/cf-feedstock-ops
6+
ENV CF_FEEDSTOCK_OPS_ENV=cf-feedstock-ops
7+
8+
# use bash for a while to make conda manipulations easier
9+
SHELL ["/bin/bash", "-l", "-c"]
10+
11+
# build the conda env first
12+
COPY environment.yml $CF_FEEDSTOCK_OPS_DIR/environment.yml
13+
RUN conda activate base && \
14+
conda env create -f $CF_FEEDSTOCK_OPS_DIR/environment.yml -n $CF_FEEDSTOCK_OPS_ENV && \
15+
conda clean --all --yes && \
16+
# Lucky group gets permission to write in the conda dir
17+
chown -R root /opt/conda && \
18+
chgrp -R lucky /opt/conda && chmod -R g=u /opt/conda && \
19+
conda deactivate
20+
21+
# deal with entrypoint
22+
COPY entrypoint /opt/docker/bin/
23+
RUN chmod +x /opt/docker/bin/entrypoint
24+
25+
# now install the bot code
26+
COPY . $CF_FEEDSTOCK_OPS_DIR
27+
RUN conda activate base && \
28+
conda activate $CF_FEEDSTOCK_OPS_ENV && \
29+
cd $CF_FEEDSTOCK_OPS_DIR && \
30+
pip install --no-deps --no-build-isolation -e . && \
31+
cd - && \
32+
conda deactivate && \
33+
conda deactivate
34+
35+
# now make the conda user for running tasks and set the user
36+
RUN useradd --shell /bin/bash -c "" -m conda
37+
ENV HOME=/home/conda
38+
ENV USER=conda
39+
ENV LOGNAME=conda
40+
ENV MAIL=/var/spool/mail/conda
41+
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/conda/bin
42+
RUN chown conda:conda $HOME && \
43+
cp -R /etc/skel $HOME && \
44+
chown -R conda:conda $HOME/skel && \
45+
(ls -A1 $HOME/skel | xargs -I {} mv -n $HOME/skel/{} $HOME) && \
46+
rm -Rf $HOME/skel && \
47+
cd $HOME
48+
USER conda
49+
50+
# deal with git config for user and mounted directory
51+
RUN conda activate $CF_FEEDSTOCK_OPS_ENV && \
52+
git config --global --add safe.directory /cf_feedstock_ops_dir && \
53+
git config --global init.defaultBranch main && \
54+
git config --global user.email "[email protected]" && \
55+
git config --global user.name "conda conda" && \
56+
conda deactivate && \
57+
conda init --all --user
58+
59+
# put the shell back
60+
SHELL ["/bin/sh", "-c"]

conda_forge_feedstock_ops/__init__.py

+11
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
11
from ._version import __version__ # noqa
2+
3+
4+
def setup_logging(level: str = "INFO") -> None:
5+
import logging
6+
7+
logging.basicConfig(
8+
format="%(asctime)-15s %(levelname)-8s %(name)s || %(message)s",
9+
level=level.upper(),
10+
)
11+
logging.getLogger("urllib3").setLevel(logging.INFO)
12+
logging.getLogger("github3").setLevel(logging.WARNING)

0 commit comments

Comments
 (0)