Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Commit

Permalink
ci: GitHub actions require new env var handling
Browse files Browse the repository at this point in the history
  • Loading branch information
zehnm committed Oct 22, 2020
1 parent a79027e commit cfa43f2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
- name: Get artifact version
run: |
read -r APP_VERSION < binaries/version.txt
echo "::set-env name=APP_VERSION::$APP_VERSION"
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
- name: Upload build artefacts
uses: actions/upload-artifact@v2
Expand All @@ -93,7 +93,7 @@

- name: Get timestamp
run: |
echo "::set-env name=TIMESTAMP::$(date +"%Y%m%d_%H%M%S")"
echo "TIMESTAMP=$(date +"%Y%m%d_%H%M%S")" >> $GITHUB_ENV
- name: Create GitHub development build archives
if: "!contains(github.ref, 'tags/v')"
Expand Down
48 changes: 21 additions & 27 deletions .github/workflows/build_desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ env:
APP_PRO: openhab.pro
APP_NAME: libopenhab
PROJECT_NAME: integration.openhab
PLUGIN_METAFILE: openhab.json
# Build artifact output path. Used to set project specific YIO_BIN env var in 'qt_creator' step.
BIN_OUTPUT_PATH: "binaries"
DEBUG_OUTPUT: "false"
Expand All @@ -35,7 +36,7 @@ jobs:
- {
name: "Linux Latest x64", artifact: "Linux-x64", build: "release",
qmake-args: "CONFIG+=release",
os: ubuntu-latest
os: ubuntu-20.04
}
- {
name: "macOS Latest x64", artifact: "macOS-x64", build: "release",
Expand All @@ -56,6 +57,7 @@ jobs:
# history required to determine number of commits since last release tag
fetch-depth: 0
path: ${{ env.PROJECT_NAME }}

- name: Fetch all tags to determine version
run: |
cd ${{ env.PROJECT_NAME }}
Expand All @@ -66,7 +68,11 @@ jobs:
run: |
YIO_INTG_LIB_VERSION=$(cat "${GITHUB_WORKSPACE}/${{ env.PROJECT_NAME }}/dependencies.cfg" | awk '/^integrations.library:/{print $2}')
echo "Required integrations.library: $YIO_INTG_LIB_VERSION"
echo "::set-env name=YIO_INTG_LIB_VERSION::$YIO_INTG_LIB_VERSION"
echo "YIO_INTG_LIB_VERSION=$YIO_INTG_LIB_VERSION" >> $GITHUB_ENV
- name: Set build output directory
shell: bash
run: echo "YIO_BIN=${GITHUB_WORKSPACE}/${BIN_OUTPUT_PATH}" >> $GITHUB_ENV

- name: Checkout integrations.library
uses: actions/checkout@v2
Expand All @@ -79,7 +85,9 @@ jobs:
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install libavahi-client-dev libgl1-mesa-dev
sudo apt install libavahi-client-dev libgl1-mesa-dev g++-8 libstdc++-8-dev
# Qt Creator library path is required for Qt linguist tools. Otherwise we'll get libicui18n.so.56 not found!
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/qtcreator/lib/Qt/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
- name: Download Qt Creator
id: qt_creator
Expand All @@ -95,22 +103,13 @@ jobs:
set(qtc_platform "windows_vs2015_64")
elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat")
set(qtc_platform "windows_msvc2017_x64")
elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat")
set(qtc_platform "windows_msvc2017_x86")
endif()
elseif ("${{ runner.os }}" STREQUAL "Linux")
set(qtc_platform "linux_gcc_64_rhel72")
elseif ("${{ runner.os }}" STREQUAL "macOS")
set(qtc_platform "mac_x64")
endif()
# Set YIO_BIN env var for other steps
message("::set-env name=YIO_BIN::${qtc_output_directory}")
# Qt Creator library path is required for Qt linguist tools. Otherwise we'll get libicui18n.so.56 not found!
if ("${{ runner.os }}" STREQUAL "Linux")
message("::set-env name=LD_LIBRARY_PATH::$ENV{GITHUB_WORKSPACE}/qtcreator/lib/Qt/lib:$ENV{LD_LIBRARY_PATH}")
endif()
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/../downloads" download_dir)
file(MAKE_DIRECTORY ${qtc_output_directory})
Expand Down Expand Up @@ -181,9 +180,6 @@ jobs:
if ("${{ matrix.config.environment_script }}" MATCHES "vcvars64.bat")
set(qt_package_name "qt.qt5.${qt_version_dotless}.win64_msvc2017_64")
set(qt_dir_prefix "${qt_version}/msvc2017_64")
elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat")
set(qt_package_name "qt.qt5.${qt_version_dotless}.win32_msvc2017")
set(qt_dir_prefix "${qt_version}/msvc2017")
else()
endif()
elseif ("${{ runner.os }}" STREQUAL "Linux")
Expand Down Expand Up @@ -223,11 +219,6 @@ jobs:
set(package_suffix ${CMAKE_MATCH_2})
string(REPLACE "-debug-symbols" "" package_suffix "${package_suffix}")
# Workaround for CMake's greedy regex
if ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat")
string(REPLACE "X86_64" "X86" package_suffix "${package_suffix}")
endif()
file(MAKE_DIRECTORY qt5)
# Save the path for other steps
Expand Down Expand Up @@ -298,7 +289,7 @@ jobs:
- name: Configure
shell: cmake -P {0}
run: |
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
if ("${{ runner.os }}" STREQUAL "Windows")
execute_process(
COMMAND "${{ matrix.config.environment_script }}" && set
OUTPUT_FILE environment_script_output.txt
Expand All @@ -307,9 +298,6 @@ jobs:
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
# Set for other steps
message("::set-env name=${CMAKE_MATCH_1}::${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
Expand Down Expand Up @@ -342,6 +330,12 @@ jobs:
shell: cmake -P {0}
run: |
if ("${{ runner.os }}" STREQUAL "Windows")
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
set(ENV{PATH} "${{ steps.qt.outputs.qt_dir }}/bin/;$ENV{PATH}")
else()
set(ENV{PATH} "${{ steps.qt.outputs.qt_dir }}/bin/:$ENV{PATH}")
Expand All @@ -365,7 +359,7 @@ jobs:
endif()
execute_process(
COMMAND cp $ENV{GITHUB_WORKSPACE}/$ENV{PROJECT_NAME}/openhab.json $ENV{YIO_BIN}
COMMAND cp $ENV{GITHUB_WORKSPACE}/$ENV{PROJECT_NAME}/$ENV{PLUGIN_METAFILE} $ENV{YIO_BIN}
)
execute_process(
COMMAND cp $ENV{GITHUB_WORKSPACE}/$ENV{PROJECT_NAME}/version.txt $ENV{YIO_BIN}
Expand All @@ -374,9 +368,9 @@ jobs:
- name: Set build artifact name
shell: bash
run: |
APP_VERSION=$(cat ${{ env.YIO_BIN }}/version.txt | awk '{print $1}')
APP_VERSION=$(cat "${{ env.YIO_BIN }}/version.txt" | awk '{print $1}')
echo "App version: $APP_VERSION"
echo "::set-env name=ARTIFACT_NAME::${{ env.APP_NAME }}-$APP_VERSION-Qt${{ env.QT_VERSION }}-${{ matrix.config.artifact }}-${{ matrix.config.build }}"
echo "ARTIFACT_NAME=${{ env.APP_NAME }}-$APP_VERSION-Qt${{ env.QT_VERSION }}-${{ matrix.config.artifact }}-${{ matrix.config.build }}" >> $GITHUB_ENV
- uses: actions/upload-artifact@v1
id: upload_artifact
Expand Down

0 comments on commit cfa43f2

Please sign in to comment.