Skip to content

Commit

Permalink
build: move to circle ci (#24)
Browse files Browse the repository at this point in the history
* migrate to circleci for automated build and deployment
* execute prompt install and a single prompt command to smoke screen the installation:
  * macos
  * ubuntu
  * fedora 29/30
  * debian
  * centos
  * mint
* update readme to include thank you to circleci and a build status

Closes: #23
  • Loading branch information
dmccaffery authored Jun 26, 2019
1 parent 8f4096e commit 0b09959
Show file tree
Hide file tree
Showing 22 changed files with 356 additions and 43 deletions.
140 changes: 140 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
version: 2.1
jobs:
macos:
macos:
xcode: "10.2.1"
steps:
- checkout
- run:
name: install
command: ./install.sh | tee log.txt
- run:
name: ensure prompt
command: bash -l -c "git sha"
- store_artifacts:
path: log.txt
destination: logs/$CIRCLE_STAGE.txt

ubuntu:
docker:
- image: docker:stable
steps:
- setup_remote_docker:
docker_layer_caching: true
- checkout
- run:
name: install and ensure prompt
command: docker build --file docker/$CIRCLE_STAGE/Dockerfile . | tee log.txt
- store_artifacts:
path: log.txt
destination: logs/$CIRCLE_STAGE.txt

debian:
docker:
- image: docker:stable
steps:
- setup_remote_docker:
docker_layer_caching: true
- checkout
- run:
name: install and ensure prompt
command: docker build --file docker/$CIRCLE_STAGE/Dockerfile . | tee log.txt
- store_artifacts:
path: log.txt
destination: logs/$CIRCLE_STAGE.txt

fedora-29:
docker:
- image: docker:stable
steps:
- setup_remote_docker:
docker_layer_caching: true
- checkout
- run:
name: install and ensure prompt
command: docker build --file docker/$CIRCLE_STAGE/Dockerfile . | tee log.txt
- store_artifacts:
path: log.txt
destination: logs/$CIRCLE_STAGE.txt

fedora-30:
docker:
- image: docker:stable
steps:
- setup_remote_docker:
docker_layer_caching: true
- checkout
- run:
name: install and ensure prompt
command: docker build --file docker/$CIRCLE_STAGE/Dockerfile . | tee log.txt
- store_artifacts:
path: log.txt
destination: logs/$CIRCLE_STAGE.txt

centos:
docker:
- image: docker:stable
steps:
- setup_remote_docker:
docker_layer_caching: true
- checkout
- run:
name: install and ensure prompt
command: docker build --file docker/$CIRCLE_STAGE/Dockerfile . | tee log.txt
- store_artifacts:
path: log.txt
destination: logs/$CIRCLE_STAGE.txt

mint:
docker:
- image: docker:stable
steps:
- setup_remote_docker
- checkout
- run:
name: install and ensure prompt
command: docker build --file docker/$CIRCLE_STAGE/Dockerfile . | tee log.txt
- store_artifacts:
path: log.txt
destination: logs/$CIRCLE_STAGE.txt

deploy:
docker:
- image: docker:stable
steps:
- add_ssh_keys:
fingerprints:
- "a0:dd:b4:96:be:95:30:89:5e:a4:67:57:98:ba:c2:da"
- checkout
- run:
name: install
command: npm install
- run:
name: release
command: npm run release

workflows:
install:
jobs:
- macos
- ubuntu
- debian
- fedora-29
- fedora-30
- centos
- mint
- deploy:
requires:
- macos
- ubuntu
- debian
- fedora-29
- fedora-30
- centos
- mint
filters:
tags:
ignore:
- /.*/
branches:
only: master
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.*
.*/

artifacts/
node_modules/
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ indent_size = 4
char_set = utf-8
insert_final_newline = true

[*.json]
[*.{json,yml,yaml}]
indent_size = 2
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,7 @@ vnd/
Condo.AssemblyInfo.cs

# prompt backups
backup/
backup/

# circle-ci
!**/.circleci
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

CODEOWNERS @sjk07 @dmccaffery

/.circleci/ @sjk07 @dmccaffery
install.sh @sjk07 @dmccaffery
/uname/ @sjk07 @dmccaffery
/uname/ @sjk07 @dmccaffery
38 changes: 31 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

> A spectacular (BaSH) prompt for macOS and *nix distributions
![Preview][preview-image]

## Vitals

Info | Badges
--------------|-------------------------------------
License | [![License][license-image]][license]
License | [![License][license-image]][license-uri]
Build | [![Build][build-image]][build-uri]

### Supported Operating Systems

Expand All @@ -19,9 +22,7 @@ debian | 9 or greater
centOS | 7 or greater
mint | 19 or greater

## Getting Started

### What is promptMastermind
## Know It

promptMastermind is a prompt for BaSH on *nix distributions that includes a ton of useful functionality, including:

Expand All @@ -39,7 +40,7 @@ promptMastermind is a prompt for BaSH on *nix distributions that includes a ton
Note: All "extensions" are implemented as sourced function calls, so it should not interfere with existing
customization (aside from the prompt).

### Using promptMastermind
### Use It

Install promptMastermind in one step:

Expand Down Expand Up @@ -71,9 +72,32 @@ The backup folder is located at: ```$HOME/.am/prompt/backup/[date]```.

The ```$HOME/.bash_profile``` is also backed up to ```$HOME/.am/prompt/backup/[date]/.bash_profile```.

## Build It

In order to test the installation routine for promptMastermind, we use a set of docker images for each of the supported *nix platforms. The build script in the `docker/` folder can be used to build all of the images, or specific ones:

```sh
# build all of the platforms (this will take a while)
./docker/build.sh

# build the debian and ubuntu platforms
./docker/build.sh debian ubuntu

# build just the mint platform
./docker/build.sh mint
```

In addition, [circleci][circleci-uri] is used to build all platforms, including macOS as part of our pull request validation. Special thanks to [circleci][circleci-uri] for providing the build agents!

## Copyright and License

© automotiveMastermind and contributors. Distributed under the MIT license. See [LICENSE][] for details.
© automotiveMastermind and contributors. Distributed under the MIT license. See [LICENSE][license-uri] for details.

[license-image]: https://img.shields.io/badge/license-MIT-blue.svg
[license]: LICENSE
[license-uri]: LICENSE

[build-image]: https://circleci.com/gh/automotiveMastermind/prompt.svg?style=svg
[build-uri]: https://circleci.com/gh/automotiveMastermind/prompt
[circleci-uri]: https://circleci.com

[preview-image]: https://user-images.githubusercontent.com/1803684/60201230-a8241300-97fc-11e9-8cb6-613cd31d914f.png
22 changes: 22 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#! /usr/bin/env bash

set -eo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
REPO_DIR=$(dirname "$SCRIPT_DIR")
LOGS_DIR="$REPO_DIR/artifacts/logs"

PLATFORMS=( "$@" )

if [ -z "${PLATFORMS:-}" ]; then
PLATFORMS=($(basename $SCRIPT_DIR/*/))
fi

mkdir -p "$LOGS_DIR" 1>/dev/null 2>&1

for platform in "${PLATFORMS[@]}"; do
dockerfile="$SCRIPT_DIR/$platform/Dockerfile"
tag="prompt:$platform"

docker build --file "$dockerfile" --tag $tag "$REPO_DIR" | tee "$LOGS_DIR/$platform.log"
done
19 changes: 19 additions & 0 deletions docker/centos/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM centos:7

RUN yum install -y sudo \
&& yum clean all \
&& localedef -i en_US -f UTF-8 en_US.UTF-8 \
&& useradd -m -s /bin/bash am-prompt \
&& echo 'am-prompt ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers

USER am-prompt
WORKDIR /home/am-prompt

ENV LANG=en_US.UTF-8 \
USER=am-prompt

COPY . ./
RUN ./install.sh

SHELL [ "/bin/bash", "-l" ]
RUN git-sha
25 changes: 25 additions & 0 deletions docker/debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM debian:9

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
&& apt-get install -y --no-install-recommends sudo locales uuid-runtime \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& dpkg-reconfigure locales \
&& update-locale LANG=en_US.UTF-8 \
&& useradd -m -s /bin/bash am-prompt \
&& echo 'am-prompt ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers

USER am-prompt
WORKDIR /home/am-prompt/src

ENV LANG=en_US.UTF-8 \
USER=am-prompt

COPY . ./
RUN ./install.sh

SHELL [ "/bin/bash", "-l" ]
RUN git-sha
19 changes: 19 additions & 0 deletions docker/fedora-29/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM fedora:29

RUN dnf install -y glibc-locale-source sudo util-linux-user \
&& dnf clean all \
&& localedef -i en_US -f UTF-8 en_US.UTF-8 \
&& useradd -m -s /bin/bash am-prompt \
&& echo 'am-prompt ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers

USER am-prompt
WORKDIR /home/am-prompt

ENV LANG=en_US.UTF-8 \
USER=am-prompt

COPY . ./
RUN ./install.sh

SHELL [ "/bin/bash", "-l" ]
RUN git-sha
19 changes: 19 additions & 0 deletions docker/fedora-30/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM fedora:30

RUN dnf install -y glibc-locale-source sudo util-linux-user libxcrypt-compat \
&& dnf clean all \
&& localedef -i en_US -f UTF-8 en_US.UTF-8 \
&& useradd -m -s /bin/bash am-prompt \
&& echo 'am-prompt ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers

USER am-prompt
WORKDIR /home/am-prompt

ENV LANG=en_US.UTF-8 \
USER=am-prompt

COPY . ./
RUN ./install.sh

SHELL [ "/bin/bash", "-l" ]
RUN git-sha
Loading

0 comments on commit 0b09959

Please sign in to comment.