From f324cd3bdd42bc0611bcdf470986f33fe52710f1 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Mon, 15 Jun 2020 16:42:37 +0200 Subject: [PATCH] Add proper detection for github-actions service --- cue-test.py | 7 +++++++ cue.py | 26 ++++++++++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/cue-test.py b/cue-test.py index 4f7124d..b88cc76 100644 --- a/cue-test.py +++ b/cue-test.py @@ -31,6 +31,13 @@ if 'APPVEYOR' in os.environ: elif re.match(r'^macOS', os.environ['APPVEYOR_BUILD_WORKER_IMAGE']): ci_os = 'osx' +if 'GITHUB_ACTIONS' in os.environ: + ci_service = 'github-actions' + if os.environ['RUNNER_OS'] == 'macOS': + ci_os = 'osx' + else: + ci_os = os.environ['RUNNER_OS'].lower() + def find_in_file(regex, filename): file = open(filename, "r") diff --git a/cue.py b/cue.py index 528b6e8..1569e80 100644 --- a/cue.py +++ b/cue.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -"""CI build script for Linux/MacOS/Windows on Travis/AppVeyor +"""CI build script for Linux/MacOS/Windows on Travis/AppVeyor/GitHub-Actions """ from __future__ import print_function @@ -43,6 +43,25 @@ def detect_context(): ci['compiler'] = os.environ['CMP'] buildconfig = os.environ['CONFIGURATION'].lower() + if 'GITHUB_ACTIONS' in os.environ: + ci['service'] = 'github-actions' + if os.environ['RUNNER_OS'] == 'macOS': + ci['os'] = 'osx' + else: + ci['os'] = os.environ['RUNNER_OS'].lower() + ci['platform'] = 'x64' + if 'CMP' in os.environ: + ci['compiler'] = os.environ['CMP'] + if ci['os'] == 'windows': + ci['choco'] += ['strawberryperl'] + if 'BCFG' in os.environ: + buildconfig = os.environ['BCFG'].lower() + + if re.search('static', buildconfig): + ci['static'] = True + if re.search('debug', buildconfig): + ci['debug'] = True + if 'STATIC' in os.environ: print("{0}WARNING: Variable 'STATIC' not supported anymore; use 'BCFG' instead{1}" .format(ANSI_RED, ANSI_RESET)) @@ -52,11 +71,6 @@ def detect_context(): .format(ANSI_RED, buildconfig, ANSI_RESET)) sys.stdout.flush() - if re.search('static', buildconfig): - ci['static'] = True - if re.search('debug', buildconfig): - ci['debug'] = True - if ci['static']: ci['configuration'] = 'static' else: