From af8cf8766d9154e5e9bfba24de535333c548c095 Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral Date: Fri, 18 Feb 2022 06:25:34 +0100 Subject: [PATCH] ci: rework Signed-off-by: Unai Martinez-Corral --- ci/action.sh | 37 +++++++++++++++++++++++++++++++++++++ ci/action.yml | 30 ++++-------------------------- ci/download_sdk.sh | 5 ----- 3 files changed, 41 insertions(+), 31 deletions(-) create mode 100755 ci/action.sh delete mode 100755 ci/download_sdk.sh diff --git a/ci/action.sh b/ci/action.sh new file mode 100755 index 000000000..30bea9989 --- /dev/null +++ b/ci/action.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# Build +if [ $SKIP ]; then + exit 0; +fi + +if [ $OS_NAME = "windows" ]; then + export PATH="$PATH:/c/ProgramData/Chocolatey/bin/:/c/Program Files/Git/usr/bin/" +fi + +export CI_SCRIPTS_PATH=${CI_SCRIPTS_PATH:-$(dirname "$0")} + +source $CI_SCRIPTS_PATH/common.sh + +# Download SDK +if [ $OS_NAME = 'osx' ]; then + if [[ ! -d $HOME/sdk/MacOSX10.9.sdk ]]; then + git clone https://github.com/phracker/MacOSX-SDKs $HOME/sdk + fi +fi + +bash $CI_SCRIPTS_PATH/install.sh + +set -x + +if [ $SCRIPT ]; then + bash $SCRIPT +else + bash $CI_SCRIPTS_PATH/script.sh +fi + +if [ $? -eq 0 ]; then + source $CI_SCRIPTS_PATH/after_success.sh +else + source $CI_SCRIPTS_PATH/after_failure.sh +fi diff --git a/ci/action.yml b/ci/action.yml index d108ab525..38f44203e 100644 --- a/ci/action.yml +++ b/ci/action.yml @@ -1,32 +1,10 @@ name: 'Package build' + description: 'Build a package' + runs: using: "composite" steps: - - name: build - run: | - if [ $SKIP ]; then - exit 0; - fi - if [ $OS_NAME = "windows" ]; then - export PATH="$PATH:/c/ProgramData/Chocolatey/bin/" - export PATH="$PATH:/c/Program Files/Git/usr/bin/" - fi - # Used in the scripts to locate other scripts. - export CI_SCRIPTS_PATH="$GITHUB_ACTION_PATH" - source $GITHUB_ACTION_PATH/common.sh - bash $GITHUB_ACTION_PATH/download_sdk.sh - bash $GITHUB_ACTION_PATH/install.sh - set -x - if [ $SCRIPT ]; then - bash $SCRIPT - else - bash $GITHUB_ACTION_PATH/script.sh - fi - if [ $? -eq 0 ]; then - source $GITHUB_ACTION_PATH/after_success.sh - else - source $GITHUB_ACTION_PATH/after_failure.sh - fi - shell: bash + - shell: bash + run: $GITHUB_ACTION_PATH/action.sh diff --git a/ci/download_sdk.sh b/ci/download_sdk.sh deleted file mode 100755 index 97f6d7983..000000000 --- a/ci/download_sdk.sh +++ /dev/null @@ -1,5 +0,0 @@ -if [ $OS_NAME = 'osx' ]; then - if [[ ! -d $HOME/sdk/MacOSX10.9.sdk ]]; then - git clone https://github.com/phracker/MacOSX-SDKs $HOME/sdk - fi -fi