Skip to content

fix(deps): bump actions/checkout from 3 to 4 #81

fix(deps): bump actions/checkout from 3 to 4

fix(deps): bump actions/checkout from 3 to 4 #81

Workflow file for this run

# 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/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
name: Build
on:
push:
branches:
- '**'
tags-ignore:
- '**'
paths-ignore:
- '**/*.adoc'
- '**/*.md'
- '.editorconfig'
- '.git*'
- '.github/*.yml'
- 'tools'
pull_request:
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 after tests ran:"
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
test-target:
description: "If specified only the given target will be tested"
default: ""
type: choice
options: [ "", cpp, cs, eval, flash, hl, java, jvm, lua, neko, node, php, python ]
defaults:
run:
shell: bash
env:
# these env variables are also used by TestRunner.hx
TEST_SSH_HOST: 127.0.0.1
TEST_SSH_PORT: 2222
TEST_SSH_USER: testuser
TEST_SSH_PW: MySuperPW123
TEST_SSH_PEMKEY_FILE: test/id_key.txt
TEST_SSH_PPKKEY_FILE: test/id_key.ppk
TEST_SSH_PUBKEY_FILE: test/id_pub.txt
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
haxe:
- nightly
- 4.3.1
- 4.2.5
steps:
- name: Show environment variables
run: env | sort
- name: Git Checkout
uses: actions/checkout@v4 #https://github.com/actions/checkout
##################################################
# Install software
##################################################
- name: "Linux: Configure fast APT mirror"
uses: vegardit/fast-apt-mirror.sh@v1
- name: 'MacOS: Load Homebrew Docker cache'
# https://github.com/docker-practice/actions-setup-docker/issues/21
uses: actions/cache@v3
if: runner.os == 'macOS'
with:
path: |
~/Library/Caches/Homebrew/downloads/*-Docker.dmg
key: brew-actions-setup-docker
- name: "MacOS: Install docker"
if: runner.os == 'macOS'
uses: docker-practice/actions-setup-docker@master
timeout-minutes: 15
- name: "Install: Putty plink"
run: |
set -eu
case "${{runner.os}}" in
macOS) brew install putty; plink -V ;;
Linux) sudo apt-get install -y putty-tools; plink -V ;;
Windows)
mkdir /tmp/kitty
curl -sSfL https://www.9bis.net/kitty/files/klink.exe -o /tmp/kitty/klink.exe
echo "$(cygpath -wa /tmp/kitty)" >> $GITHUB_PATH
/tmp/kitty/klink -V
;;
esac
##################################################
# Run local SSH server
##################################################
- name: "Create Windows testuser for SSH"
if: runner.os == 'Windows'
shell: cmd
run: net user /ADD ${{ env.TEST_SSH_USER }} ${{ env.TEST_SSH_PW }}
- name: "Start local test SSH server"
run: |
set -euxo pipefail
chmod 400 test/id_*
case "${{ runner.os }}" in
Windows)
# prevents setgid: Invalid argument
mkpasswd -l | tee /etc/passwd
mkgroup -l > /etc/group
/usr/bin/ssh-keygen -vA # generate host keys for sshd
cat <<EOF > /etc/ssh/sshd_config
ListenAddress $TEST_SSH_HOST
Port $TEST_SSH_PORT
PermitRootLogin no
StrictModes no
PubkeyAuthentication yes
IgnoreUserKnownHosts yes
PasswordAuthentication yes
PermitEmptyPasswords no
LogLevel DEBUG3
match User $TEST_SSH_USER
AuthorizedKeysFile $(pwd)/$TEST_SSH_PUBKEY_FILE
EOF
/usr/bin/sshd -T # test config
# install PsExec to run sshd as SYSTEM without having to configure it as a system service
curl -sSfL -o PSTools.zip http://download.sysinternals.com/files/PSTools.zip
unzip PSTools.zip PsExec64.exe
# launch sshd in background as SYSTEM to prevent "/usr/bin/bash: Operation not permitted"
./PsExec64 -accepteula -d -s "$(cygpath -w /usr/bin/sshd)" -E /tmp/sshd.log &
sleep 5
# TODO for some reason on GitHub Actions under Windows accepting new host keys doesn't work
# when plink/klink is executed via the PuttySSHClient class, so for now we accept
# the key before the Windows tests run
klink -auto-store-sshkey \
-P $TEST_SSH_PORT \
-pw $TEST_SSH_PW \
$TEST_SSH_USER@$TEST_SSH_HOST \
"whoami"
;;
*)
touch /tmp/sshd.log
docker run -d --rm \
--name "openssh-server" \
-e PASSWORD_ACCESS=true \
-e USER_NAME=$TEST_SSH_USER \
-e USER_PASSWORD=$TEST_SSH_PW \
-e PUBLIC_KEY_FILE=/config/id_pub.txt \
-p $TEST_SSH_PORT:2222 \
--volume $(pwd)/$TEST_SSH_PUBKEY_FILE:/config/id_pub.txt:ro \
--volume /tmp/sshd.log:/config/logs/openssh/current:rw \
lscr.io/linuxserver/openssh-server:latest
;;
esac
##################################################
# Run Haxe Tests
##################################################
- name: Test with Haxe
uses: vegardit/haxe-reusable-workflows/.github/actions/test-with-haxe@v1
with:
haxe-version: ${{ matrix.haxe }}
haxe-libs: haxe-concurrent haxe-doctest haxe-files haxe-strings hx3compat
# Haxe targets to test with, by default all are set to false:
test-cpp: true
test-cs: true
test-hl: true
test-java: true
test-jvm: true
test-neko: true
test-python: true
# provide SSH access to the GitHub runner for manual debugging purposes
debug-with-ssh: ${{ inputs.debug-with-ssh || 'never' }}
debug-with-ssh-only-for-actor: ${{ inputs.debug-with-ssh-only-for-actor || false }}
debug-with-ssh-only-jobs-matching: ${{ inputs.debug-with-ssh-only-jobs-matching }}
##################################################
# Dipslay logs
##################################################
- name: Shutdown SSHD and display logs
if: always()
run: |
case "${{runner.os}}" in
Windows) ;;
*) docker container rm openssh-server --force || true ;;
esac
cat /tmp/sshd.log || true