Skip to content

Build

Build #83

Workflow file for this run

# SPDX-FileCopyrightText: © Vegard IT GmbH (https://vegardit.com) and contributors
# SPDX-FileContributor: Sebastian Thomschke
# SPDX-License-Identifier: MIT
# SPDX-ArtifactOfProjectHomePage: https://github.com/vegardit/haxe-clink-externs
#
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: Build
on:
schedule:
- cron: '0 15 1 * *'
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:
- '**/*.adoc'
- '**/*.md'
- '.editorconfig'
- '.git*'
- '.github/*.yml'
- '.github/workflows/stale.yml'
- 'tools'
pull_request:
paths-ignore:
- '**/*.adoc'
- '**/*.md'
- '.editorconfig'
- '.git*'
- '.github/*.yml'
- 'tools'
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:
###########################################################
build:
###########################################################
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: # https://github.com/actions/runner-images#available-images
- windows-latest
haxe:
- nightly
- latest
- 4.3.6
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: Clink"
run: |
set -eux
pushd $HOME
curl -sSfL https://github.com/chrisant996/clink/releases/download/v1.7.7/clink.1.7.7.521fa7.zip -o clink.zip
unzip clink.zip -d clink
cp clink/clink_x64.exe clink/clink.exe
cat <<EOF > $HOME/clink/lua.cmd
$(cygpath -w "$HOME/clink/clink") lua %*
EOF
cat <<EOF > $HOME/clink/lua
#!/bin/sh
$HOME/clink/clink lua "\$@"
EOF
chmod 777 clink/lua
echo "$(cygpath -w "$HOME/clink")" >> $GITHUB_PATH
- name: "Verify: Clink and Lua"
run: |
set -eux
clink --version
lua -v
- name: "Install Haxe and Haxelibs"
uses: vegardit/haxe-reusable-workflows/.github/actions/setup-haxe@dev
with:
haxe-reusable-workflows-version: dev
haxe-version: ${{ matrix.haxe }}
haxe-libs: |
haxe-doctest
no-spoon@git:https://github.com/back2dos/no-spoon
- name: "Run Tests"
continue-on-error: ${{ matrix.haxe == 'nightly' }}
run: |
set -eux
haxe tests.hxml
lua target/lua/TestRunner.lua
##################################################
# 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 ${{ runner.os }} haxe-${{ matrix.haxe-version }}" | 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 }}