2023-01-25 06:20:49 -07:00
|
|
|
name: Test
|
2021-05-26 05:55:54 -07:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
env:
|
2023-03-15 19:16:37 -07:00
|
|
|
ELVISH_VERSION: v0.19.2
|
2023-04-05 22:57:51 -07:00
|
|
|
FISH_VERSION: 3.6.1
|
2023-04-05 21:05:48 -07:00
|
|
|
NUSHELL_VERSION: 0.78.0
|
2023-04-05 22:57:51 -07:00
|
|
|
POWERSHELL_VERSION: 7.3.3
|
2021-05-26 05:55:54 -07:00
|
|
|
|
|
|
|
jobs:
|
2023-01-25 06:20:49 -07:00
|
|
|
detect-changes:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
pull-requests: read
|
|
|
|
# Set job outputs to values from filter step
|
|
|
|
outputs:
|
|
|
|
documentation: ${{ steps.filter.outputs.documentation }}
|
|
|
|
cli: ${{ steps.filter.outputs.cli }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- uses: dorny/paths-filter@v2
|
|
|
|
id: filter
|
|
|
|
with:
|
|
|
|
filters: |
|
|
|
|
documentation:
|
|
|
|
- '.github/workflows/**'
|
|
|
|
- 'docs/**'
|
|
|
|
- '.tool-versions'
|
|
|
|
cli:
|
|
|
|
- '.github/workflows/**'
|
|
|
|
- 'bin/**'
|
|
|
|
- 'lib/**'
|
|
|
|
- 'scripts/**'
|
|
|
|
- 'test/**'
|
|
|
|
- '.tool-versions'
|
|
|
|
- 'asdf.elv'
|
|
|
|
- 'asdf.fish'
|
|
|
|
- 'asdf.nu'
|
|
|
|
- 'asdf.sh'
|
|
|
|
|
2023-01-18 08:29:46 -07:00
|
|
|
ubuntu:
|
2023-01-25 06:20:49 -07:00
|
|
|
needs: detect-changes
|
|
|
|
# only run if
|
|
|
|
# - changes to cli
|
|
|
|
if: ${{ needs.detect-changes.outputs.cli == 'true' }}
|
2023-01-18 08:29:46 -07:00
|
|
|
runs-on: ubuntu-latest
|
2021-05-26 05:55:54 -07:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2022-06-24 02:26:43 -07:00
|
|
|
uses: actions/checkout@v3
|
2021-05-26 05:55:54 -07:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Install test dependencies
|
|
|
|
run: |
|
2023-03-31 21:12:20 -07:00
|
|
|
curl -fsSLo- https://packages.microsoft.com/keys/microsoft.asc | sudo tee >/dev/null /etc/apt/trusted.gpg.d/microsoft.asc
|
|
|
|
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list'
|
2023-04-05 22:57:51 -07:00
|
|
|
sudo add-apt-repository -y ppa:fish-shell/release-3
|
2021-05-26 05:55:54 -07:00
|
|
|
sudo apt-get update
|
2023-04-05 22:57:51 -07:00
|
|
|
sudo apt-get -y install curl parallel \
|
|
|
|
fish="${{ env.FISH_VERSION }}-1~jammy" \
|
|
|
|
powershell="${{ env.POWERSHELL_VERSION }}-1.deb"
|
2021-11-18 03:05:27 -07:00
|
|
|
|
2023-01-04 13:42:34 -07:00
|
|
|
# Create $HOME/bin
|
|
|
|
mkdir -p "$HOME/bin"
|
|
|
|
|
2021-11-18 03:05:27 -07:00
|
|
|
# Download elvish binary and add to path
|
2022-06-25 21:00:12 -07:00
|
|
|
curl https://dl.elv.sh/linux-amd64/elvish-${{ env.ELVISH_VERSION }}.tar.gz -o elvish-${{ env.ELVISH_VERSION }}.tar.gz
|
|
|
|
tar xzf elvish-${{ env.ELVISH_VERSION }}.tar.gz
|
|
|
|
rm elvish-${{ env.ELVISH_VERSION }}.tar.gz
|
|
|
|
mv elvish-${{ env.ELVISH_VERSION }} "$HOME/bin/elvish"
|
2023-01-04 13:42:34 -07:00
|
|
|
|
|
|
|
# Download nushell binary and add to path
|
|
|
|
curl -L https://github.com/nushell/nushell/releases/download/${{ env.NUSHELL_VERSION }}/nu-${{ env.NUSHELL_VERSION }}-x86_64-unknown-linux-gnu.tar.gz -o nu-${{ env.NUSHELL_VERSION }}-x86_64-unknown-linux-gnu.tar.gz
|
|
|
|
tar xzf nu-${{ env.NUSHELL_VERSION }}-x86_64-unknown-linux-gnu.tar.gz
|
|
|
|
rm nu-${{ env.NUSHELL_VERSION }}-x86_64-unknown-linux-gnu.tar.gz
|
|
|
|
mv nu-${{ env.NUSHELL_VERSION }}-x86_64-unknown-linux-gnu/* "$HOME/bin"
|
|
|
|
|
|
|
|
# Add $HOME/bin to path
|
2021-11-18 03:05:27 -07:00
|
|
|
echo "$HOME/bin" >>"$GITHUB_PATH"
|
2021-05-26 05:55:54 -07:00
|
|
|
|
|
|
|
- name: Install bats
|
|
|
|
run: |
|
2023-01-22 08:36:43 -07:00
|
|
|
git clone --depth 1 --branch "v$(grep -Eo "^\\s*bats\\s*.*$" ".tool-versions" | cut -d ' ' -f2-)" https://github.com/bats-core/bats-core.git "$HOME/bats-core"
|
2021-05-26 05:55:54 -07:00
|
|
|
echo "$HOME/bats-core/bin" >>"$GITHUB_PATH"
|
|
|
|
|
|
|
|
- name: Run tests
|
2023-02-19 04:36:31 -07:00
|
|
|
run: scripts/test.bash
|
2021-05-26 05:55:54 -07:00
|
|
|
env:
|
|
|
|
GITHUB_API_TOKEN: ${{ github.token }}
|
2023-01-25 06:20:49 -07:00
|
|
|
|
2023-01-18 08:29:46 -07:00
|
|
|
macos:
|
2023-01-25 06:20:49 -07:00
|
|
|
needs: detect-changes
|
|
|
|
# only run if
|
|
|
|
# - changes to cli
|
|
|
|
if: ${{ needs.detect-changes.outputs.cli == 'true' }}
|
2023-01-18 08:29:46 -07:00
|
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Install test dependencies
|
2023-04-05 22:57:51 -07:00
|
|
|
run: |
|
|
|
|
brew install coreutils parallel \
|
|
|
|
elvish \
|
|
|
|
fish \
|
|
|
|
nushell \
|
|
|
|
powershell
|
2023-01-18 08:29:46 -07:00
|
|
|
|
|
|
|
- name: Install bats
|
|
|
|
run: |
|
2023-01-22 08:36:43 -07:00
|
|
|
git clone --depth 1 --branch "v$(grep -Eo "^\\s*bats\\s*.*$" ".tool-versions" | cut -d ' ' -f2-)" https://github.com/bats-core/bats-core.git "$HOME/bats-core"
|
2023-01-18 08:29:46 -07:00
|
|
|
echo "$HOME/bats-core/bin" >>"$GITHUB_PATH"
|
|
|
|
|
|
|
|
- name: Run tests
|
2023-02-19 04:36:31 -07:00
|
|
|
run: scripts/test.bash
|
2023-01-18 08:29:46 -07:00
|
|
|
env:
|
|
|
|
GITHUB_API_TOKEN: ${{ github.token }}
|
2023-01-25 06:20:49 -07:00
|
|
|
|
|
|
|
documentation-site:
|
|
|
|
needs: detect-changes
|
|
|
|
# only run if
|
|
|
|
# - changes to documentation
|
|
|
|
# - pull_request (workflows/docs.yml deploys on main branch)
|
|
|
|
if: ${{ github.event_name == 'pull_request' && needs.detect-changes.outputs.documentation == 'true' }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
# fetch all commits to get git log info for Vuepress
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
# only run steps past here if changes to docs/** directory
|
|
|
|
- name: Setup Node.js
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: "18"
|
|
|
|
|
|
|
|
- name: Cache dependencies
|
|
|
|
uses: actions/cache@v3
|
|
|
|
id: npm-cache
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
docs/node_modules
|
|
|
|
key: ${{ runner.os }}-npm-${{ hashFiles('docs/package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-npm-
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
if: steps.npm-cache.outputs.cache-hit != 'true'
|
|
|
|
working-directory: docs/
|
|
|
|
run: npm install
|
|
|
|
|
2023-03-23 18:30:29 -07:00
|
|
|
- name: Check errors by building Documentation site
|
2023-01-25 06:20:49 -07:00
|
|
|
working-directory: docs/
|
|
|
|
run: npm run build
|