circleci build scripts

This commit is contained in:
AJ Slater 2024-02-23 18:29:45 -08:00
parent 95ceefd0fe
commit 2500fa351b
6 changed files with 119 additions and 1 deletions

60
.circleci/config.yml Normal file
View File

@ -0,0 +1,60 @@
jobs:
build:
machine:
image: ubuntu-2204:current
environment:
DOCKER_CLI_EXPERIMENTAL: enabled
DOCKER_BUILDKIT: 1
steps:
- checkout
- run:
command: docker compose build comicfn2dict-builder
name: Build Builder
- run:
command: ./bin/docker-compose-exit.sh comicfn2dict-lint
name: comicfn2dict Lint
- run:
command: ./bin/docker-compose-exit.sh comicfn2dict-test
name: comicfn2dict Test
- store_test_results:
path: test-results/pytest
- store_artifacts:
path: test-results/coverage
- run:
command: ./bin/docker-compose-exit.sh comicfn2dict-build
name: Build comicfn2dict Dist
- persist_to_workspace:
paths:
- ./README.md
- ./bin
- ./dist
- ./pyproject.toml
root: .
deploy:
docker:
- image: cimg/python:3.12.1
steps:
- attach_workspace:
at: .
- run:
command: ./bin/publish-pypi.sh
version: 2.1
workflows:
main:
jobs:
- build:
filters:
branches:
only:
- develop
- pre-release
- main
- deploy:
filters:
branches:
only:
- pre-release
- main
requires:
- build
version: 2.1

20
Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM python:3.12.1-bookworm
LABEL maintainer="AJ Slater <aj@slater.net>"
COPY debian.sources /etc/apt/sources.list.d/
# hadolint ignore=DL3008
RUN apt-get clean \
&& apt-get update \
&& apt-get install --no-install-recommends -y \
bash \
npm \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY bin ./bin
COPY package.json package-lock.json pyproject.toml poetry.lock Makefile ./
RUN make install-all
COPY . .

6
bin/docker-compose-exit.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
# Run a docker compose service and return its exit code
set -euo pipefail
SERVICE=$1
# docker compose without the dash doesn't have the exit-code-from param
docker compose up --exit-code-from "$SERVICE" "$SERVICE"

11
debian.sources Normal file
View File

@ -0,0 +1,11 @@
Types: deb
URIs: http://deb.debian.org/debian
Suites: bookworm bookworm-updates
Components: main contrib non-free
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb
URIs: http://deb.debian.org/debian-security
Suites: bookworm-security
Components: main contrib non-free
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

21
docker-compose.yaml Normal file
View File

@ -0,0 +1,21 @@
services:
comicfn2dict-builder:
build: .
image: comicfn2dict-builder
container_name: comicfn2dict-builder
comicfn2dict-lint:
image: comicfn2dict-builder
container_name: comicfn2dict-lint
command: make lint
comicfn2dict-test:
image: comicfn2dict-builder
container_name: comicfn2dict-test
command: make test
volumes:
- ./test-results/:/app/test-results/
comicfn2dict-build:
image: comicfn2dict-builder
container_name: comicfn2dict-build
volumes:
- ./dist/:/app/dist/
command: poetry build

View File

@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
name = "comicfn2dict" name = "comicfn2dict"
version = "0.2.0" version = "0.2.0a0"
description = "Parse common comic filenames and return a dict of metadata attributes. Includes a cli." description = "Parse common comic filenames and return a dict of metadata attributes. Includes a cli."
license = "GPL-3.0-only" license = "GPL-3.0-only"
authors = ["AJ Slater <aj@slater.net>"] authors = ["AJ Slater <aj@slater.net>"]