Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
25c421e
Squashed commit of the following:
ajslater Jan 21, 2022
0e8a839
fix branch name for vendored package
ajslater Jan 21, 2022
fce6837
guard collectstatic from failing to load choices
ajslater Jan 21, 2022
bfb8fb0
lint
ajslater Jan 21, 2022
da912ab
attempt at caching the circleci build
ajslater Jan 21, 2022
3831026
circleci key name fix
ajslater Jan 21, 2022
9c9739a
another bad circleci key name
ajslater Jan 21, 2022
5928f4d
fix dockerfile error
ajslater Jan 21, 2022
bd2012e
less workdir changing
ajslater Jan 21, 2022
1faccbd
fix copy dest
ajslater Jan 21, 2022
c7b5c6c
fix shellcheck install
ajslater Jan 21, 2022
6a8811b
readlink behaves differently on macos, don't use it
ajslater Jan 21, 2022
5e2476e
lint
ajslater Jan 21, 2022
2a939b7
poetry update
ajslater Jan 21, 2022
5511d37
do not md5sum ~ files
ajslater Jan 21, 2022
ef93451
make sure poetry is installed
ajslater Jan 21, 2022
05600ef
use pip3
ajslater Jan 21, 2022
004177c
use builder requirements file instead
ajslater Jan 21, 2022
edf3678
lint
ajslater Jan 21, 2022
ed2055c
remove archive
ajslater Jan 21, 2022
e87921b
big version reform for readability with arrays
ajslater Jan 22, 2022
c00e06b
fix cache key name
ajslater Jan 22, 2022
ceca1ee
lint
ajslater Jan 22, 2022
64c7bcc
extend timeouts
ajslater Jan 22, 2022
8dcf3b9
attempt at fixing shellcheck linting of sourcing .env files
ajslater Jan 22, 2022
0b001a2
fix pytest ignore
ajslater Jan 23, 2022
ff4af6a
just move a tag postion
ajslater Jan 23, 2022
2f2f63a
fix shellcheck deps delimiter
ajslater Jan 23, 2022
c2f70be
lint
ajslater Jan 23, 2022
eacd8df
ignore git for dockerfile
ajslater Jan 23, 2022
abbbc80
update npm and add xml plugin to prettier
ajslater Jan 23, 2022
e162440
update poetry
ajslater Jan 23, 2022
38bdf84
possibly working new order
ajslater Jan 23, 2022
74596d6
fix new covers display
ajslater Jan 23, 2022
c4d8488
machine docker layer caching
ajslater Jan 23, 2022
024ab79
fix build order
ajslater Jan 23, 2022
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
76 changes: 28 additions & 48 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ executors:
latest-image:
machine:
image: ubuntu-2004:202111-02
docker_layer_caching: true
jobs:
test-and-build-dist:
build:
executor: latest-image
steps:
- checkout
- restore_cache:
key: v1-{{ .Revision }}
- run:
command: ./docker/docker-login.sh
name: Login to Docker Hub
Expand All @@ -17,8 +20,17 @@ jobs:
command: ./docker/docker-buildx-create.sh
name: Create buildx builder
- run:
command: ./build-builder.sh
command: ./docker-build-codex-base.sh
name: Build Base
- run:
command: ./docker-build-codex-builder.sh
name: Build Builder
- run:
command: ./docker-build-codex-dist-builder.sh
name: Build Tester & Dist Builder
- run:
command: ./docker-build-codex-wheels.sh
name: Build Wheels
- run:
command: ./docker/docker-compose-exit.sh codex-frontend-lint
name: "Frontend: Lint"
Expand All @@ -35,7 +47,7 @@ jobs:
name: "Backend: Lint & Test"
- run:
command: ./docker/docker-compose-exit.sh codex-backend-lint
name: "Backend: More Linters"
name: "Backend: Extra Linters"
- store_test_results:
path: test-results/pytest
- store_artifacts:
Expand All @@ -45,53 +57,28 @@ jobs:
- run:
command: ./docker/docker-compose-exit.sh codex-build-dist
name: Build Distribution
- save_cache:
key: v1-{{ .Revision }}
paths:
- dist
- persist_to_workspace:
paths:
- ./.env
- ./.env.platforms
- ./Dockerfile
- ./README.md
- ./build-codex.sh
- ./build-install-poetry.sh
- ./build-wheels.sh
- ./deploy-pypi.sh
- ./builder-requirements.txt
- ./dist
- ./docker
- ./docker-compose.yaml
- ./pyproject.toml
- ./poetry.lock
- ./wheels-version.sh
- ./docker-build-codex.sh
- ./pypi-deploy.sh
root: .
build-wheels:
executor: latest-image
steps:
- attach_workspace:
at: .
command:
- run:
command: ./build-install-poetry.sh
name: Install poetry
- run:
command: ./docker/docker-login.sh
name: Login to Docker Hub
- run:
command: ./docker/docker-install-binfmt-platforms.sh
name: Install binfmt platforms
- run:
command: ./docker/docker-buildx-create.sh
name: Create buildx builder
- run:
no_output_timeout: 90m
command: ./build-wheels.sh
name: Get or Build Python wheels
deploy:
executor: latest-image
steps:
- attach_workspace:
at: .
- run:
command: ./build-install-poetry.sh
name: Install poetry
- restore_cache:
key: v1-{{ .Revision }}
- run:
command: ./docker/docker-login.sh
name: Login to Docker Hub
Expand All @@ -102,34 +89,27 @@ jobs:
command: ./docker/docker-buildx-create.sh
name: Create buildx builder
- run:
command: ./build-codex.sh
command: ./docker-build-codex.sh
name: Build & Push Codex runnable image
- run:
command: ./deploy-pypi.sh
command: ./pypi-deploy.sh
name: Publish Package to PyPi
version: 2.1
workflows:
main:
jobs:
- test-and-build-dist:
- build:
filters:
branches:
only:
- develop
- release
- /.*-ci/
- build-wheels:
filters:
branches:
only:
- release
requires:
- test-and-build-dist
- deploy:
filters:
branches:
only:
- release
requires:
- build-wheels
- build
version: 2.1
17 changes: 16 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
*.egg-info
*.py[co]
*Dockerfile
*~
.DS_Store
.circleci
.coverage*
.env*
.git
.mypy_cache
.picopt_timestamp
.pytest_cache
.ropeproject
.venv
/codex/static_build
/codex/static_root
/config
/nginx
Dockerfile*
MANIFEST
NEWS
TODO.md
__pycache__
alpha*
cache
comics
config
deploy-pypi.sh
dev*
docker*
docker-compose*
kill-codex.sh
mock_comics
monkeytype.sqlite3
node_modules
strange.jpg
test-results
update-builder-requirement.sh
version.sh
wheels-version.sh
9 changes: 4 additions & 5 deletions .env
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
REPO=docker.io/ajslater/codex
BUILDER_VERSION=impish_4
WHEEL_BUILDER_VERSION=python3.10.1-alpine3.15_4
RUNNABLE_BASE_VERSION=python3.10.1-alpine3.15_0_2
PKG_VERSION=0.8.0a2
#!/bin/sh
# shellcheck disable=SC2034
PYTHON_ALPINE_VERSION=3.10.1-alpine3.15_0
PKG_VERSION=0.8.0a5
PUID=501
PGID=20
5 changes: 4 additions & 1 deletion .env.platforms
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
PLATFORMS=linux/amd64,linux/arm64,linux/armhf
#!/bin/sh
# shellcheck disable=SC2034
PLATFORMS=linux/amd64,linux/arm64
#,linux/armhf
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*~
package-lock.json
node_modules
test-results
96 changes: 96 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
module.exports = {
root: true,
env: {
node: true,
es2021: true,
browser: true,
},
extends: [
"eslint:recommended",
// CODE QUALITY
"plugin:sonarjs/recommended",
"plugin:unicorn/all",
// LANGS
"plugin:json/recommended",
"plugin:markdown/recommended",
"plugin:yaml/recommended",
// PRACTICES
"plugin:array-func/recommended",
"plugin:eslint-comments/recommended",
"plugin:no-use-extend-native/recommended",
"plugin:optimize-regex/all",
"plugin:promise/recommended",
"plugin:import/recommended",
"plugin:switch-case/recommended",
// PRETTIER
"plugin:prettier/recommended",
// SECURITY
"plugin:no-unsanitized/DOM",
"plugin:security/recommended",
],
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
},
ecmaVersion: 2022,
},
plugins: [
"array-func",
"eslint-comments",
"json",
"import",
"markdown",
"no-constructor-bind",
"no-secrets",
"no-unsanitized",
"no-use-extend-native",
"optimize-regex",
"prettier",
"promise",
"simple-import-sort",
"switch-case",
"security",
"sonarjs",
"unicorn",
"yaml",
],
rules: {
"import/no-unresolved": [
"error",
{
ignore: ["^[@]"],
},
],
"max-params": ["warn", 4],
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-constructor-bind/no-constructor-bind": "error",
"no-constructor-bind/no-constructor-state": "error",
"no-secrets/no-secrets": "error",
"prettier/prettier": "warn",
"security/detect-object-injection": "off",
"simple-import-sort/exports": "warn",
"simple-import-sort/imports": "warn",
"space-before-function-paren": "off",
"switch-case/newline-between-switch-case": "off", // Malfunctioning
"unicorn/prevent-abbreviations": "off",
},
ignorePatterns: [
"*~",
"**/__pycache__",
".git",
".mypy_cache",
".pytest_cache",
".venv",
"cache",
"codex/static_build",
"codex/static_root",
"comics",
"config",
"dist",
"frontend",
"node_modules",
"test_results",
"typings",
],
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ jspm_packages/

# codex specific
*~
.env.pushover
.venv
.DS_Store
build
Expand Down
5 changes: 1 addition & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ cache
codex/static_build
codex/static_root
comics
frontend/coverage
frontend/dist
frontend/node_modules
frontend/public/css/normalize.css
/node_modules
templates
webpack-stats.json
5 changes: 0 additions & 5 deletions .prettierrc.json

This file was deleted.

1 change: 1 addition & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
external-sources=true
24 changes: 14 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
ARG WHEELS_VERSION
ARG RUNNABLE_BASE_VERSION
FROM ajslater/codex-wheels:$WHEELS_VERSION as codex-wheels
# The runnable environment built from a minimal base without dev deps
FROM ajslater/codex-base:$RUNNABLE_BASE_VERSION as base-installer
ARG CODEX_WHEELS_VERSION
ARG CODEX_BASE_VERSION
FROM ajslater/codex-wheels:${CODEX_WHEELS_VERSION} as wheels
FROM ajslater/codex-base:${CODEX_BASE_VERSION} as base-installer
ARG CODEX_WHEEL
ENV CODEX_WHEELS=/wheels
WORKDIR /
COPY --from=codex-wheels /wheels /wheels
COPY ./dist/$CODEX_WHEEL /wheels/
COPY --from=wheels /cache/wheels/* /wheels/
COPY ./dist/$CODEX_WHEEL $CODEX_WHEELS/

# hadolint ignore=DL3013
RUN pip3 install --no-cache-dir --no-index --find-links=/wheels "/wheels/$CODEX_WHEEL"
RUN pip3 install --no-cache-dir --upgrade --find-links=$CODEX_WHEELS pip && \
pip3 install --no-cache-dir --find-links=$CODEX_WHEELS $CODEX_WHEELS/$CODEX_WHEEL

FROM ajslater/codex-base:$RUNNABLE_BASE_VERSION
FROM ajslater/codex-base:${CODEX_BASE_VERSION}
ARG PKG_VERSION
LABEL maintainer="AJ Slater <aj@slater.net>"
LABEL version=$PKG_VERSION
# The final image is the mininimal base with /usr/local copied.
COPY --from=base-installer /usr/local /usr/local

RUN mkdir -p /comics && touch /comics/DOCKER_UNMOUNTED_VOLUME
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 📰 Codex News

## v0.8.0a2
## v0.8.0a4

###### Search

Expand Down
16 changes: 14 additions & 2 deletions alpha-deploy.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
#!/bin/bash
# Run alpha, test, build and deploy for a local release on one arch
set -euxo pipefail
# shellcheck disable=SC1091
source .env.pushover
export PUSHOVER_API_TOKEN
export PUSHOVER_USER_ID
# shellcheck disable=SC1091
source .env
catch() {
poetry run pushover -s1 "$PKG_VERSION failed"
}
trap 'catch' ERR
./docker-build-codex-base.sh
./docker-build-codex-builder.sh
./alpha-test-build-dist.sh
# XXX PLATFORMS declaration current broken for wheels because build-codex bake does not see local wheel image
# https://github.com/docker/cli/issues/3286
export PLATFORMS="linux/amd64"
./build-wheels.sh
./build-codex.sh
./docker-build-codex.sh
poetry run pushover -s$? "$PKG_VERSION success"
Loading