Skip to content

Commit

Permalink
fix(ci): do not use matrix variables for OS-specific commands
Browse files Browse the repository at this point in the history
The use of `matrix.NIGHTLY`, `matrix.EXTRACT`, etc. makes CI matrix
configuration difficult. Instead, let the shell script for installing
neovim takes care of OS specializations.
  • Loading branch information
wookayin committed Oct 31, 2024
1 parent 767a91f commit 9056f76
Showing 1 changed file with 31 additions and 24 deletions.
55 changes: 31 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,12 @@ jobs:
include:
- os: 'ubuntu-20.04'
python-version: '3.7'
NIGHTLY: nvim-linux64.tar.gz
NVIM_BIN_PATH: nvim-linux64/bin
EXTRACT: tar xzf
- os: 'ubuntu-latest'
NIGHTLY: nvim-linux64.tar.gz
NVIM_BIN_PATH: nvim-linux64/bin
EXTRACT: tar xzf
- os: 'macos-12'
python-version: '3.7'
- os: 'macos-12'
python-version: '3.8'
- os: 'macos-12'
python-version: '3.9'
- os: 'macos-latest'
NIGHTLY: nvim-macos-x86_64.tar.gz
NVIM_BIN_PATH: nvim-macos-x86_64/bin
EXTRACT: tar xzf
- os: 'windows-latest'
NIGHTLY: nvim-win64.zip
NVIM_BIN_PATH: nvim-win64/bin
EXTRACT: unzip

name: "test (python ${{ matrix.python-version }}, ${{ matrix.os }})"
runs-on: ${{ matrix.os }}
Expand All @@ -72,19 +57,41 @@ jobs:
cache: 'pip'
python-version: ${{ matrix.python-version }}

- name: update path (bash)
if: runner.os != 'Windows'
run: echo "$(pwd)/${{ matrix.NVIM_BIN_PATH }}" >> $GITHUB_PATH
- name: update path (Linux)
if: runner.os == 'Linux'
run: echo "$(pwd)/nvim-linux64/bin" >> $GITHUB_PATH

- name: update path (windows)
- name: update path (macOS)
if: runner.os == 'macOS'
run: echo "$(pwd)/nvim-macos-x86_64/bin" >> $GITHUB_PATH

- name: update path (Windows)
if: runner.os == 'Windows'
run: echo "$(pwd)/${{ matrix.NVIM_BIN_PATH }}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
run: echo "$(pwd)/nvim-win64/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: install neovim
- name: install neovim (Linux/macOS)
if: runner.os != 'Windows'
run: |
set -eu -o pipefail
if [[ "$RUNNER_OS" == "Linux" ]]; then
EXTRACT="tar xzf"; NIGHTLY="nvim-linux64.tar.gz";
elif [[ "$RUNNER_OS" == "macOS" ]]; then
EXTRACT="tar xzf"; NIGHTLY="nvim-macos-x86_64.tar.gz";
else
echo "$RUNNER_OS not supported"; exit 1;
fi
curl -LO "https://github.com/neovim/neovim/releases/download/nightly/$NIGHTLY"
$EXTRACT $NIGHTLY
echo "RUNNER_OS = $RUNNER_OS"
nvim --version
- name: install neovim (Windows)
if: runner.os == 'Windows'
run: |
curl -LO 'https://github.com/neovim/neovim/releases/download/nightly/${{ matrix.NIGHTLY }}'
${{ matrix.EXTRACT }} ${{ matrix.NIGHTLY }}
echo '${{ runner.os }}'
curl -LO "https://github.com/neovim/neovim/releases/download/nightly/nvim-win64.zip"
unzip nvim-win64.zip
nvim --version
- name: install dependencies
Expand Down

0 comments on commit 9056f76

Please sign in to comment.