More benchmarks #235
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: run-tests | |
on: | |
pull_request: # Should trigger on pull requests for all branches | |
branches: | |
- '**' # Matches all branches | |
# Cancel previous runs if a new one is triggered | |
concurrency: | |
group: "${{ github.ref }}" | |
cancel-in-progress: true | |
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 | |
catch-bad-whitespace: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Check for trailing whitespace and tab characters | |
run: | | |
set -e | |
check_dir() { # $1 is the file extension, $2 is the directory and $3 the max depth to check | |
result=$(find $2 -maxdepth ${3:-1000} -name "$1" -type f -exec egrep -l " +$" {} \;) | |
if [ -n "$result" ]; then | |
echo "Trailing whitespace found in the following files:" | |
echo "$result" | |
exit 1 | |
fi | |
result=$(find $2 -maxdepth ${3:-1000} -name "$1" -type f -exec egrep -l "$(printf '\t')" {} \;) | |
if [ -n "$result" ]; then | |
echo "Tab characters found in the following files:" | |
echo "$result" | |
exit 1 | |
fi | |
} | |
check_dir "*.c" . 1 # Check pnut source files | |
check_dir "*.c" tests # and the tests directory recursively | |
check_dir "*.c" examples 1 # and examples | |
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"] | |
include: | |
- shell: dash # Using dash because it's the fastest | |
pnut_opts: "'-DSH_SAVE_VARS_WITH_SET' '-DOPTIMIZE_CONSTANT_PARAM'" | |
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 }} | |
for pnut_opts in ${{ matrix.pnut_opts }}; do | |
echo "Running tests with pnut options: $pnut_opts" | |
PNUT_OPTIONS="${pnut_opts}" ./run-tests.sh sh --shell ${{ matrix.shell }} | |
done | |
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.sh on ${{ matrix.shell }} | |
run: | | |
set -e | |
./bootstrap-pnut-sh.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-pnut-sh-with-pnut-exe: | |
strategy: | |
matrix: | |
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 dependencies | |
run: | | |
if [ ${{ matrix.host }} = "macos-latest" ]; then | |
brew install coreutils | |
else | |
sudo apt-get update | |
sudo apt-get install -y coreutils | |
fi | |
- name: Bootstrap pnut-sh with pnut-exe on ${{ matrix.target }} backend | |
run: | | |
set -e | |
./bootstrap-pnut-sh-by-pnut-exe.sh --backend ${{ matrix.target }} | |
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.sh with bash 2.05a | |
run: | | |
sudo chroot woody /bin/bash -c "cd /pnut && PNUT_OPTIONS='-DRT_FREE_UNSETS_VARS_NOT' ./bootstrap-pnut-sh.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-pnut-sh-with-pnut-exe, bootstrap-bash-2_05a] | |
steps: | |
- name: Tests finished | |
run: | | |
echo " ,-~~-.___." | |
echo " / | ' \\ Pnut tests completed...." | |
echo "( ) 0" | |
echo " \\_/-, ,----'" | |
echo " ==== //" | |
echo " / \\-'~; /~~~(O)" | |
echo " / __/~| / |" | |
echo "=( _____| (_________| " |