Skip to content

Disable pathname expansion using set -f #136

Disable pathname expansion using set -f

Disable pathname expansion using set -f #136

Workflow file for this run

name: run-tests
on:
pull_request: # Should trigger on pull requests for all branches
branches:
- '**' # Matches all branches
jobs:
build-without-warnings:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install gcc and clang
run: |
set -e
sudo apt-get update
sudo apt-get install -y build-essential clang-14
- name: Build with warnings
run: |
set -e
# Testing with gcc clang in case they have different warnings
gcc -Wall -Werror pnut.c -Dsh
gcc -Wall -Werror pnut.c -Dtarget_x86_64_mac
gcc -Wall -Werror pnut.c -Dtarget_x86_64_linux
gcc -Wall -Werror pnut.c -Dtarget_i386_linux
# With clang
clang-14 -Wall -Werror pnut.c -Dsh
clang-14 -Wall -Werror pnut.c -Dtarget_x86_64_mac
clang-14 -Wall -Werror pnut.c -Dtarget_x86_64_linux
clang-14 -Wall -Werror pnut.c -Dtarget_i386_linux
tests-exe: # Run tests for pnut-exe on all supported platforms and architectures
strategy:
matrix:
include:
- target: i386_linux
host: ubuntu-latest
- target: x86_64_linux
host: ubuntu-latest
- target: x86_64_mac
host: macos-latest
runs-on: ${{ matrix.host }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install utils
run: |
if [ ${{ matrix.host }} = "macos-latest" ]; then
brew install coreutils
else
sudo apt-get update
sudo apt-get install -y coreutils
fi
- name: Run ${{ matrix.target }} tests on ${{ matrix.host }}
run: |
set -e
./run-tests.sh ${{ matrix.target }}
tests-shell: # Run tests for pnut-sh on all supported shells
strategy:
matrix:
shell: ["bash", "dash", "ksh", "mksh", "yash", "zsh"]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install ${{ matrix.shell }} shell
run: |
sudo apt-get update
sudo apt-get install -y coreutils ${{ matrix.shell }}
- name: Run tests with ${{ matrix.shell }}
run: |
set -e
./run-tests.sh sh --shell ${{ matrix.shell }}
bootstrap-pnut-sh:
strategy:
matrix:
shell: ["bash", "dash", "ksh", "mksh", "yash", "zsh"]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install ${{ matrix.shell }} shell
run: |
sudo apt-get update
sudo apt-get install -y coreutils ${{ matrix.shell }}
- name: Bootstrap pnut.sh on ${{ matrix.shell }}
run: |
set -e
./bootstrap-pnut.sh --shell ${{ matrix.shell }} --fast
bootstrap-pnut-exe:
strategy:
matrix:
shell: ["bash", "dash", "ksh"] # Not all shells to save some time
target: ["i386_linux", "x86_64_linux", "x86_64_mac"]
include:
- target: i386_linux
host: ubuntu-latest
- target: x86_64_linux
host: ubuntu-latest
- target: x86_64_mac
host: macos-latest
runs-on: ${{ matrix.host }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install ${{ matrix.shell }} shell
run: |
if [ ${{ matrix.host }} = "macos-latest" ]; then
brew install coreutils ${{ matrix.shell }}
else
sudo apt-get update
sudo apt-get install -y coreutils ${{ matrix.shell }}
fi
- name: Bootstrap pnut-exe with ${{ matrix.target }} backend
run: |
set -e
./bootstrap-pnut-exe.sh --backend ${{ matrix.target }} --fast
- name: Bootstrap pnut-exe with ${{ matrix.target }} backend on ${{ matrix.shell }}
run: |
set -e
./bootstrap-pnut-exe.sh --backend ${{ matrix.target }} --shell ${{ matrix.shell }} --fast
bootstrap-bash-2_05a:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup woody environment
run: |
set -e
sudo apt-get update
sudo apt-get install -y debootstrap # debootstrap allows us to create a minimal Debian environment
tar -czf ../pnut.tar.gz . # Make a copy of the pnut repo (excluding the woody directory)
sudo debootstrap --arch=i386 woody woody http://archive.debian.org/debian
sudo cp ../pnut.tar.gz woody/pnut.tar.gz # Copy the pnut repo into the woody environment
# Check that the woody environment has the right bash version
sudo chroot woody /bin/bash -c "bash --version" | grep 2.05a || { echo "Bash 2.05a is required for this job"; exit 1; }
sudo chroot woody /bin/bash -c "mkdir pnut && tar -xvzf pnut.tar.gz -C pnut" # Extract the pnut repo into the woody environment
sudo chroot woody /bin/bash -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential time timeout" # Install gcc and time utils
- name: Run tests with bash 2.05a
run: |
sudo chroot woody /bin/bash -c "cd pnut && PNUT_OPTIONS='-DRT_FREE_UNSETS_VARS_NOT' ./run-tests.sh sh --shell bash"
- name: Bootstrap pnut.sh with bash 2.05a
run: |
sudo chroot woody /bin/bash -c "cd /pnut && PNUT_OPTIONS='-DRT_FREE_UNSETS_VARS_NOT' ./bootstrap-pnut.sh --shell bash --fast"
- name: Bootstrap pnut-exe with bash 2.05a
run: |
sudo chroot woody /bin/bash -c "cd /pnut && PNUT_OPTIONS='-DRT_FREE_UNSETS_VARS_NOT' ./bootstrap-pnut-exe.sh --backend i386_linux --fast"
sudo chroot woody /bin/bash -c "cd /pnut && PNUT_OPTIONS='-DRT_FREE_UNSETS_VARS_NOT' ./bootstrap-pnut-exe.sh --backend i386_linux --shell bash --fast"
success-message:
runs-on: ubuntu-latest
needs: [build-without-warnings, tests-exe, tests-shell, bootstrap-pnut-sh, bootstrap-pnut-exe, bootstrap-bash-2_05a]
steps:
- name: Tests finished
run: |
echo " ,-~~-.___."
echo " / | ' \\ Pnut tests completed...."
echo "( ) 0"
echo " \\_/-, ,----'"
echo " ==== //"
echo " / \\-'~; /~~~(O)"
echo " / __/~| / |"
echo "=( _____| (_________| "