diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8b442ce --- /dev/null +++ b/.github/workflows/release.yml @@ -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" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..dc27012 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d89de9c --- /dev/null +++ b/CHANGELOG.md @@ -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. diff --git a/README.md b/README.md index 1100e00..ecb47bf 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,30 @@ # 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. 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 - - SDKMAN! 5.9.1, on - - Ubuntu 18.04 LTS and macOS 10.13 + - fish 3.1, and + - SDKMAN! 5.9, on + - Ubuntu 20.04 LTS and macOS 10.15 ## Install With [fisher] (install separately): ``` -fisher add reitzig/sdkman-for-fish@v1.4.0 +fisher add reitzig/sdkman-for-fish@v2.0.0 ``` _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. ## Usage diff --git a/test/Dockerfile b/test/Dockerfile index 4044d2b..0acbf64 100644 --- a/test/Dockerfile +++ b/test/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.5.8-slim-buster +FROM ruby:2.7-slim-buster # Install dependencies RUN apt-get update \ @@ -7,6 +7,8 @@ RUN apt-get update \ curl \ unzip \ zip \ + ruby-dev \ + build-essential \ && apt-get clean WORKDIR app @@ -38,4 +40,4 @@ RUN ls -R $TEST_HOME/.config/fish/ # Run tests COPY test ./ ENTRYPOINT ["cucumber"] -CMD [] +CMD ["--publish-quiet"] diff --git a/test/Gemfile b/test/Gemfile index 70d69fe..802cef6 100644 --- a/test/Gemfile +++ b/test/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" group :test do - gem 'cucumber', '~> 3.1.0' - gem 'rspec', '~> 3.7.0' + gem 'cucumber', '~> 5' + gem 'rspec', '~> 3' end diff --git a/test/features/completions.feature b/test/features/completions.feature index 0024bbe..a06ff0b 100644 --- a/test/features/completions.feature +++ b/test/features/completions.feature @@ -149,7 +149,7 @@ Feature: Shell Completion | ini | init | /^(?!init).*$/ | | ins | install | /^(?!install).*$/ | | c | clear | /^(?!clear).*$/ | - | a | | /.*/ | + | b | | /.*/ | | 'init ' | | /.*/ | | 'clear ' | | /.*/ | | 'install ' | | /.*/ | diff --git a/test/features/step_definitions/setup.rb b/test/features/step_definitions/setup.rb index 90c6ae9..fa9198a 100644 --- a/test/features/step_definitions/setup.rb +++ b/test/features/step_definitions/setup.rb @@ -34,14 +34,14 @@ def _uninstall_candidate_version(candidate_dir) end 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| _uninstall_candidate_version(candidate_dir) end - puts `ls ~/.sdkman/candidates/#{candidate}` + log `ls ~/.sdkman/candidates/#{candidate}` 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)) File.write(filename, content) end diff --git a/test/features/support/parameter_types.rb b/test/features/support/parameter_types.rb index 492bdde..ba4d39d 100644 --- a/test/features/support/parameter_types.rb +++ b/test/features/support/parameter_types.rb @@ -6,6 +6,7 @@ ParameterType( type: Array, transformer: lambda do |*patterns| patterns \ + .select { |s| !s.nil? } # Huh? Well, if it helps... .map(&:strip) \ .map do |s| s = if %r{^/(.*)/$} =~ s