From 18a274f53ea6e3db999bc6bd3920de6abc789727 Mon Sep 17 00:00:00 2001 From: AdrieanKhisbe Date: Tue, 16 Jul 2024 15:00:49 +0200 Subject: [PATCH] Attempt to modernize github actions :vertical_traffic_light: --- .github/workflows/ci.yml | 98 ++++++++++++++++++++++++++++++++++------ scripts/ci.zshrc | 12 +++-- 2 files changed, 92 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff68dee..527c85d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,25 +3,93 @@ name: Diractions CI on: [push] jobs: - tests: - name: Run tests - runs-on: ${{ matrix.os }} + macos: + name: macOS strategy: - fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] + os: [macos-12, macos-11] + runs-on: ${{matrix.os}} steps: - - name: Set up git repository + - name: Install deps + run: | + brew install tree antidote + - name: Checkout code uses: actions/checkout@v2 - - name: Install zsh & tree [linux] - if: runner.os == 'Linux' - run: sudo apt-get update; sudo apt-get install zsh tree - - name: Install zsh & tree [mac] - if: runner.os != 'Linux' - run: brew install tree - - name: Install antigen - run: curl -L git.io/antigen > ~/antigen.zsh # install antigen + + - name: Run tests + timeout-minutes: 1 + run: | + zsh --version + script -q <<<'zsh -if ./test.zsh -v; exit $?' + + ubuntu: + name: Ubuntu + strategy: + matrix: + os: [ubuntu-latest] + zsh-version: + - "5.9" + - "5.8.1" + - "5.8" + - "5.7.1" + - "5.7" + - "5.6.2" + - "5.5.1" + - "5.4.2" + # Too old to build/use on GitHub Actions (missing signals). + # - "5.3.1" + # - "5.3" + # - "5.2" + # - "5.1.1" + # - "5.0.8" + # - "5.0.2" + + runs-on: ${{matrix.os}} + steps: + - name: Install deps + run: | + sudo apt-get install zsh + + - name: Cache zsh + id: cache-zsh + uses: actions/cache@v2 + with: + path: /opt/zsh + key: ${{runner.os}}-${{matrix.zsh-version}} + + - name: Checkout zsh + if: steps.cache-zsh.outputs.cache-hit != 'true' + uses: actions/checkout@v2 + with: + repository: zsh-users/zsh + ref: zsh-${{matrix.zsh-version}} + path: zsh-build + + - name: Build zsh + if: steps.cache-zsh.outputs.cache-hit != 'true' + run: | + sudo apt-get install build-essential autoconf yodl libncurses-dev tree + cd "$GITHUB_WORKSPACE/zsh-build" + aclocal + autoconf + autoheader + script -qec './configure --prefix=/opt/zsh' + make + sudo make install.bin install.modules install.fns + - name: Install antidote + if: steps.cache-zsh.outputs.cache-hit != 'true' + run: | + git clone --depth=1 https://github.com/mattmc3/antidote.git ${ZDOTDIR:-$HOME}/.antidote + + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up env run: cat scripts/ci.zshrc > ~/.zshrc ; cat ~/.zshrc; echo "setopt sh_word_split" >> ~/.zshenv + - name: Tests - run: zsh scripts/ci-run.zsh + timeout-minutes: 2 + run: | + export PATH="/opt/zsh/bin:$PATH" + zsh --version + zsh scripts/ci-run.zsh diff --git a/scripts/ci.zshrc b/scripts/ci.zshrc index 2fc7eaf..cd5553f 100644 --- a/scripts/ci.zshrc +++ b/scripts/ci.zshrc @@ -1,4 +1,10 @@ -source ~/antigen.zsh -antigen bundle rylnd/shpec -antigen apply +if [ -f ~/.antidote/antidote.zsh ]; then + source ~/.antidote/antidote.zsh +fi +if [ -f /usr/local/opt/antidote/share/antidote/antidote.zsh ]; then + source /usr/local/opt/antidote/share/antidote/antidote.zsh +fi + +antidote bundle rylnd/shpec +antidote apply