Skip to content

Commit 61ddc88

Browse files
authored
feat: add conda & docker build/publish mechanisms (#60)
1 parent e020604 commit 61ddc88

File tree

9 files changed

+217
-62
lines changed

9 files changed

+217
-62
lines changed

.github/workflows/dev.yml

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

.github/workflows/publish.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,66 @@ jobs:
5252
publish_dir: 'docs'
5353
destination_dir: 'docs'
5454
keep_files: true
55+
56+
Anaconda:
57+
runs-on: ubuntu-22.04
58+
59+
steps:
60+
61+
- name: Checkout Repository
62+
uses: actions/checkout@v2
63+
64+
- name: Setup Miniconda & Environment
65+
uses: conda-incubator/setup-miniconda@v2
66+
with:
67+
python-version: 3.11
68+
auto-update-conda: true
69+
auto-activate-base: true
70+
71+
- name: Install conda build suite
72+
shell: bash -l {0}
73+
run: conda install conda-build conda-verify numpy
74+
75+
- name: Conda Info
76+
shell: bash -l {0}
77+
run: |
78+
conda info -a
79+
conda list
80+
81+
- name: Render version into the build recipe
82+
shell: bash -l {0}
83+
run: |
84+
VERSION=$(<VERSION)
85+
VERSION="${VERSION:1}"
86+
sed -i "s/{{ version }}/$VERSION/" meta.yaml
87+
88+
- name: Build Anaconda Package
89+
shell: bash -l {0}
90+
run: conda build . -c conda-forge
91+
92+
- name: Publish to Anaconda.org
93+
uses: m0nhawk/conda-package-publish-action@master
94+
with:
95+
subDir: '.'
96+
AnacondaUsername: AngryMaciek
97+
AnacondaPassword: ${{ secrets.ANACONDA_PASSWORD }}
98+
99+
DockerHub:
100+
runs-on: ubuntu-22.04
101+
102+
steps:
103+
104+
- name: Checkout Repository
105+
uses: actions/checkout@v3
106+
107+
- name: Build & Publish image to DockerHub
108+
env:
109+
docker_username: angrymaciek
110+
docker_password: ${{ secrets.DOCKER_PASSWORD }}
111+
run: |
112+
repo_name="hypercomplex"
113+
tag=${GITHUB_REF##*/}
114+
docker build -t angrymaciek/${repo_name}:latest .
115+
docker tag angrymaciek/${repo_name} angrymaciek/${repo_name}:${tag}
116+
echo $docker_password | docker login -u $docker_username --password-stdin
117+
docker push angrymaciek/${repo_name}:${tag}

.github/workflows/user.yml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Include&Install
1+
name: Install&Include
22

33
on: [push]
44

@@ -9,6 +9,7 @@ jobs:
99
strategy:
1010
matrix:
1111
os: [macos-12, ubuntu-22.04]
12+
fail-fast: false
1213
env:
1314
working-directory: .test/include
1415

@@ -47,6 +48,7 @@ jobs:
4748
strategy:
4849
matrix:
4950
os: [macos-12, ubuntu-22.04]
51+
fail-fast: false
5052
env:
5153
test-directory: .test/install
5254
lib-directory: "hypercomplex"
@@ -87,3 +89,48 @@ jobs:
8789
- name: Remove Copied Library
8890
working-directory: ${{env.lib-directory}}
8991
run: sudo make uninstall
92+
93+
Conda:
94+
runs-on: ${{ matrix.os }}
95+
strategy:
96+
matrix:
97+
os: [macos-12, ubuntu-22.04]
98+
fail-fast: false
99+
100+
steps:
101+
102+
- name: Checkout Repository
103+
uses: actions/checkout@v2
104+
105+
- name: Setup Miniconda & Environment
106+
uses: conda-incubator/setup-miniconda@v2
107+
with:
108+
python-version: 3.11
109+
auto-update-conda: true
110+
auto-activate-base: true
111+
112+
- name: Install conda build suite
113+
shell: bash -l {0}
114+
run: conda install conda-build conda-verify numpy
115+
116+
- name: Conda Info
117+
shell: bash -l {0}
118+
run: |
119+
conda info -a
120+
conda list
121+
122+
- name: Build Anaconda Package
123+
shell: bash -l {0}
124+
run: conda build . -c conda-forge
125+
126+
- name: Install the Package
127+
shell: bash -l {0}
128+
run: conda install -c ${CONDA_PREFIX}/conda-bld/ -c conda-forge hypercomplex --yes
129+
130+
- name: Compile Test Program
131+
shell: bash -l {0}
132+
run: g++ --std=c++17 -I$CONDA_PREFIX/include -L$CONDA_PREFIX/lib .test/install/test.cpp -o test -lmpfr -lgmp
133+
134+
- name: Execute Test Program
135+
shell: bash -l {0}
136+
run: ./test

.pre-commit-config.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ repos:
2222
always_run: true
2323

2424
- id: check-added-large-files
25-
name: "[05/09] Forbid commiting files bigger than 1MB"
26-
args: [— maxkb=1024]
25+
name: "[05/09] Forbid commiting files bigger than 2MB"
26+
args: [— maxkb=2048]
2727
always_run: true
2828

2929
- id: trailing-whitespace
@@ -33,6 +33,7 @@ repos:
3333

3434
- id: end-of-file-fixer
3535
name: "[07/09] Ensure 1 newline at the end of each file"
36+
exclude: VERSION
3637
always_run: true
3738

3839
- id: mixed-line-ending
@@ -42,4 +43,5 @@ repos:
4243
- id: check-yaml
4344
name: "[09/09] Check YAML files syntax"
4445
files: \.ya?ml$
46+
exclude: ^meta.yaml
4547
always_run: true

Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#
2+
# Good references:
3+
# https://denibertovic.com/posts/handling-permissions-with-docker-volumes/
4+
# https://www.fromlatest.io
5+
#
6+
# ~AngryMaciek
7+
8+
##### BASE IMAGE #####
9+
FROM bitnami/minideb:bullseye
10+
# INFO: https://github.com/bitnami/minideb
11+
12+
##### METADATA #####
13+
LABEL base.image="bitnami/minideb:bullseye"
14+
LABEL version="1.0.0"
15+
LABEL software="hypercomplex"
16+
LABEL software.description="Header-only C++ template library for lattice-based cryptosystems in high-dimensional algebras"
17+
LABEL software.documentation="https://angrymaciek.github.io/hypercomplex"
18+
LABEL software.website="https://github.com/AngryMaciek/hypercomplex"
19+
LABEL software.license="Apache-2.0"
20+
LABEL software.tags="Mathematics"
21+
LABEL maintainer="Maciek Bak"
22+
LABEL maintainer.email="[email protected]"
23+
24+
##### INSTALL SYSTEM-LEVEL DEPENDENCIES #####
25+
RUN install_packages \
26+
ca-certificates doxygen g++ gnupg2 git gosu libmpfr-dev make python3 python3-pip valgrind \
27+
&& pip install cpplint pre-commit
28+
29+
##### SET ENVIROMENTAL VARIABLES #####
30+
ENV LANG C.UTF-8
31+
32+
##### PREPARE WORKING DIRECTORY #####
33+
VOLUME /hypercomplex
34+
WORKDIR /hypercomplex
35+
36+
##### SETUP ENTRYPOINT #####
37+
COPY entrypoint.sh /bin/entrypoint.sh
38+
RUN /bin/bash -c "chmod +x /bin/entrypoint.sh"
39+
ENTRYPOINT ["/bin/entrypoint.sh"]
40+
CMD ["/bin/bash"]

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
[![Contribute with Gitpod](https://img.shields.io/badge/Contribute%20with-Gitpod-908a85?logo=gitpod)](https://gitpod.io/#https://github.com/AngryMaciek/hypercomplex)
22
[![pre-commit](https://img.shields.io/badge/pre--commit-+-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
3-
[![user](https://github.com/AngryMaciek/hypercomplex/workflows/Include&Install/badge.svg?branch=master)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3Auser)
4-
[![catch2](https://github.com/AngryMaciek/hypercomplex/workflows/Catch2/badge.svg?branch=master)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3ACatch2)
3+
[![user](https://github.com/AngryMaciek/hypercomplex/workflows/Install&Include/badge.svg)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3AInstall%26Include)
4+
[![catch2](https://github.com/AngryMaciek/hypercomplex/workflows/Catch2/badge.svg)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3ACatch2)
55
[![codecov](https://codecov.io/gh/AngryMaciek/hypercomplex/branch/master/graph/badge.svg?token=SSKOK4XR1M)](https://codecov.io/gh/AngryMaciek/hypercomplex)
66
[![Cpp17](https://img.shields.io/badge/C%2B%2B-17-blue)](https://en.wikipedia.org/wiki/C%2B%2B17)
7-
[![cpplint](https://github.com/AngryMaciek/hypercomplex/workflows/cpplint/badge.svg?branch=master)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3Acpplint)
7+
[![cpplint](https://github.com/AngryMaciek/hypercomplex/workflows/cpplint/badge.svg)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3Acpplint)
88
[![CodeFactor](https://www.codefactor.io/repository/github/angrymaciek/hypercomplex/badge)](https://www.codefactor.io/repository/github/angrymaciek/hypercomplex)
9-
[![publish](https://github.com/AngryMaciek/hypercomplex/workflows/publish/badge.svg?branch=master)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3Apublish)
9+
[![publish](https://github.com/AngryMaciek/hypercomplex/workflows/publish/badge.svg)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3Apublish)
10+
[![conda](https://anaconda.org/angrymaciek/hypercomplex/badges/version.svg)](https://anaconda.org/AngryMaciek/hypercomplex)
11+
[![DockerHub](https://badgen.net/badge/icon/2.0.6/docker?icon=docker&label=DockerHub&color=blue)](https://hub.docker.com/r/angrymaciek/capsule)
1012
[![DOI](https://joss.theoj.org/papers/10.21105/joss.05272/status.svg)](https://doi.org/10.21105/joss.05272)
1113

1214
<img src="img/logo.png" alt="drawing" height="30"/>

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2.0.5
1+
v2.0.6

entrypoint.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# create a non-root user "user" passed from the command line (or fallback);
4+
# exec the rest (CMD) as "user"
5+
# ~AngryMaciek
6+
7+
ID=${HOSTUID:-9001}
8+
useradd --shell /bin/bash -u $ID -o -c "" -m user
9+
export HOME=/home/user
10+
exec /usr/sbin/gosu user "$@"

meta.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
###############################################################################
2+
#
3+
# conda-build recipe for the package
4+
#
5+
# AUTHOR: Maciek_Bak
6+
# AFFILIATION: Department_of_Mathematics_City_University_of_London
7+
8+
# CREATED: 01-08-2023
9+
# LICENSE: Apache 2.0
10+
#
11+
###############################################################################
12+
---
13+
{% set version = "0.0.0" %} # for local build only
14+
15+
package:
16+
name: hypercomplex
17+
version: {{ version }}
18+
19+
source:
20+
path: .
21+
22+
requirements:
23+
run:
24+
- compilers
25+
- mpfr
26+
- sysroot_linux-64=2.28
27+
28+
build:
29+
script: |
30+
mkdir -p $PREFIX/include
31+
cp -r $SRC_DIR/hypercomplex $PREFIX/include/Hypercomplex
32+
33+
about:
34+
home: https://github.com/AngryMaciek/hypercomplex
35+
summary: |
36+
Header-only C++ template library for lattice-based
37+
cryptosystems in high-dimensional algebras
38+
license: Apache-2.0
39+
license_file: LICENSE
40+
41+
extra:
42+
maintainers:
43+
- Maciek Bak
44+
45+
...

0 commit comments

Comments
 (0)