Skip to content

Linux CI Tests

Linux CI Tests #907

name: Linux CI Tests
on:
push:
branches:
- main
pull_request:
pull_request_target:
types: [labeled]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
# Only allow build to start when label 'Run CI' added for forked
# based PR
if: ( github.event.pull_request.head.repo.fork == false ) ||
( contains(github.event.pull_request.labels.*.name, 'Run CI') )
steps:
# Same repo
- uses: actions/checkout@v2
with:
submodules: recursive
if: >-
( github.event_name == 'pull_request' ) &&
( github.event.pull_request.head.repo.fork == false )
# Forked repo
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
if: >-
( github.event_name == 'pull_request_target' ) &&
( github.event.pull_request.head.repo.fork == true )
- name: Style Check
run: |
.github/scripts/code_style.sh check || ( \
echo -e '::error There are files which do not adhere to the coding style. \
Please see directions to fix this here: https://github.com/Azure/azure-iot-middleware-freertos#code-style' \
&& exit 1 )
if: >-
(
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.fork == false
) || (
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.fork == true
)
- name: Configure
run: .github/scripts/install_software.sh; sudo .github/scripts/init_linux_port_vm_network.sh
if: >-
(
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.fork == false
) || (
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.fork == true
)
- name: Fetch FreeRTOS
run: .github/scripts/fetch_freertos.sh
if: >-
(
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.fork == false
) || (
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.fork == true
)
- name: Build with Clang
run: .github/scripts/clang_build.sh
if: >-
(
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.fork == false
) || (
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.fork == true
)
- name: Unit Tests
run: sudo bash -c ".github/scripts/unit_tests.sh"
if: >-
(
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.fork == false
) || (
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.fork == true
)
# Note that the ADU_AAD_APPLICATION_SECRET expires after a year.
# Next expiration 10/24/2023
- name: E2E Tests
run: sudo bash -c 'export IOTHUB_CONNECTION_STRING="${{ secrets.IOTHUB_CONNECTION_STRING }}";
export IOT_PROVISIONING_CONNECTION_STRING="${{ secrets.IOT_PROVISIONING_CONNECTION_STRING }}";
export IOT_PROVISIONING_SCOPE_ID="${{ secrets.IOT_PROVISIONING_SCOPE_ID }}";
export ADU_AAD_APPLICATION_SECRET="${{ secrets.ADU_AAD_APPLICATION_SECRET }}";
export ADU_IOTHUB_CONNECTION_STRING="${{ secrets.ADU_IOTHUB_CONNECTION_STRING }}";
.github/scripts/e2e_tests.sh'
if: >-
(
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.fork == false
) || (
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.fork == true
)