Skip to content

Revert run-tests and added jenkins driver test #9024

Revert run-tests and added jenkins driver test

Revert run-tests and added jenkins driver test #9024

Workflow file for this run

name: Run driver tests

Check failure on line 1 in .github/workflows/run-tests.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/run-tests.yml

Invalid workflow file

(Line: 45, Col: 38): Job 'run-driver-tests' depends on unknown job 'get-dev-artifact'.
on:
pull_request:
types: [opened, synchronize, labeled, unlabeled]
paths:
- 'drivers/**'
jobs:
# Two separate jobs for finding the right artifact to run tests with
get-latest-release-artifact:
runs-on: ubuntu-latest
if: ${{ !contains(join(github.event.pull_request.labels.*.name), 'release') }}
outputs:
cache_key: ${{ steps.cache_key.outputs.CACHE_KEY }}
steps:
- name: Find the lua lib release version
id: lib-version
run: |
curl "https://github.com/SmartThingsCommunity/SmartThingsEdgeDrivers/releases/latest" -s -L -I -o /dev/null -w '%{url_effective}' > test.log
echo "url=$(cat test.log)" >> $GITHUB_OUTPUT
- name: Try to retrieve cache
id: cached-libs
uses: actions/cache@v3
with:
path: '/home/runner/work/lua_libs'
key: ${{ steps.lib-version.outputs.url }}-v1
- name: Get the latest release artifact
if: steps.cached-libs.outputs.cache-hit != 'true'
uses: dsaltares/fetch-gh-release-asset@master
with:
file: 'lua_libs.*'
regex: true
target: '/home/runner/work/lua_libs/'
- name: Extract the lua libraries
if: steps.cached-libs.outputs.cache-hit != 'true'
working-directory: '/home/runner/work/lua_libs'
run: tar -xf *.tar.gz --wildcards -C . --strip-components=1 '*.lua'
- name: Set output
id: cache_key
run: echo "CACHE_KEY=${{ steps.lib-version.outputs.url }}-v1" >> $GITHUB_OUTPUT
run-driver-tests:
runs-on: ubuntu-latest
needs:
[ get-latest-release-artifact, get-dev-artifact ]
if: ${{ always() && contains(needs.*.result, 'success') && !contains(needs.*.result, 'failure') }}
steps:
- name: Set cache key
id: cache_key
run: echo "CACHE_KEY=${{ join(needs.*.outputs.cache_key) }}" >> $GITHUB_OUTPUT
- name: Try to retrieve cache
id: cached_libs
uses: actions/cache@v3
with:
path: '/home/runner/work/lua_libs'
key: ${{ steps.cache_key.outputs.CACHE_KEY }}
- name: Fail if cache missed
if: steps.cached_libs.outputs.cache-hit != 'true'
uses: actions/github-script@v3
with:
script: |
core.setFailed('Library cache missed. ${{steps.cached_libs.outputs.cache-hit}} ')
- name: Install lua
run: |
sudo apt-get update
sudo apt-get install lua5.3 liblua5.3-dev luarocks
- name: Install lua rocks
run: |
wget https://luarocks.org/manifests/hisham/luacov-0.15.0-1.rockspec
wget https://raw.githubusercontent.com/britzl/luacov-cobertura/refs/tags/1.1.0/rockspec -O luacov-cobertura-1.1.0-0.rockspec
sed -i 's/master/1\.1\.0/g' luacov-cobertura-1.1.0-0.rockspec
sed -i 's/1\.0-0/1\.1\.0-0/g' luacov-cobertura-1.1.0-0.rockspec
sudo luarocks install luacov-0.15.0-1.rockspec
sudo luarocks install luacov-cobertura-1.1.0-0.rockspec
- name: Set LUA_PATH
id: lua_path
env:
LUA_PATH_APPEND: /home/runner/work/lua_libs/?.lua;./?.lua;/home/runner/work/lua_libs/?/init.lua;./?/init.lua
run: |
eval "$(luarocks path --bin)"
echo "lua_path=$LUA_PATH_APPEND;$LUA_PATH" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
- name: get changed drivers
id: changed-drivers
uses: tj-actions/changed-files@v41
with:
dir_names: true
dir_names_max_depth: 3
files: "drivers/**"
safe_output: false
- run: echo ${{ steps.changed-drivers.outputs.all_modified_files }}
- name: Install Python requirements
run: pip install -r tools/requirements.txt
- name: Run the tests
id: run-tests
run: python tools/run_driver_tests_p.py ${{ steps.changed-drivers.outputs.all_modified_files }}
env:
LUA_PATH: ${{ steps.lua_path.outputs.lua_path }}
- name: Upload test artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: tests
path: |
tools/test_output/*.xml
- name: Upload coverage artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage
path: |
tools/coverage_output/*_coverage.xml
event-file:
runs-on: ubuntu-latest
steps:
- name: Upload event file artifact
uses: actions/upload-artifact@v4
with:
name: event-file
path: ${{ github.event_path }}
- run: echo ${{ github.event.number }} > pr_number.txt
- name: Upload pr number artifact
uses: actions/upload-artifact@v4
with:
name: pr_number
path: |
pr_number.txt