Skip to content

Move to Github Actions, fish 3.1, nvm 0.35 #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions .fish-install-source.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/bin/bash

if test ! -d $HOME/fish/bin; then
cd $HOME
wget $FISH_RELEASE
tar -xzf $(basename $FISH_RELEASE)
rm $(basename $FISH_RELEASE)
pushd $(basename ${FISH_RELEASE%.tar.gz})
./configure --prefix=$HOME/fish
set -euo pipefail

if test ! -d "${HOME}/fish-${FISH_RELEASE}"; then
cd ${HOME}
wget "https://github.com/fish-shell/fish-shell/releases/download/${FISH_RELEASE}/fish-${FISH_RELEASE}.tar.gz"
tar -xzf "fish-${FISH_RELEASE}.tar.gz"
rm "fish-${FISH_RELEASE}.tar.gz"
cd "fish-${FISH_RELEASE}"
cmake .
make
make install
popd
rm -rf $(basename ${FISH_RELEASE%.tar.gz})
sudo make install
else
cd "${HOME}/fish-${FISH_RELEASE}"
sudo make install
echo Using cached fish install
fi

export PATH=$HOME/fish/bin:$PATH
58 changes: 58 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "E2E Test"

on: [pull_request]

jobs:
test:
name: ${{ matrix.os }}, Fish ${{ matrix.fish }}, NVM ${{ matrix.nvm }}
runs-on: ${{ matrix.os }}
env:
FISH_RELEASE: "3.1.0"
OMF_INSTALLER: "https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install"
NVM_INSTALLER: "https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh"

strategy:
matrix:
fish: [homebrew, source]
nvm: [homebrew, official]
os: [ubuntu-latest, macOS-latest]
exclude:
- fish: homebrew
nvm: homebrew
os: ubuntu-latest

- fish: source
nvm: homebrew
os: ubuntu-latest

- fish: homebrew
nvm: official
os: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Install system dependecies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y gettext libncurses5-dev libncursesw5-dev

- name: Cache compiled Fish
uses: actions/cache@v1
if: matrix.fish == 'source'
with:
path: ~/fish-${{ env.FISH_RELEASE }}
key: cache-${{ runner.os }}-fish-${{ env.FISH_RELEASE }}-nvm-${{ matrix.nvm }}-${{ hashFiles('.fish-install-source.sh') }}

- name: Setup environment
run: |
./.fish-install-${{ matrix.fish }}.sh
./.nvm-install-${{ matrix.nvm }}.sh
./.omf-install.sh
./.plugin-install.sh

- name: Run tests
run: |
fish test/bootstrap.fish
13 changes: 6 additions & 7 deletions .omf-install.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/bin/bash

# Don't touch if cached
if test ! -e $HOME/.local/share/omf/init.fish; then
wget -O - $OMF_INSTALLER | fish
fish -c 'omf install foreign-env'
else
echo Using cached Oh My Fish install
fi
echo "Downloading latest installer..."
wget -O - $OMF_INSTALLER > /tmp/install.fish
echo "Installing Oh My Fish..."
fish /tmp/install.fish --channel=dev
echo "Installing dependencies..."
fish -c "omf install"
1 change: 1 addition & 0 deletions .plugin-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ if test -e $PACKAGE; then
fi

ln -s $PWD $PACKAGE
fish -c "omf install foreign-env"
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion init.fish
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function init -a path --on-event init_nvm
and test -e (brew --prefix)/Cellar/nvm;
and set -g nvm_prefix (brew --prefix nvm)

fenv source $nvm_prefix/nvm.sh >/dev/null ^&1
fenv source $nvm_prefix/nvm.sh >/dev/null 2>&1
end

end
10 changes: 5 additions & 5 deletions test/bootstrap.fish
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ function it_should
set -l progress (set_color yellow)TEST(set_color normal)

set -q duty;
and printf '\n - It should %s: %s' $duty $progress
or printf "$progress"
and printf -- '\n - It should %s: %s' $duty $progress
or printf -- "$progress"

if set output (eval "$commands" ^&1)
if set output (eval "$commands" 2>&1)
set_color green
printf '\b\b\b\bPASS'
set_color normal
Expand All @@ -29,7 +29,7 @@ function it_should
printf '\n\nError description\n'
set_color normal
set_color yellow
printf '%s\n' $output >&2
printf -- '%s\n' $output >&2
echo
set_color normal
return 1
Expand All @@ -39,7 +39,7 @@ end
printf 'Running test suite...\n'

for test in test/cases/*
printf '- It should %s: ' (basename $test | sed 's/^[0-9]*_//;s/_/ /g;s/\.fish//g')
printf -- '- It should %s: ' (basename $test | sed 's/^[0-9]*_//;s/_/ /g;s/\.fish//g')
source $test;
or exit 1
echo
Expand Down
4 changes: 2 additions & 2 deletions test/cases/101_display_nvm_help.fish
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
it_should "display help using nvm --help" "test (nvm --help ^&1 | wc -c) -gt 1"
it_should "display help using nvm with no arguments" "test (nvm ^&1 | wc -c) -gt 1"
it_should "display help using nvm --help" "test (nvm --help 2>&1 | wc -c) -gt 1"
it_should "display help using nvm with no arguments" "test (nvm 2>&1 | wc -c) -gt 1"
2 changes: 1 addition & 1 deletion test/cases/102_display_current_node_version.fish
Original file line number Diff line number Diff line change
@@ -1 +1 @@
it_should -s "test (nvm current ^/dev/null | wc -c) -gt 1"
it_should -s "test (nvm current 2>/dev/null | wc -c) -gt 1"
4 changes: 2 additions & 2 deletions test/cases/103_list_node_versions.fish
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
it_should "list locally installed node versions" "test (nvm ls ^/dev/null | wc -c) -gt 1"
it_should "list remote node versions" "test (nvm ls-remote ^/dev/null | wc -c) -gt 1"
it_should "list locally installed node versions" "test (nvm ls 2>/dev/null | wc -c) -gt 1"
it_should "list remote node versions" "test (nvm ls-remote 2>/dev/null | wc -c) -gt 1"