ci: test with macos 13 and ubuntu 24.04 #78
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
# SPDX-FileCopyrightText: © Vegard IT GmbH (https://vegardit.com) and contributors | |
# SPDX-FileContributor: Sebastian Thomschke, Vegard IT GmbH | |
# SPDX-License-Identifier: Apache-2.0 | |
# | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | |
name: Build | |
on: | |
push: | |
branches-ignore: # build all branches except: | |
- 'dependabot/**' # prevent GHA triggered twice (once for commit to the branch and once for opening/syncing the PR) | |
tags-ignore: # don't build tags | |
- '**' | |
paths-ignore: | |
- '**/*.md' | |
- '.github/*.yml' | |
- '.semaphore/**/*' | |
- '**/.project' | |
- '**/.settings/*.prefs' | |
- '.gitignore' | |
- '.actrc' | |
pull_request: | |
paths-ignore: | |
- '**/*.md' | |
- '.github/*.yml' | |
- '.semaphore/**/*' | |
- '**/.project' | |
- '**/.settings/*.prefs' | |
- '.gitignore' | |
- '.actrc' | |
workflow_dispatch: | |
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/ | |
inputs: | |
debug-with-ssh: | |
description: "Start an SSH session for debugging purposes at the end of the build:" | |
default: never | |
type: choice | |
options: [ always, on_failure, on_failure_or_cancelled, never ] | |
debug-with-ssh-only-for-actor: | |
description: "Limit access to the SSH session to the GitHub user that triggered the job." | |
default: true | |
type: boolean | |
debug-with-ssh-only-jobs-matching: | |
description: "Only start an SSH session for jobs matching this regex pattern:" | |
default: ".*" | |
type: string | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
########################################################### | |
shellcheck: | |
########################################################### | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v4 #https://github.com/actions/checkout | |
- name: Run shellcheck | |
run: bash tests/run-shellcheck.sh | |
########################################################### | |
test: | |
########################################################### | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: # https://github.com/actions/runner-images#available-images | |
os: [ "ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04" ] | |
test_shell: [ "ash" , "bash", "busybox", "dash", "ksh", "zsh" ] | |
include: | |
- { os: macos-14, test_shell: bash } # ARM | |
- { os: macos-14, test_shell: ksh } # ARM | |
- { os: macos-14, test_shell: zsh } # ARM | |
- { os: macos-13, test_shell: bash } # x86 | |
- { os: macos-13, test_shell: ksh } # x86 | |
- { os: macos-13, test_shell: zsh } # x86 | |
steps: | |
- name: "Show: GitHub context" | |
env: | |
GITHUB_CONTEXT: ${{ toJSON(github) }} | |
run: echo $GITHUB_CONTEXT | |
- name: "Show: environment variables" | |
run: env | sort | |
- name: Git Checkout | |
uses: actions/checkout@v4 # https://github.com/actions/checkout | |
- name: Install ${{ matrix.test_shell }} | |
run: | | |
if [[ "$OSTYPE" == "darwin"* ]]; then | |
brew install bash parallel ${{ matrix.test_shell }} | |
else | |
sudo apt-get install -y bash parallel ${{ matrix.test_shell }} | |
fi | |
- name: Test with ${{ matrix.test_shell }} | |
continue-on-error: ${{ runner.os == 'macOS' }} # too many random hangs | |
timeout-minutes: 2 | |
run: | | |
bash tests/run-tests.sh ${{ matrix.test_shell }} | |
################################################## | |
# Setup SSH debug session | |
################################################## | |
- name: "SSH session for debugging: check" | |
id: DEBUG_SSH_SESSSION_CHECK | |
if: always() | |
run: | | |
set -eu | |
job_filter_pattern="${{ inputs.debug-with-ssh-only-jobs-matching }}" | |
echo "job_filter: $job_filter_pattern" | |
job_info=$(echo "$GITHUB_JOB ${{ toJSON(matrix) }}" | tr -d '\n') | |
echo "job_info: $job_info" | |
when="${{ inputs.debug-with-ssh }}" | |
if [[ $when == "always" ]] || [[ "$job_info" =~ .*$job_filter_pattern.* ]] && case "${{ job.status }}" in | |
success) [[ $when == "always" ]] ;; | |
cancelled) [[ $when == "on_failure_or_cancelled" ]] ;; | |
failure) [[ $when == "on_failure"* ]] ;; | |
esac; then | |
echo "start_ssh_session=true" | tee -a "$GITHUB_OUTPUT" | |
fi | |
- name: "SSH session for debugging: start" | |
uses: mxschmitt/action-tmate@v3 # https://github.com/mxschmitt/action-tmate | |
if: always() && steps.DEBUG_SSH_SESSSION_CHECK.outputs.start_ssh_session | |
with: | |
limit-access-to-actor: ${{ inputs.debug-with-ssh-only-for-actor }} |