Browse Source

Add installation script testing (#243)

remotes/origin/add-simple-redirecting-site
Gal Schlezinger 4 years ago committed by GitHub
parent
commit
b34a9a6cd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      .ci/install.sh
  2. 81
      .github/workflows/installation_script.yml
  3. 6
      .github/workflows/refmt.yml

12
.ci/install.sh

@ -109,11 +109,21 @@ check_dependencies() { @@ -109,11 +109,21 @@ check_dependencies() {
fi
}
ensure_containing_dir_exists() {
local CONTAINING_DIR
CONTAINING_DIR="$(dirname "$1")"
if [ ! -d "$CONTAINING_DIR" ]; then
echo " >> Creating directory $CONTAINING_DIR"
mkdir -p "$CONTAINING_DIR"
fi
}
setup_shell() {
CURRENT_SHELL=$(basename $SHELL)
if [ "$CURRENT_SHELL" == "zsh" ]; then
CONF_FILE=$HOME/.zshrc
ensure_containing_dir_exists "$CONF_FILE"
echo "Installing for Zsh. Appending the following to $CONF_FILE:"
echo ""
echo ' # fnm'
@ -127,6 +137,7 @@ setup_shell() { @@ -127,6 +137,7 @@ setup_shell() {
elif [ "$CURRENT_SHELL" == "fish" ]; then
CONF_FILE=$HOME/.config/fish/config.fish
ensure_containing_dir_exists "$CONF_FILE"
echo "Installing for Fish. Appending the following to $CONF_FILE:"
echo ""
echo ' # fnm'
@ -144,6 +155,7 @@ setup_shell() { @@ -144,6 +155,7 @@ setup_shell() {
else
CONF_FILE=$HOME/.bashrc
fi
ensure_containing_dir_exists "$CONF_FILE"
echo "Installing for Bash. Appending the following to $CONF_FILE:"
echo ""
echo ' # fnm'

81
.github/workflows/installation_script.yml

@ -0,0 +1,81 @@ @@ -0,0 +1,81 @@
name: Installation script
on:
pull_request:
push:
branches:
- master
jobs:
install_on_linux:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- shell: fish
source: ~/.config/fish/config.fish
- shell: zsh
source: ~/.zshrc
- shell: bash
source: ~/.bashrc
steps:
- uses: actions/checkout@v2
- run: "sudo apt-get install -y ${{ matrix.shell }}"
name: Install shell
- run: "cp ~/.bashrc ~/.bashrc.bak && echo '. ~/.bashrc.bak' > ~/.bashrc"
name: reset bashrc file
- run: "env SHELL=$(which ${{ matrix.shell }}) bash ./.ci/install.sh"
name: Run the installation script
- run: |
${{ matrix.shell }} -c '
source ${{ matrix.source }}
fnm install 12.5.0
fnm ls | grep 12.5.0
'
name: 'Install a Node version with `fnm install`'
- run: |
${{ matrix.shell }} -c '
source ${{ matrix.source }}
fnm use 12.5.0
node --version | grep 12.5.0
'
name: 'Check switching versions with `fnm use`'
install_on_mac:
runs-on: macos-latest
strategy:
matrix:
include:
- shell: fish
source: ~/.config/fish/config.fish
- shell: zsh
source: ~/.zshrc
- shell: bash
source: ~/.bashrc
steps:
- uses: actions/checkout@v2
- run: "brew install ${{ matrix.shell }}"
name: Install shell
- name: reset bashrc file
run: |
cp ~/.bashrc ~/.bashrc.bak
echo '. ~/.bashrc.bak' > ~/.bashrc
- run: "env SHELL=$(which ${{ matrix.shell }}) bash ./.ci/install.sh --force-install"
name: Run the installation script
- name: 'Install a Node version with `fnm install`'
run: |
${{ matrix.shell }} -c '
source ${{ matrix.source }}
fnm install 12.5.0
fnm ls | grep 12.5.0
'
- name: 'Check switching versions with `fnm use`'
run: |
${{ matrix.shell }} -c '
source ${{ matrix.source }}
fnm use 12.5.0
node --version | grep 12.5.0
'

6
.github/workflows/refmt.yml

@ -1,5 +1,9 @@ @@ -1,5 +1,9 @@
name: Check formatting
on: [push, pull_request]
on:
pull_request:
push:
branches:
- master
# consider using docker: ocaml/opam2:4.06
# - sudo apt-get update && apt-get install -y m4

Loading…
Cancel
Save