Migrate from Semaphore CI to CircleCI

This commit is contained in:
Radon Rosborough 2019-11-16 21:59:32 -08:00
parent d56b8afcd3
commit 68d8755333
7 changed files with 126 additions and 72 deletions

44
.circleci/config.yml Normal file
View file

@ -0,0 +1,44 @@
version: 2
shared: &shared
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
# This command will pick up $VERSION from the environment.
- run: >-
make docker
CMD="make -k compile checkdoc longlines"
jobs:
emacs-25.1:
<<: *shared
environment:
VERSION: "25.1"
emacs-25.2:
<<: *shared
environment:
VERSION: "25.2"
emacs-25.3:
<<: *shared
environment:
VERSION: "25.3"
emacs-26.1:
<<: *shared
environment:
VERSION: "26.1"
emacs-26.2:
<<: *shared
environment:
VERSION: "26.2"
emacs-master:
<<: *shared
environment:
VERSION: "master"
workflows:
version: 2
ci:
jobs:
- emacs-25.2
- emacs-25.3
- emacs-26.1
- emacs-26.2
- emacs-master

View file

@ -1,24 +0,0 @@
version: v1.0
name: Apheleia
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
blocks:
- name: Apheleia CI
task:
jobs:
- name: Apheleia CI
matrix:
- env_var: EMACS_VERSION
values:
- "25.2"
- "25.3"
- "26.1"
- "26.2"
commands:
- checkout
- >-
docker run --rm -v "$PWD:/src"
silex/emacs:"$EMACS_VERSION" bash -c
'apt-get update && apt-get install -y make && make -C /src'

12
Dockerfile Normal file
View file

@ -0,0 +1,12 @@
ARG VERSION
FROM silex/emacs:$VERSION
ARG UID
COPY scripts/docker-install.bash /tmp/
RUN /tmp/docker-install.bash "$UID"
USER $UID
WORKDIR /home/docker/src
CMD bash

View file

@ -1,20 +1,27 @@
VERSION ?=
CMD ?=
EMACS ?= emacs EMACS ?= emacs
VERSION ?= latest
# The order is important for compilation. # The order is important for compilation.
for_compile := *.el for_compile := *.el
for_checkdoc := *.el for_checkdoc := *.el
for_longlines := $(wildcard *.el *.md *.yml) Makefile for_longlines := $(wildcard *.el *.md *.yml) Makefile
.PHONY: all .PHONY: help
all: compile checkdoc longlines ## Build project and run all linters help: ## Show this message
@echo "usage:" >&2
@grep -h "[#]# " $(MAKEFILE_LIST) | \
sed 's/^/ make /' | \
sed 's/:[^#]*[#]# /|/' | \
sed 's/%/LANG/' | \
column -t -s'|' >&2
.PHONY: lint
lint: compile checkdoc longlines ## Build project and run all linters
.PHONY: compile .PHONY: compile
compile: ## Check for byte-compiler errors compile: ## Check for byte-compiler errors
# Deleting the .elc file first is sometimes necessary
# apparently when switching between different versions of
# Emacs; otherwise we may get an error saying we can't
# overwrite the file.
@for file in $(for_compile); do \ @for file in $(for_compile); do \
echo "[compile] $$file" ;\ echo "[compile] $$file" ;\
rm -f "$${file}c" ;\ rm -f "$${file}c" ;\
@ -36,8 +43,8 @@ checkdoc: ## Check for missing or poorly formatted docstrings
.PHONY: longlines .PHONY: longlines
longlines: ## Check for lines longer than 79 characters longlines: ## Check for lines longer than 79 characters
@echo "[longlines] $(for_longlines)"
@for file in $(for_longlines); do \ @for file in $(for_longlines); do \
echo "[longlines] $$file" ;\
cat "$$file" \ cat "$$file" \
| sed '/[l]onglines-start/,/longlines-stop/d' \ | sed '/[l]onglines-start/,/longlines-stop/d' \
| grep -E '.{80}' \ | grep -E '.{80}' \
@ -54,12 +61,3 @@ clean: ## Remove build artifacts
.PHONY: docker .PHONY: docker
docker: ## Start a Docker shell; e.g. make docker VERSION=25.3 docker: ## Start a Docker shell; e.g. make docker VERSION=25.3
@scripts/docker.bash $(VERSION) @scripts/docker.bash $(VERSION)
.PHONY: help
help: ## Show this message
@echo "usage:" >&2
@grep -h "[#]# " $(MAKEFILE_LIST) | \
sed 's/^/ make /' | \
sed 's/:[^#]*[#]# /|/' | \
sed 's/%/LANG/' | \
column -t -s'|' >&2

View file

@ -100,22 +100,11 @@ The following user options are also available:
## Contributing ## Contributing
Development of Apheleia happens using the provided Makefile: Development of Apheleia happens using the provided Makefile. Run `make
help` for documentation. All commits are automatically tested using
% make help `make lint` for all supported Emacs versions on the excellent
usage: [CircleCI](https://circleci.com/) platform. Please make sure you can
make all Build project and run all linters successfully run `make lint` before submitting a pull request.
make compile Check for byte-compiler errors
make checkdoc Check for missing or poorly formatted docstrings
make longlines Check for lines longer than 79 characters
make clean Remove build artifacts
make docker Start a Docker shell; e.g. make docker VERSION=25.3
make help Show this message
All commits are automatically tested using `make all` (== `make`) for
all supported Emacs versions on the excellent [Semaphore
CI](https://semaphoreci.com/) platform. Please make sure you can
successfully run `make` before submitting a pull request.
If the CI fails, it may be that your change is not compatible with one If the CI fails, it may be that your change is not compatible with one
of the Emacs versions supported by Apheleia. Suppose that the failure of the Emacs versions supported by Apheleia. Suppose that the failure

37
scripts/docker-install.bash Executable file
View file

@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -e
set -o pipefail
if (( $# != 1 )); then
echo "usage: docker-install.bash UID" >&2
exit 1
fi
uid="$1"
packages="
# needed to run build system
make
# needed for 'make help'
bsdmainutils
# for checking diffs if you want
git
# just in case we want root
sudo
"
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y $(grep -v "^#" <<< "$packages")
rm -rf /var/lib/apt/lists/*
useradd --uid="$uid" --create-home --groups sudo docker
passwd -d docker
rm "$0"

View file

@ -3,11 +3,16 @@
set -e set -e
set -o pipefail set -o pipefail
if [[ -z "$1" ]]; then if [[ -n "$1" && "$1" != master && ! "$1" =~ [0-9]+\.[0-9]+ ]]; then
echo "docker.sh: no tag provided" 1>&2 echo "docker.bash: malformed tag: $1" >&2
exit 1 exit 1
else fi
tag="$1"
tag="${1:-latest}"
args=(bash)
if [[ -n "$2" ]]; then
args=("${args[@]}" -c "$2")
fi fi
docker() { docker() {
@ -18,15 +23,8 @@ docker() {
fi fi
} }
script="$(cat <<"EOF" docker build . -t "apheleia:$tag" \
--build-arg "UID=$UID" \
--build-arg "VERSION=$tag"
apt-get update docker run -it --rm -v "$PWD:/home/docker/src" "apheleia:$tag" "${args[@]}"
apt-get install -y bsdmainutils make
cd /src
make help
exec bash
EOF
)"
docker run -it --rm -v "$PWD:/src" silex/emacs:"$tag" bash -c "$script"