-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.yml
More file actions
81 lines (69 loc) · 3.19 KB
/
Copy pathtest.yml
File metadata and controls
81 lines (69 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Test
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
# This workflow is copied verbatim by cookiecutter (see _copy_without_render in
# cookiecutter.json) so GitHub's ${{ ... }} expressions survive generation. It
# is self-describing — it loads whatever repo it lives in via
# ${{ github.repository }}, so no per-library edits are needed.
jobs:
test:
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
name: ${{ matrix.label }}
defaults:
run:
shell: bash
# Mirror alexzhangs/xsh's shell matrix: bash 3.2 / 4.4 / 5.x + zsh 5.x.
# Utilities run under zsh's ksh emulation (provided by xsh >= 0.7.0).
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, container: '', shell_path: /bin/bash, label: bash-5.x-linux }
- { os: macos-latest, container: '', shell_path: /bin/bash, label: bash-3.2-macos }
- { os: macos-latest, container: '', shell_path: brew, label: bash-5.x-macos }
- { os: ubuntu-latest, container: rockylinux:8, shell_path: /bin/bash, label: bash-4.4-linux }
- { os: macos-latest, container: '', shell_path: /bin/zsh, label: zsh-5.x-macos }
- { os: ubuntu-latest, container: '', shell_path: /usr/bin/zsh, label: zsh-5.x-linux }
steps:
- name: Pre-install git (rockylinux container)
if: matrix.container != ''
run: dnf install -y git
- name: Install dependencies (rockylinux container)
if: matrix.container != ''
run: |
dnf install -y --allowerasing coreutils
dnf install -y gawk sed file findutils diffutils procps-ng which tar gzip python3
command -v python >/dev/null 2>&1 || ln -sf "$(command -v python3)" /usr/local/bin/python
git config --global --add safe.directory '*'
- name: Install zsh (Linux)
if: matrix.container == '' && runner.os == 'Linux' && contains(matrix.shell_path, 'zsh')
run: sudo apt-get update && sudo apt-get install -y zsh
- name: Install Homebrew bash (macOS bash 5.x)
if: matrix.shell_path == 'brew'
run: |
brew install bash
echo "SHELL_PATH=$(brew --prefix)/bin/bash" >> "$GITHUB_ENV"
- name: Set shell path
if: matrix.shell_path != 'brew'
run: echo "SHELL_PATH=${{ matrix.shell_path }}" >> "$GITHUB_ENV"
- name: Install xsh
run: |
git clone --depth=50 --branch=master https://github.com/alexzhangs/xsh.git /tmp/xsh
bash /tmp/xsh/install.sh
- name: Load dependency library xsh-lib/core
run: |
source ~/.xshrc
xsh load xsh-lib/core
- name: Load library from current branch
run: |
source ~/.xshrc
xsh load -b "${{ github.head_ref || github.ref_name }}" "${{ github.repository }}"
- name: Run tests (${{ matrix.label }})
# test.sh self-sources ~/.xshrc, so running it under $SHELL_PATH makes
# the utilities execute under that shell (bash, or zsh's ksh emulation).
run: |
"$SHELL_PATH" ~/.xsh/repo/"${{ github.repository }}"/test.sh