diff --git a/.dockerignore b/.dockerignore index 1870bf8..77c370a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,3 @@ .gitignore .dockerignore Dockerfile -README.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..30fe21f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,11 @@ +name: Dotfiles CI +on: [push] + +jobs: + tests: + name: Run test suite + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run tests + run: ./scripts/test.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 84d64ff..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,10 +0,0 @@ -on: [push] - -jobs: - tests: - runs-on: ubuntu-latest - name: tests - steps: - - uses: actions/checkout@v2 - - name: Run tests - run: make test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c6f380e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,14 @@ +name: Dotfiles publisher +on: + push: + branches: + - master + +jobs: + publish-installer: + name: Publish install script + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Publish to CDN + run: ./scripts/publish.sh diff --git a/.gitignore b/.gitignore index 2ccebbe..8c29169 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,11 @@ +# install artefacts +**/tmp +**/logs +**/*.deb + # custom functions !files/.config/fish/functions/nvm.fish -# install artefacts -tmp -logs/* -**/*.deb - # setup files **/plugged **/autoload @@ -21,10 +21,6 @@ logs/* **/firebase **/pypoetry -# pytest -**/__pycache__ -**/.pytest_cache - # ssh env **/id_rsa* **/known_hosts* diff --git a/Dockerfile b/Dockerfile index 3df46cd..2d00845 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,44 @@ -FROM ubuntu:bionic as install +# +# ubuntu-base: Base Ubuntu image with sudo user +# +FROM ubuntu:focal AS ubuntu-base -# Install sudo and make, git since built-in is skipped RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections -RUN apt-get -qqy update \ - && apt-get -qqy install curl git make software-properties-common sudo +ENV DEBIAN_FRONTEND noninteractive +RUN apt-get -qy update +RUN apt-get -qy install --no-install-recommends \ + apt-utils software-properties-common sudo # Create user with sudo priviledge -ARG USER="test-user" -RUN useradd --create-home -m "$USER" \ - && adduser "$USER" sudo -RUN echo "$USER ALL=(ALL) NOPASSWD: ALL" \ +RUN useradd -r -u 1001 --create-home -m "test-user" +RUN adduser "test-user" sudo +RUN echo "test-user ALL=(ALL) NOPASSWD: ALL" \ >>/etc/sudoers -# Filesystem steps -RUN rm /home/$USER/.profile /home/$USER/.bashrc -ENV WORKSPACE="/home/$USER/workspace" -ADD --chown=test-user . "$WORKSPACE/dotfiles" -WORKDIR "$WORKSPACE/dotfiles" -# Install steps +# +# source: Source steps +# +FROM ubuntu-base AS source + +ARG DOTFILES_DIR="/home/test-user/.dotfiles" +ADD --chown="test-user" . "$DOTFILES_DIR" +WORKDIR "$DOTFILES_DIR" + + +# +# install: Install steps +# +FROM source AS install + USER test-user -ARG TARGET="all" -ENV LOG_TARGET="STDOUT" -RUN make install TARGET=$TARGET +ENV USER=test-user +ENV UUID="docker" +RUN ./scripts/install.sh -# Test entrypoint -ENTRYPOINT [ "make", "--directory", "tests", "TARGET=$TARGET" ] + +# +# test: Test entrypoint +# +FROM install AS test +ENTRYPOINT [ "tests/run.sh" ] diff --git a/Makefile b/Makefile deleted file mode 100644 index 8bdd8d8..0000000 --- a/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# ---------------------------------------------------------------------------- # -# Local commands -# ---------------------------------------------------------------------------- # -.PHONY: clean install - -# Install dotfiles to home folder -all: - ./bootstrap.pl - -# @arg $TARGET binary to install -install: - ./install.pl - -clean: - rm -rf logs - -# ---------------------------------------------------------------------------- # -# Docker commands -# ---------------------------------------------------------------------------- # -.PHONY: build test start - -# Build and tag docker image -build: - docker build . -t dotfiles:latest - -# Run tests in docker container -# @arg $TARGET binary to install and test -test: - docker build . -t dotfiles:localtest \ - --build-arg TARGET=$$TARGET \ - && docker run dotfiles:localtest - -# Launch bash in docker container -start: - docker run -it dotfiles:latest /bin/bash diff --git a/README.md b/README.md index 4715238..65b4289 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,28 @@ -# dotfiles +# andrejusk/dotfiles Collection of experimental dotfiles and supporting install scripts. -Tested on and compatible with: - -- Ubuntu 20.04 ## Install - wget https://raw.githubusercontent.com/andrejusk/dotfiles/master/setup.pl -qO - | perl + wget https://raw.githubusercontent.com/andrejusk/dotfiles/master/scripts/setup.sh -qO - | bash ## Stack -Shell: 🐟 fish (+ fisher) +### Shell +🐟 fish (+ fisher) -Editor: neovim (+ vim-plug) +### Editor +neovim (+ vim-plug) -Tools: +### Languages -- aws, gcloud, firebase -- docker (+ docker-compose) -- kubectl -- terraform -- screenfetch - -Languages: - -- java - js (nvm, node, yarn) - python (pyenv, poetry) -- ruby +- java + +### Tools + +- docker (+ docker-compose) +- terraform +- gcloud, firebase, awscli +- screenfetch diff --git a/bootstrap.pl b/bootstrap.pl deleted file mode 100755 index 6813a0a..0000000 --- a/bootstrap.pl +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use autodie; - -use Cwd; -use Data::Dumper; -use Stow; - - -my $dir = getcwd; -my $target = $ENV{'HOME'}; -print "Stowing $dir/files to $target\n"; - -my %stow_options = ( dir => $dir, - target => $target ); -my $stow = new Stow(%stow_options); - -my @pkgs = ('files'); -$stow->plan_stow(@pkgs); -my %conflicts = $stow->get_conflicts; -if (%conflicts) { - my $dump = Dumper(%conflicts); - die("Failed to stow, conflicts: $dump"); -} -$stow->process_tasks(); diff --git a/config.json b/config.json new file mode 100644 index 0000000..9bb9624 --- /dev/null +++ b/config.json @@ -0,0 +1,21 @@ +{ + "apt_dependencies": [ + "bat", + "curl", + "cowsay", + "fd-find", + "figlet", + "fortune-mod", + "git", + "gnupg2", + "jq", + "make", + "neovim", + "net-tools", + "openssh-client", + "openssh-server", + "screenfetch", + "stow", + "tmux" + ] +} diff --git a/files/.config/nvim/plugins.vim b/files/.config/nvim/plugins.vim index 8e2b537..d4bf0fc 100644 --- a/files/.config/nvim/plugins.vim +++ b/files/.config/nvim/plugins.vim @@ -152,12 +152,17 @@ Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'} \ 'coc-perl', \ 'coc-prettier', \ 'coc-python', + \ 'coc-react-refactor', \ 'coc-rust-analyzer', \ 'coc-sh', \ 'coc-snippets', + \ 'coc-styled-components', \ 'coc-svg', + \ 'coc-swagger', \ 'coc-tabnine', \ 'coc-toml', + \ 'coc-tslint', + \ 'coc-tslint-plugin', \ 'coc-tsserver', \ 'coc-vimlsp', \ 'coc-xml', @@ -165,6 +170,10 @@ Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'} \ ] " }}} +" ts +Plug 'HerringtonDarkholme/yats.vim' +Plug 'maxmellon/vim-jsx-pretty' + " elm Plug 'andys8/vim-elm-syntax' diff --git a/files/.profile b/files/.profile index 967c1b8..1bcbe86 100644 --- a/files/.profile +++ b/files/.profile @@ -34,7 +34,6 @@ fi # pyenv export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" -export PATH="$PYENV_ROOT/shims:$PATH" if [ -d "$PYENV_ROOT" ]; then [ -x "$(command -v pyenv)" ] && eval "$(pyenv init -)" fi diff --git a/install.pl b/install.pl deleted file mode 100755 index c94e641..0000000 --- a/install.pl +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use autodie; - -use File::Basename; - -# Prevent running as root -if ($< == 0) { - print "Failed: Running as root. Please run as user, not sudo\n"; - exit (1); -} - -my $dir = dirname(__FILE__); - -my $log_target = $ENV{'LOG_TARGET'} // ''; -my $log_path = ''; -if ($log_target ne 'STDOUT') { - # Generate unique logfile - my $log_dir = "$dir/logs"; - `mkdir -p $log_dir`; - my $uuid = `uuidgen`; - chomp $uuid; - $log_path = "$log_dir/$uuid.log"; -} -print "Logs: $log_path\n"; - -# Execute given command and log appropriately -# @arg 0 command to run -sub log_execute { - my $command = $log_path ne '' - ? "$_[0] >> $log_path 2>&1" - : $_[0]; - system($command) == 0 - or die "system $command failed: $?"; -} - - -# Ensure dependencies installed -log_execute("sudo apt-get update -qqy && sudo apt-get install -qqy build-essential liblocal-lib-perl cpanminus stow"); - -# Bootstrap files -log_execute("make -C $dir"); - -# Read scripts to be installed -my $install_dir = "$dir/install"; -print "Installing $install_dir\n"; -opendir($dir, $install_dir) or die "Could not open $install_dir\n"; -my @files = readdir($dir); -closedir($dir); -@files = grep(/^\d{2}-.*\.sh$/, @files); -@files = sort { lc($a) cmp lc($b) } @files; - -# Install selected targets -my $target = $ENV{'TARGET'} // 'all'; -if ($target ne 'all') { - @files = grep(/${target}/, @files); -} -foreach my $file (@files) { - print "Running $file...\r"; - log_execute("$install_dir/$file"); -} diff --git a/install/00-apt-pkglist b/install/00-apt-pkglist deleted file mode 100644 index a9b7ec4..0000000 --- a/install/00-apt-pkglist +++ /dev/null @@ -1,19 +0,0 @@ -apt-transport-https -bat -curl -cowsay -fd-find -fortune-mod -git -gnupg2 -jq -make -neovim -net-tools -openssh-client -openssh-server -ripgrep -ruby-full -software-properties-common -tmux -universal-ctags diff --git a/install/00-apt.sh b/install/00-apt.sh deleted file mode 100755 index 6898965..0000000 --- a/install/00-apt.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - -clean -update -upgrade -echo "apt cleaned, updated, upgraded" - -package_list_file="$install_dir/00-apt-pkglist" -install_file "$package_list_file" -echo "list of dependencies installed" - -cat /etc/os-release diff --git a/install/10-pyenv.sh b/install/10-pyenv.sh deleted file mode 100755 index 1b5a5e4..0000000 --- a/install/10-pyenv.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - -# pyenv is installed -if not_installed "pyenv"; then - - echo "Installing pyenv..." - - # Install pyenv prerequisites - # see https://github.com/pyenv/pyenv/wiki/common-build-problems - pyenv_list_file="$install_dir/10-pyenv-pkglist" - install_file "$pyenv_list_file" - - # Install pyenv - # see https://github.com/pyenv/pyenv-installer - run "https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer" \ - "bash" - -fi -echo "pyenv is installed, upgrading $PYENV_ROOT..." -git --git-dir="$PYENV_ROOT/.git" fetch -q -git --git-dir="$PYENV_ROOT/.git" rebase -q --autostash FETCH_HEAD - -pyenv --version diff --git a/install/13-nvm.sh b/install/13-nvm.sh deleted file mode 100755 index 58e9729..0000000 --- a/install/13-nvm.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - -# nvm is installed -if not_installed "nvm"; then - - printf "Installing nvm...\n" - - # Install nvm - mkdir -p $NVM_DIR - run "https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh" \ - "bash" - source "$NVM_DIR/nvm.sh" - nvm alias default node - nvm install node - -fi - -printf "nvm is installed, upgrading...\n" -run "https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh" \ - "bash" - -nvm --version -nvm use node -node --version diff --git a/install/14-yarn.sh b/install/14-yarn.sh deleted file mode 100755 index 650f090..0000000 --- a/install/14-yarn.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - -# yarn is installed -if not_installed "yarn"; then - - echo "Installing yarn..." - - # Install yarn - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list - update - sudo apt install --no-install-recommends yarn - -fi - -echo "yarn is installed" -# yarn --version diff --git a/install/17-elm.sh b/install/17-elm.sh deleted file mode 100755 index 32e7b73..0000000 --- a/install/17-elm.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - -if not_installed "elm"; then - # Download the 0.19.1 binary for Linux. - # - # +-----------+----------------------+ - # | FLAG | MEANING | - # +-----------+----------------------+ - # | -L | follow redirects | - # | -o elm.gz | name the file elm.gz | - # +-----------+----------------------+ - # - curl -L -o elm.gz https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz - - # There should now be a file named `elm.gz` on your Desktop. - # - # The downloaded file is compressed to make it faster to download. - # This next command decompresses it, replacing `elm.gz` with `elm`. - # - gunzip elm.gz - - # There should now be a file named `elm` on your Desktop! - # - # Every file has "permissions" about whether it can be read, written, or executed. - # So before we use this file, we need to mark this file as executable: - # - chmod +x elm - - # The `elm` file is now executable. That means running `~/Desktop/elm --help` - # should work. Saying `./elm --help` works the same. - # - # But we want to be able to say `elm --help` without specifying the full file - # path every time. We can do this by moving the `elm` binary to one of the - # directories listed in your `PATH` environment variable: - # - sudo mv elm /usr/local/bin/ - rm {elm,elm.gz} -fi - -npm install -g @elm-tooling/elm-language-server elm-format elm-test diff --git a/install/35-kubectl.sh b/install/35-kubectl.sh deleted file mode 100755 index 6458fa1..0000000 --- a/install/35-kubectl.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - -if not_installed "kubectl"; then - echo "Installing kubectl..." - sudo apt-get update && sudo apt-get install -y apt-transport-https gnupg2 - - curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - - - echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list - - update - - install kubectl - refresh -fi diff --git a/install/98-apt-clean.sh b/install/98-apt-clean.sh deleted file mode 100755 index 3ebe748..0000000 --- a/install/98-apt-clean.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - -echo "cleaning" -clean diff --git a/install/99-screenfetch.sh b/install/99-screenfetch.sh deleted file mode 100755 index 046e94b..0000000 --- a/install/99-screenfetch.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - -if not_installed "screenfetch"; then - echo "Installing screenfetch..." - install screenfetch -fi - -echo "screenfetch is installed" -screenfetch --version -screenfetch diff --git a/install/utils.sh b/install/utils.sh deleted file mode 100755 index 9f32904..0000000 --- a/install/utils.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env bash -# ---------------------------------------------------------------------------- # -# Helper functions -# ---------------------------------------------------------------------------- # -clean() { - sudo apt-get clean -} - -update() { - sudo apt-get update -} - -# Non-interactive upgrade -upgrade() { - DEBIAN_FRONTEND=noninteractive \ - sudo apt-get \ - -o Dpkg::Options::="--force-confdef" \ - -o Dpkg::Options::="--force-confold" \ - -y \ - dist-upgrade - sudo apt-get -y autoremove -} - -# @arg $1 packages to install -install() { - sudo apt-get install -qqy $1 - refresh -} - -# @arg $1 package list file to install -install_file() { - sudo apt-get install -qqyf $(cat $1) - refresh -} - -# @arg $1 repository to add -add_ppa() { - sudo add-apt-repository -y ppa:$1 -} - -# @arg $1 url to add -# @arg $2 keyring to add to -add_key() { - curl -fsSL $1 | sudo apt-key --keyring "/etc/apt/trusted.gpg.d/$2.gpg" add -} - -# @arg $1 URL to run -# @arg $2 binary to use -run() { - curl -fsSL $1 | $2 | indent -} - -# Symlink contents of source folder to target -# -# @arg $1 source folder -# @arg $2 target folder -link_folder() { - mkdir -p $2 - cp -srf $1/. $2 -} - -indent() { sed 's/^/ /'; } - -# @arg $1 binary to test -not_installed() { - ! [ -x "$(command -v $1)" ] -} - -# Refreshes PATH -refresh() { - hash -r -} - -# Add to PATH and refresh -# @arg $1 path to add to PATH -add_path() { - export PATH="$1:$PATH" - refresh -} - -export -f clean update upgrade install install_file add_ppa add_key run \ - link_folder indent not_installed refresh add_path - -# ---------------------------------------------------------------------------- # -# Shell colours -# ---------------------------------------------------------------------------- # -C_BLACK='\033[0;30m' -C_DGRAY='\033[1;30m' -C_RED='\033[0;31m' -C_LRED='\033[1;31m' -C_GREEN='\033[0;32m' -C_LGREEN='\033[1;32m' -C_ORANGE='\033[0;33m' -C_YELLOW='\033[1;33m' -C_BLUE='\033[0;34m' -C_LBLUE='\033[1;34m' -C_PURPLE='\033[0;35m' -C_LPURPLE='\033[1;35m' -C_CYAN='\033[0;36m' -C_LCYAN='\033[1;36m' -C_LGRAY='\033[0;37m' -C_WHITE='\033[1;37m' -C_NC='\033[0m' - -# ---------------------------------------------------------------------------- # -# Helper variables # -# ---------------------------------------------------------------------------- # -export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring -install_dir="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" -dotfiles_dir="$(dirname "$install_dir")" -source "$dotfiles_dir/files/.bash_profile" -refresh diff --git a/modules/published-dots/main.tf b/modules/published-dots/main.tf new file mode 100644 index 0000000..003d04d --- /dev/null +++ b/modules/published-dots/main.tf @@ -0,0 +1,36 @@ +# Static bucket +resource "google_storage_bucket" "bucket" { + provider = google-beta + + project = var.project + + name = var.domain + location = "EU" + storage_class = "MULTI_REGIONAL" + + versioning { + enabled = var.enable_versioning + } +} + +# Allow public read +resource "google_storage_default_object_acl" "bucket_acl" { + provider = google-beta + bucket = google_storage_bucket.bucket.name + role_entity = ["READER:allUsers"] +} + +# DNS entry +resource "google_dns_record_set" "cname" { + provider = google-beta + + depends_on = [google_storage_bucket.bucket] + + project = var.project + + name = "${var.domain}." + managed_zone = var.dns_zone + type = "CNAME" + ttl = 300 + rrdatas = ["c.storage.googleapis.com."] +} diff --git a/modules/published-dots/outputs.tf b/modules/published-dots/outputs.tf new file mode 100644 index 0000000..a0639ac --- /dev/null +++ b/modules/published-dots/outputs.tf @@ -0,0 +1,7 @@ +output "bucket_url" { + value = "storage.googleapis.com/${var.domain}" +} + +output "bucket_link" { + value = google_storage_bucket.bucket.self_link +} diff --git a/modules/published-dots/variables.tf b/modules/published-dots/variables.tf new file mode 100644 index 0000000..39fbdd9 --- /dev/null +++ b/modules/published-dots/variables.tf @@ -0,0 +1,14 @@ +variable "project" { + description = "Google Cloud project to host resources in" + type = string +} + +variable "domain" { + description = "DNS name to serve static content" + type = string +} + +variable "dns_zone" { + description = "Cloud DNS zone to use" + type = string +} diff --git a/scripts/_utils.sh b/scripts/_utils.sh new file mode 100755 index 0000000..b09ddbc --- /dev/null +++ b/scripts/_utils.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash +function apt_update { + sudo apt-get update +} + +# @arg $1 debian package to install if not present +function apt_install { + if ! dpkg -s $1; then + sudo apt-get install -y $1 + fi +} + +# ---------------------------------------------------------------------------- # +# Helper functions +# ---------------------------------------------------------------------------- # +clean() { + sudo apt-get clean +} + +update() { + apt_update +} + +# @arg $1 packages to install +install() { + apt_install $1 + refresh +} + +# @arg $1 package list file to install +install_file() { + sudo apt-get install -qqyf $(cat $1) + refresh +} + +# @arg $1 repository to add +add_ppa() { + sudo add-apt-repository -y ppa:$1 +} + +# @arg $1 url to add +# @arg $2 keyring to add to +add_key() { + curl -fsSL $1 \ + | sudo gpg --no-default-keyring --keyring $2 --import - +} + +# @arg $1 URL to run +# @arg $2 binary to use +run() { + curl -fsSL $1 | $2 +} + +# Symlink contents of source folder to target +# +# @arg $1 source folder +# @arg $2 target folder +link_folder() { + mkdir -p $2 + cp -srf $1/. $2 +} + +# @arg $1 binary to test +not_installed() { + ! [ -x "$(command -v $1)" ] +} + +# Refreshes PATH +refresh() { + hash -r +} + +# Add to PATH and refresh +# @arg $1 path to add to PATH +add_path() { + export PATH="$1:$PATH" + refresh +} diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh new file mode 100755 index 0000000..9ad8030 --- /dev/null +++ b/scripts/bootstrap.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -eo pipefail + +NAME=`basename "$0"` +REL_DIR=`dirname "$0"` +ABS_DIR=`readlink -f $REL_DIR/../` # Scripts are nested inside of /scripts + +# TODO +# Migrate to config.fish +rm $HOME/.bashrc +rm $HOME/.profile + +echo "Stowing $ABS_DIR to $HOME" +stow --dir=$ABS_DIR --target=$HOME files diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..5cff4fe --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +set -eo pipefail + +TIME=${TIME:-`date`} +UUID=${UUID:-`uuidgen`} +HOST=${HOST:-`hostname`} + +NAME=`basename "$0"` +REL_DIR=`dirname "$0"` +ABS_DIR=`readlink -f $REL_DIR/../` # Scripts are nested inside of /scripts + +LOG_DIR="$ABS_DIR/logs" +mkdir -p $LOG_DIR +LOG_TARGET=${LOG_TARGET:-$LOG_DIR/$UUID.log} + + +main() { + echo "Running $NAME at $TIME" + echo "Running as $USER on $HOST" + + # Prevent running as root + if [[ $EUID -eq 0 ]]; then + echo "Failed: Running as sudo. Please run as user" + exit 1 + fi + + echo "Loading utils" + source $REL_DIR/_utils.sh + + apt_update + + echo "Installing jq..." + apt_install jq + + echo "Installing apt dependencies..." + for dep in `jq -r ".apt_dependencies[]" $ABS_DIR/config.json`; do + apt_install $dep + done + + figlet -c "bootstrapping..." + $ABS_DIR/scripts/bootstrap.sh + source $HOME/.profile + + figlet -c "installing..." + export INSTALL_DIR="$REL_DIR/install" + for script in $INSTALL_DIR/*.sh; do + figlet -c `basename $script` + source $script + done + +} + +echo "main: Logging to $LOG_TARGET" +main 2>&1 |tee $LOG_TARGET diff --git a/scripts/install/00-apt-pkglist b/scripts/install/00-apt-pkglist new file mode 100644 index 0000000..dc5ae72 --- /dev/null +++ b/scripts/install/00-apt-pkglist @@ -0,0 +1,4 @@ +apt-transport-https +software-properties-common +ripgrep +universal-ctags diff --git a/scripts/install/00-apt.sh b/scripts/install/00-apt.sh new file mode 100755 index 0000000..b46d373 --- /dev/null +++ b/scripts/install/00-apt.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +cat /etc/os-release diff --git a/install/02-fish.sh b/scripts/install/02-fish.sh similarity index 52% rename from install/02-fish.sh rename to scripts/install/02-fish.sh index 5affbd6..5b32c08 100755 --- a/install/02-fish.sh +++ b/scripts/install/02-fish.sh @@ -1,22 +1,15 @@ #!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - if not_installed "fish"; then - echo "installing fish..." add_ppa "fish-shell/release-3" update install fish fi - -echo "fish is installed" fish --version -fisher_location="$XDG_CONFIG_HOME/fish/functions/fisher.fish" +fisher_location="$HOME/.config/fish/functions/fisher.fish" if ! [ -f "$fisher_location" ]; then - echo "Installing fisher..." curl https://git.io/fisher --create-dirs -sLo "$fisher_location" + fish -c "fisher install jorgebucaran/fisher" fi -echo "fisher is installed, updating..." -fish -c "fisher update"; fish -c "fisher --version" diff --git a/install/03-ssh.sh b/scripts/install/03-ssh.sh similarity index 64% rename from install/03-ssh.sh rename to scripts/install/03-ssh.sh index ad40637..e2cb887 100755 --- a/install/03-ssh.sh +++ b/scripts/install/03-ssh.sh @@ -1,14 +1,9 @@ #!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - -# ssh key exists ssh_target="$HOME/.ssh" ssh_key="$ssh_target/id_rsa" ssh_pub="$ssh_key.pub" if [ ! -f "$ssh_key" ]; then - echo "generating ssh key..." ssh-keygen -t rsa -b 4096 -f "$ssh_key" fi -echo "ssh key exists" cat "$ssh_pub" diff --git a/install/10-pyenv-pkglist b/scripts/install/10-pyenv-pkglist similarity index 83% rename from install/10-pyenv-pkglist rename to scripts/install/10-pyenv-pkglist index df0cd09..6f13840 100644 --- a/install/10-pyenv-pkglist +++ b/scripts/install/10-pyenv-pkglist @@ -2,9 +2,9 @@ build-essential libssl-dev libbz2-dev libreadline-dev -libreadline6 -libreadline6-dev libsqlite3-dev +libxml2-dev +libxmlsec1-dev llvm libncurses5-dev libncursesw5-dev diff --git a/scripts/install/10-pyenv.sh b/scripts/install/10-pyenv.sh new file mode 100755 index 0000000..9dcb604 --- /dev/null +++ b/scripts/install/10-pyenv.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +if not_installed "pyenv"; then + # see https://github.com/pyenv/pyenv/wiki/common-build-problems + pyenv_list_file="$INSTALL_DIR/10-pyenv-pkglist" + install_file "$pyenv_list_file" + + # see https://github.com/pyenv/pyenv-installer + run "https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer" \ + bash +fi + +export PATH="$HOME/.pyenv/bin:$PATH" +eval "$(pyenv init -)" +eval "$(pyenv virtualenv-init -)" + +pyenv update + +pyenv --version diff --git a/install/11-python.sh b/scripts/install/11-python.sh similarity index 50% rename from install/11-python.sh rename to scripts/install/11-python.sh index cad75be..df5c72e 100755 --- a/install/11-python.sh +++ b/scripts/install/11-python.sh @@ -1,18 +1,12 @@ #!/usr/bin/env bash -source "$(dirname $0)/utils.sh" export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring -# python3 and pip3 are installed if not_installed "pip3"; then - - echo "Installing python3 and pip3..." - - pyenv install 3.7.0 - pyenv global 3.7.0 + pyenv install 3.9.0 + pyenv global 3.9.0 refresh - fi -echo "python3 and pip3 are installed, upgrading..." + pip install --upgrade pip pip3 install --upgrade pip python3 --version diff --git a/install/12-poetry.sh b/scripts/install/12-poetry.sh similarity index 55% rename from install/12-poetry.sh rename to scripts/install/12-poetry.sh index 86a0b9e..73c87fb 100755 --- a/install/12-poetry.sh +++ b/scripts/install/12-poetry.sh @@ -1,16 +1,10 @@ #!/usr/bin/env bash -source "$(dirname $0)/utils.sh" export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring +add_path "$HOME/.local/bin" -# poetry is installed if not_installed "poetry"; then - - printf "Installing poetry...\n" - - # Install poetry pip3 install --user poetry - fi -printf "poetry is installed, upgrading...\n" + pip3 install --upgrade poetry poetry --version diff --git a/scripts/install/13-nvm.sh b/scripts/install/13-nvm.sh new file mode 100755 index 0000000..a840577 --- /dev/null +++ b/scripts/install/13-nvm.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +run "https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh" \ + "bash" + +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm + +nvm --version +nvm install node +nvm use node + +node --version diff --git a/scripts/install/14-yarn.sh b/scripts/install/14-yarn.sh new file mode 100755 index 0000000..ef25ac3 --- /dev/null +++ b/scripts/install/14-yarn.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +if not_installed "yarn"; then + add_key https://dl.yarnpkg.com/debian/pubkey.gpg + echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list + update + sudo apt install --no-install-recommends yarn +fi + +yarn --version diff --git a/install/15-java.sh b/scripts/install/15-java.sh similarity index 51% rename from install/15-java.sh rename to scripts/install/15-java.sh index fd88936..da89aa6 100755 --- a/install/15-java.sh +++ b/scripts/install/15-java.sh @@ -1,10 +1,6 @@ #!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - if not_installed "java"; then - echo "Installing java..." install default-jre fi -echo "java is installed" java --version diff --git a/install/16-vim.sh b/scripts/install/16-vim.sh similarity index 92% rename from install/16-vim.sh rename to scripts/install/16-vim.sh index aaaf908..2b950a8 100755 --- a/install/16-vim.sh +++ b/scripts/install/16-vim.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash -source "$(dirname $0)/utils.sh" export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring mkdir -p "$XDG_DATA_HOME/nvim/backup" @@ -13,7 +12,6 @@ echo "Installing neovim support"; pip3 install --user neovim pynvim 'python-language-server[all]' nvm use default npm install -g neovim -sudo gem install neovim echo "Running PlugInstall"; nvim --headless +UpdateRemotePlugins +PlugClean! +PlugInstall +PlugUpgrade +PlugUpdate +qall diff --git a/install/30-docker.sh b/scripts/install/30-docker.sh similarity index 60% rename from install/30-docker.sh rename to scripts/install/30-docker.sh index e758e21..208befe 100755 --- a/install/30-docker.sh +++ b/scripts/install/30-docker.sh @@ -1,13 +1,6 @@ #!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - -# docker is installed DOCKER_FOLDER="$HOME/.docker" if not_installed "docker"; then - - printf "Installing docker...\n" - - # Create folder mkdir -p "$DOCKER_FOLDER" # Requirements @@ -15,8 +8,9 @@ if not_installed "docker"; then software-properties-common # Add repository - distro=$(lsb_release -si | tr '[:upper:]' '[:lower:]') # cast to lowercase - add_key "https://download.docker.com/linux/$distro/gpg" "docker-apt-key" + distro=$(lsb_release -si | tr "[:upper:]" "[:lower:]") # cast to lowercase + add_key "https://download.docker.com/linux/$distro/gpg" \ + "gnupg-ring:/etc/apt/trusted.gpg.d/docker-apt-key.gpg" sudo add-apt-repository -y \ "deb [arch=amd64] https://download.docker.com/linux/$distro \ $(lsb_release -cs) \ @@ -31,31 +25,19 @@ if not_installed "docker"; then sudo chmod g+rwx "$DOCKER_FOLDER" -R fi -printf "docker is installed\n" docker --version -# docker-compose if installed if not_installed "docker-compose"; then - - printf "Installing docker-compose...\n" - - # Docker-compose pip3 install --user docker-compose - fi -printf "docker-compose is installed, upgrading\n" pip3 install --upgrade docker-compose docker-compose --version -# docker group exists -readonly docker_group='docker' +readonly docker_group="docker" if ! grep -q "$docker_group" /etc/group; then sudo groupadd "$docker_group" fi -printf "group '$docker_group' is created\n" -# user is in docker group if ! groups "$USER" | grep -q "\b$docker_group\b"; then sudo usermod -aG docker "$USER" fi -printf "user '$USER' is in '$docker_group' group\n" diff --git a/install/31-gcloud.sh b/scripts/install/31-gcloud.sh similarity index 54% rename from install/31-gcloud.sh rename to scripts/install/31-gcloud.sh index 5f60ce5..f1b25f3 100755 --- a/install/31-gcloud.sh +++ b/scripts/install/31-gcloud.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - if not_installed "gcloud"; then echo "Installing gcloud..." # Add the Cloud SDK distribution URI as a package source - echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list + echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" \ + | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list # Import the Google Cloud Platform public key - curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \ + | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - update install google-cloud-sdk refresh diff --git a/install/32-firebase.sh b/scripts/install/32-firebase.sh similarity index 75% rename from install/32-firebase.sh rename to scripts/install/32-firebase.sh index d64f237..cdd1e0c 100755 --- a/install/32-firebase.sh +++ b/scripts/install/32-firebase.sh @@ -1,8 +1,5 @@ #!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - if not_installed "firebase"; then - echo "Installing firebase..." run "https://firebase.tools" "bash" fi diff --git a/install/33-aws.sh b/scripts/install/33-aws.sh similarity index 91% rename from install/33-aws.sh rename to scripts/install/33-aws.sh index b12087e..d96dc64 100755 --- a/install/33-aws.sh +++ b/scripts/install/33-aws.sh @@ -1,6 +1,4 @@ #!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" temp_dir=$(mktemp -d) unzip awscliv2.zip -d "$temp_dir" diff --git a/install/34-terraform.sh b/scripts/install/34-terraform.sh similarity index 96% rename from install/34-terraform.sh rename to scripts/install/34-terraform.sh index 42f3fc6..e5f20bf 100755 --- a/install/34-terraform.sh +++ b/scripts/install/34-terraform.sh @@ -1,6 +1,4 @@ #!/usr/bin/env bash -source "$(dirname $0)/utils.sh" - tf_version="0.14.6" if not_installed "terraform"; then echo "Installing terraform..." diff --git a/scripts/install/98-apt-clean.sh b/scripts/install/98-apt-clean.sh new file mode 100755 index 0000000..00c4492 --- /dev/null +++ b/scripts/install/98-apt-clean.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +clean diff --git a/scripts/install/99-screenfetch.sh b/scripts/install/99-screenfetch.sh new file mode 100755 index 0000000..7563217 --- /dev/null +++ b/scripts/install/99-screenfetch.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +screenfetch diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100644 index 0000000..a070b6b --- /dev/null +++ b/scripts/publish.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -eo pipefail + +echo "Publishing..." diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100755 index 0000000..f9f461b --- /dev/null +++ b/scripts/setup.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -eo pipefail + +# GitHub repository details +AUTHOR=${AUTHOR:-andrejusk} +REPOSITORY=${REPOSITORY:-dotfiles} +BRANCH=${BRANCH:-master} +echo "Using repository $AUTHOR/$REPOSITORY at $BRANCH" + +# Target folder to checkout to +DOTFILES_DIR=${DOTFILES_DIR:-$HOME/.dotfiles} +mkdir -p $DOTFILES_DIR +if [ -z `ls -A $DOTFILES_DIR` ]; then + echo "Setting up $DOTFILES_DIR" +else + echo "Failed: Setup directory not empty $DOTFILES_DIR" + exit 1 +fi + +# Download and untar repo +tmp_dir=`mktemp -d` +tmp_dest="$tmp_dir/dotfiles.tar.gz" +wget "https://github.com/$AUTHOR/$REPOSITORY/archive/$BRANCH.tar.gz" -qO $tmp_dest +tar -C $tmp_dir -zxf $tmp_dest +mv $tmp_dir/$REPOSITORY-$BRANCH/* $DOTFILES_DIR +rm -rf $tmp_dir + +echo "Done!" +$DOTFILES_DIR/scripts/install.sh diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 0000000..efbaf93 --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -euo pipefail + +tag=`uuidgen` +docker build . \ + -t dotfiles:$tag \ + --target test + +docker run dotfiles:$tag diff --git a/setup.pl b/setup.pl deleted file mode 100755 index 4a39524..0000000 --- a/setup.pl +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; - - -use Archive::Tar; -use File::Copy; -use File::Temp (); -use IPC::System::Simple qw(capture); -use LWP::Simple; - - -print "Setting up...\n"; - -# GitHub repository to clone -my $author = $ENV{'DOTFILES_AUTHOR'} // 'andrejusk'; -my $repository = $ENV{'DOTFILES_REPOSITORY'} // 'dotfiles'; -my $branch = $ENV{'DOTFILES_BRANCH'} // 'master'; -print "Using repository $author/$repository at $branch\n"; - -# Install location -my $dotfiles_dir = $ENV{'DOTFILES_DIR'} // "$ENV{'HOME'}/.dotfiles"; - -# Download repo -my $repository_url = "https://github.com/$author/$repository/archive/$branch.tar.gz"; -my $temp_handle = File::Temp->new(); -my $repository_temp = $temp_handle->filename; -print "Downloading $repository_url to $repository_temp\n"; -getstore($repository_url, $repository_temp); - -# Extract repo -my $temp_dir = File::Temp->newdir(); -my $tar = Archive::Tar->new; -print "Extracting $repository_temp to $temp_dir\n"; -$tar->read($repository_temp); -$tar->setcwd($temp_dir); -$tar->extract(); - -# Move dotfiles out of temporary dir -my $temp_dotfiles_dir = "$temp_dir/$repository-$branch"; -print "Moving $temp_dotfiles_dir to $dotfiles_dir\n"; -move($temp_dotfiles_dir, $dotfiles_dir); - -# Install repo -print "Running installer\n"; -`$dotfiles_dir/install.pl`; diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..294c9cb --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,3 @@ +# pytest +**/__pycache__ +**/.pytest_cache diff --git a/tests/.python-version b/tests/.python-version index 7c69a55..a5c4c76 100644 --- a/tests/.python-version +++ b/tests/.python-version @@ -1 +1 @@ -3.7.0 +3.9.0 diff --git a/tests/Makefile b/tests/Makefile deleted file mode 100644 index 25e5223..0000000 --- a/tests/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -SHELL := /bin/bash -all: - poetry install - poetry run pytest diff --git a/tests/poetry.lock b/tests/poetry.lock index d926550..6377a43 100644 --- a/tests/poetry.lock +++ b/tests/poetry.lock @@ -1,19 +1,18 @@ [[package]] -category = "dev" -description = "Atomic file writes." -marker = "sys_platform == \"win32\"" name = "atomicwrites" +version = "1.3.0" +description = "Atomic file writes." +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "1.3.0" [[package]] -category = "dev" -description = "Classes Without Boilerplate" name = "attrs" +version = "19.3.0" +description = "Classes Without Boilerplate" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "19.3.0" [package.extras] azure-pipelines = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "pytest-azurepipelines"] @@ -22,22 +21,20 @@ docs = ["sphinx", "zope.interface"] tests = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"] [[package]] -category = "dev" -description = "Cross-platform colored terminal text." -marker = "sys_platform == \"win32\"" name = "colorama" +version = "0.4.3" +description = "Cross-platform colored terminal text." +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "0.4.3" [[package]] -category = "dev" -description = "Read metadata from Python packages" -marker = "python_version < \"3.8\"" name = "importlib-metadata" +version = "1.5.0" +description = "Read metadata from Python packages" +category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" -version = "1.5.0" [package.dependencies] zipp = ">=0.5" @@ -47,115 +44,130 @@ docs = ["sphinx", "rst.linker"] testing = ["packaging", "importlib-resources"] [[package]] -category = "dev" -description = "More routines for operating on iterables, beyond itertools" name = "more-itertools" +version = "8.2.0" +description = "More routines for operating on iterables, beyond itertools" +category = "dev" optional = false python-versions = ">=3.5" -version = "8.2.0" [[package]] -category = "dev" -description = "Core utilities for Python packages" name = "packaging" +version = "20.1" +description = "Core utilities for Python packages" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "20.1" [package.dependencies] pyparsing = ">=2.0.2" six = "*" [[package]] -category = "dev" -description = "plugin and hook calling mechanisms for python" name = "pluggy" +version = "0.13.1" +description = "plugin and hook calling mechanisms for python" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "0.13.1" [package.dependencies] -[package.dependencies.importlib-metadata] -python = "<3.8" -version = ">=0.12" +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} [package.extras] dev = ["pre-commit", "tox"] [[package]] -category = "dev" -description = "library with cross-python path, ini-parsing, io, code, log facilities" name = "py" +version = "1.8.1" +description = "library with cross-python path, ini-parsing, io, code, log facilities" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "1.8.1" [[package]] -category = "dev" -description = "Python parsing module" name = "pyparsing" +version = "2.4.6" +description = "Python parsing module" +category = "dev" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" -version = "2.4.6" [[package]] -category = "dev" -description = "pytest: simple powerful testing with Python" name = "pytest" +version = "5.3.5" +description = "pytest: simple powerful testing with Python" +category = "dev" optional = false python-versions = ">=3.5" -version = "5.3.5" [package.dependencies] -atomicwrites = ">=1.0" +atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} attrs = ">=17.4.0" -colorama = "*" +colorama = {version = "*", markers = "sys_platform == \"win32\""} +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} more-itertools = ">=4.0.0" packaging = "*" pluggy = ">=0.12,<1.0" py = ">=1.5.0" wcwidth = "*" -[package.dependencies.importlib-metadata] -python = "<3.8" -version = ">=0.12" - [package.extras] -checkqa-mypy = ["mypy (v0.761)"] +checkqa-mypy = ["mypy (==v0.761)"] testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] [[package]] +name = "pytest-parallel" +version = "0.1.0" +description = "a pytest plugin for parallel and concurrent testing" category = "dev" -description = "Python 2 and 3 compatibility utilities" -name = "six" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" -version = "1.14.0" - -[[package]] -category = "dev" -description = "Measures number of Terminal column cells of wide-character codes" -name = "wcwidth" optional = false python-versions = "*" -version = "0.1.8" + +[package.dependencies] +pytest = ">=3.0.0" +tblib = "*" [[package]] +name = "six" +version = "1.14.0" +description = "Python 2 and 3 compatibility utilities" category = "dev" -description = "Backport of pathlib-compatible object wrapper for zip files" -marker = "python_version < \"3.8\"" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" + +[[package]] +name = "tblib" +version = "1.7.0" +description = "Traceback serialization library." +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[[package]] +name = "wcwidth" +version = "0.1.8" +description = "Measures number of Terminal column cells of wide-character codes" +category = "dev" +optional = false +python-versions = "*" + +[[package]] name = "zipp" +version = "3.0.0" +description = "Backport of pathlib-compatible object wrapper for zip files" +category = "dev" optional = false python-versions = ">=3.6" -version = "3.0.0" [package.extras] docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["jaraco.itertools", "func-timeout"] [metadata] -content-hash = "76f248e0ec62688089444c71c5e62af7c3ca83978a893d09e6592e3621985fab" +lock-version = "1.1" python-versions = "^3.7" +content-hash = "74334db56ae752441434e742efb55e7b5499d3757b7ba674261897cb0b77c741" [metadata.files] atomicwrites = [ @@ -198,10 +210,18 @@ pytest = [ {file = "pytest-5.3.5-py3-none-any.whl", hash = "sha256:ff615c761e25eb25df19edddc0b970302d2a9091fbce0e7213298d85fb61fef6"}, {file = "pytest-5.3.5.tar.gz", hash = "sha256:0d5fe9189a148acc3c3eb2ac8e1ac0742cb7618c084f3d228baaec0c254b318d"}, ] +pytest-parallel = [ + {file = "pytest-parallel-0.1.0.tar.gz", hash = "sha256:4663a8fb805ac98b51e51de84d35ffd9717017fb71ed270440dc94b862466c20"}, + {file = "pytest_parallel-0.1.0-py3-none-any.whl", hash = "sha256:10693161e350b59466ca331bad964073555cda114cc0499bd826deeceee512ed"}, +] six = [ {file = "six-1.14.0-py2.py3-none-any.whl", hash = "sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c"}, {file = "six-1.14.0.tar.gz", hash = "sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a"}, ] +tblib = [ + {file = "tblib-1.7.0-py2.py3-none-any.whl", hash = "sha256:289fa7359e580950e7d9743eab36b0691f0310fce64dee7d9c31065b8f723e23"}, + {file = "tblib-1.7.0.tar.gz", hash = "sha256:059bd77306ea7b419d4f76016aef6d7027cc8a0785579b5aad198803435f882c"}, +] wcwidth = [ {file = "wcwidth-0.1.8-py2.py3-none-any.whl", hash = "sha256:8fd29383f539be45b20bd4df0dc29c20ba48654a41e661925e612311e9f3c603"}, {file = "wcwidth-0.1.8.tar.gz", hash = "sha256:f28b3e8a6483e5d49e7f8949ac1a78314e740333ae305b4ba5defd3e74fb37a8"}, diff --git a/tests/pyproject.toml b/tests/pyproject.toml index 4ef3159..fff4231 100644 --- a/tests/pyproject.toml +++ b/tests/pyproject.toml @@ -9,6 +9,7 @@ python = "^3.7" [tool.poetry.dev-dependencies] pytest = "^5.3.5" +pytest-parallel = "^0.1.0" [build-system] requires = ["poetry>=0.12"] diff --git a/tests/run.sh b/tests/run.sh new file mode 100644 index 0000000..99e15bc --- /dev/null +++ b/tests/run.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -euo pipefail + +poetry install +poetry run pytest diff --git a/tests/test_binaries.py b/tests/test_binaries.py index 835845b..427d160 100644 --- a/tests/test_binaries.py +++ b/tests/test_binaries.py @@ -67,7 +67,6 @@ binaries: List[str] = [ "node", "npm", "yarn", - # "elm", # language: java "java",