Add GitHub workflows for test and release

Also:
 - Fix test scenario that failed due
   to fuzzy completions
 - Bump Cucumber

Fixes #36
This commit is contained in:
Raphael Reitzig 2020-12-14 03:25:46 +01:00
parent 04ecbe7361
commit 244456c681
9 changed files with 205 additions and 15 deletions

30
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,30 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
name: "Create Release"
runs-on: ubuntu-latest
steps:
- name: Is pre-release?
id: is_pre_release
run: |
version="${GITHUB_REF#refs/tags/}"
if [[ "${version}" =~ -.*$ ]]; then
echo ::set-output name=IS_PRERELEASE::true
else
echo ::set-output name=IS_PRERELEASE::false
fi
- name: Release
uses: docker://antonyurchenko/git-release:v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRAFT_RELEASE: "false"
PRE_RELEASE: ${{ steps.is_pre_release.outputs.IS_PRERELEASE }}
CHANGELOG_FILE: "CHANGELOG.md"
ALLOW_EMPTY_CHANGELOG: "false"
ALLOW_TAG_PREFIX: "true"

93
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,93 @@
name: Tests
on:
push:
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
tests:
name: "Scenarios"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- 'ubuntu-20.04'
- 'macos-latest'
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Install Test Dependencies
working-directory: test
run: |
gem install bundler
bundle install
- name: Install SDKMAN!
run: |
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk version
- name: Install fish (Linux)
if: matrix.os == 'ubuntu-20.04'
uses: fish-actions/install-fish@v1.0.0
- name: Install fish (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install fish
- name: Install sdkman-for-fish
shell: fish "{0}"
run: |
fish --version
curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
fisher install .
- name: Confirm install
shell: fish "{0}"
run: |
fish --version
sdk version
- name: Run Tests
working-directory: test
run: |
cucumber --publish-quiet
confirm-installation:
name: "Check fisher install"
runs-on: ubuntu-latest
steps:
- name: Install fish
uses: fish-actions/install-fish@v1.0.0
- name: Install SDKMAN!
run: |
curl -s "https://get.sdkman.io" | bash
- name: Install fisher
shell: fish "{0}"
run: |
fish --version
curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
fisher --version
- name: Install sdkman-for-fish
shell: fish "{0}"
run: |
fisher install reitzig/sdkman-for-fish
- name: Confirm install
shell: fish "{0}"
run: |
fisher ls
sdk version

61
CHANGELOG.md Normal file
View file

@ -0,0 +1,61 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and
this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.0.0] - upcoming
### Breaking
- Drop (explicit) support for Fish 2
### Features
- Compatibility with SDKMAN! 5.9.2
- Completions for `env`, `home`, `flush` (issue #35)
- Correct behaviour of `env clear`.
- TODO: autoenv (issue #38)
- TODO: custom SDKMAN! install path (issue #34)
- Compatibility with fisher 4 (PR #37, #39)
## [1.4.0] - 2019-11-06
### Features
- Compatibility with macOS (issue #29)
## [1.3.0] - 2019-11-05
### Features
- Install SDKMAN! if missing (issue #26)
## [1.2.0] - 2019-07-31
### Features
- Compatibility with fish 3 (issue #27)
## [1.1.2] - 2019-01-06
### Fixes
- Re-initialize if user has changed (issue #25)
## [1.1.1] - 2018-11-09
### Fixes
- Set `_HOME` environment variables (issue #24)
## [1.1.0] - 2018-10-08
### Features
- Compatibility with fisher 3 (PR #22)
## [1.0.0] - 2018-07-21
Initial release.

View file

@ -1,27 +1,30 @@
# SDKMAN! for fish # SDKMAN! for fish
[![Build Status][travis-badge]][travis-link] [![license](https://img.shields.io/github/license/reitzig/sdkman-for-fish.svg)](https://github.com/reitzig/sdkman-for-fish/blob/master/LICENSE)
[![release](https://img.shields.io/github/release/reitzig/sdkman-for-fish.svg)](https://github.com/reitzig/sdkman-for-fish/releases/latest)
[![GitHub release date](https://img.shields.io/github/release-date/reitzig/sdkman-for-fish.svg)](https://github.com/reitzig/sdkman-for-fish/releases)
![Tests](https://github.com/reitzig/sdkman-for-fish/workflows/Tests/badge.svg?branch=master)
Makes command `sdk` from [SDKMAN!] usable from [fish], including auto-completion. Makes command `sdk` from [SDKMAN!] usable from [fish], including auto-completion.
Also adds binaries from installed SDKs to the PATH. Also adds binaries from installed SDKs to the PATH.
Version 1.4.0 tested with Version 2.0.0 has been tested with
- fish 2.7.1 and 3.1.2, and - fish 3.1, and
- SDKMAN! 5.9.1, on - SDKMAN! 5.9, on
- Ubuntu 18.04 LTS and macOS 10.13 - Ubuntu 20.04 LTS and macOS 10.15
## Install ## Install
With [fisher] (install separately): With [fisher] (install separately):
``` ```
fisher add reitzig/sdkman-for-fish@v1.4.0 fisher add reitzig/sdkman-for-fish@v2.0.0
``` ```
_Note:_ _Note:_
- Only compatible with fisher v3 upwards; v2 is no longer supported. - Only compatible with fisher v4 upwards; v3 is no longer supported.
- You have to install [SDKMAN!] separately. - You have to install [SDKMAN!] separately.
## Usage ## Usage

View file

@ -1,4 +1,4 @@
FROM ruby:2.5.8-slim-buster FROM ruby:2.7-slim-buster
# Install dependencies # Install dependencies
RUN apt-get update \ RUN apt-get update \
@ -7,6 +7,8 @@ RUN apt-get update \
curl \ curl \
unzip \ unzip \
zip \ zip \
ruby-dev \
build-essential \
&& apt-get clean && apt-get clean
WORKDIR app WORKDIR app
@ -38,4 +40,4 @@ RUN ls -R $TEST_HOME/.config/fish/
# Run tests # Run tests
COPY test ./ COPY test ./
ENTRYPOINT ["cucumber"] ENTRYPOINT ["cucumber"]
CMD [] CMD ["--publish-quiet"]

View file

@ -1,6 +1,6 @@
source "https://rubygems.org" source "https://rubygems.org"
group :test do group :test do
gem 'cucumber', '~> 3.1.0' gem 'cucumber', '~> 5'
gem 'rspec', '~> 3.7.0' gem 'rspec', '~> 3'
end end

View file

@ -149,7 +149,7 @@ Feature: Shell Completion
| ini | init | /^(?!init).*$/ | | ini | init | /^(?!init).*$/ |
| ins | install | /^(?!install).*$/ | | ins | install | /^(?!install).*$/ |
| c | clear | /^(?!clear).*$/ | | c | clear | /^(?!clear).*$/ |
| a | | /.*/ | | b | | /.*/ |
| 'init ' | | /.*/ | | 'init ' | | /.*/ |
| 'clear ' | | /.*/ | | 'clear ' | | /.*/ |
| 'install ' | | /.*/ | | 'install ' | | /.*/ |

View file

@ -34,14 +34,14 @@ def _uninstall_candidate_version(candidate_dir)
end end
When(/^candidate (\w+) is uninstalled$/) do |candidate| When(/^candidate (\w+) is uninstalled$/) do |candidate|
puts `ls ~/.sdkman/candidates/#{candidate}` log `ls ~/.sdkman/candidates/#{candidate}`
Dir["#{ENV['HOME']}/.sdkman/candidates/#{candidate}/*"].each do |candidate_dir| Dir["#{ENV['HOME']}/.sdkman/candidates/#{candidate}/*"].each do |candidate_dir|
_uninstall_candidate_version(candidate_dir) _uninstall_candidate_version(candidate_dir)
end end
puts `ls ~/.sdkman/candidates/#{candidate}` log `ls ~/.sdkman/candidates/#{candidate}`
end end
Given(/^file ([a-zA-Z0-9-_.\/]+) exists with content/) do |filename,content| Given(/^file ([a-zA-Z0-9\-_.\/]+) exists with content/) do |filename,content|
FileUtils.mkdir_p(File.dirname(filename)) FileUtils.mkdir_p(File.dirname(filename))
File.write(filename, content) File.write(filename, content)
end end

View file

@ -6,6 +6,7 @@ ParameterType(
type: Array, type: Array,
transformer: lambda do |*patterns| transformer: lambda do |*patterns|
patterns \ patterns \
.select { |s| !s.nil? } # Huh? Well, if it helps...
.map(&:strip) \ .map(&:strip) \
.map do |s| .map do |s|
s = if %r{^/(.*)/$} =~ s s = if %r{^/(.*)/$} =~ s