Skip to content

Commit 7dc5d18

Browse files
Moving Tests to Github Action (#60)
* Moving Tests to Github Action * Fix * Add github action badges in README
1 parent f1111f2 commit 7dc5d18

File tree

9 files changed

+111
-208
lines changed

9 files changed

+111
-208
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Docker Build and Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
env:
12+
ACR: jrtc
13+
IMAGE_TAG: ${{ github.run_id }}-${{ github.sha }}
14+
15+
jobs:
16+
build_and_test:
17+
name: Build and Test
18+
runs-on: ubuntu-latest
19+
20+
strategy:
21+
matrix:
22+
dockerType:
23+
- { value: "azurelinux", displayName: "Azure Linux", id: "mariner" }
24+
- { value: "ubuntu22_04", displayName: "Ubuntu 22.04", id: "ubuntu22_04" }
25+
- { value: "ubuntu24_04", displayName: "Ubuntu 24.04", id: "ubuntu24_04" }
26+
testCase:
27+
- { description: "Address Sanitizer", id: "test1", sanitizerBuildParam: "-e SANITIZER=1" }
28+
- { description: "No Address Sanitizer", id: "test2", sanitizerBuildParam: "-e SANITIZER=0" }
29+
30+
steps:
31+
- name: Checkout Code
32+
uses: actions/checkout@v4
33+
34+
- name: System Information
35+
run: |
36+
echo "****************Pipeline VM Information**********"
37+
echo "Running on: ${{ runner.os }}"
38+
echo "****************CPU Arch**********"
39+
lscpu
40+
echo "****************CPU***************"
41+
cat /proc/cpuinfo
42+
echo "****************MEM***************"
43+
cat /proc/meminfo
44+
echo "****************DISK**************"
45+
df -h
46+
echo "****************FREE**************"
47+
free -m
48+
echo "****************HOST**************"
49+
echo "Agent.MachineName: ${{ runner.name }}"
50+
echo "Agent.Name: ${{ github.actor }}"
51+
echo "System.HostType: ${{ github.event_name }}"
52+
if [ -z "${{ secrets.REQUIRED_CPU_MODEL }}" ]; then
53+
echo "No specific CPU model required."
54+
else
55+
echo "Required CPU Model: ${{ secrets.REQUIRED_CPU_MODEL }}"
56+
fi
57+
echo "****************CPU Model*********"
58+
lscpu
59+
- name: Setup Docker
60+
run: echo "Setting up Docker for ${{ matrix.dockerType.displayName }}"
61+
62+
- name: Build Docker Image
63+
run: |
64+
set -ex
65+
./init_submodules.sh
66+
docker build \
67+
-t ${{ env.ACR }}/jrtc-${{ matrix.dockerType.id }}:${{ env.IMAGE_TAG }} \
68+
-f deploy/${{ matrix.dockerType.value }}.Dockerfile .
69+
docker tag ${{ env.ACR }}/jrtc-${{ matrix.dockerType.id }}:${{ env.IMAGE_TAG }} jrtc
70+
- name: Run Container to Build JRTC
71+
run: |
72+
docker run \
73+
-v "$(pwd)":/jrtc_out_lib \
74+
-e INITIALIZE_SUBMODULES=0 \
75+
${{ matrix.testCase.sanitizerBuildParam }} jrtc
76+
- name: Run Tests
77+
run: |
78+
set -ex
79+
source setup_jrtc_env.sh
80+
docker run --init --privileged \
81+
--ulimit memlock=-1 \
82+
--network host \
83+
--cap-add=SYS_ADMIN \
84+
--shm-size=1g \
85+
--mount type=tmpfs,destination=/dev/shm \
86+
-e VERBOSE=1 \
87+
-e JRTC_PATH=/jrtc \
88+
-v "$(pwd)":/jrtc_out_lib \
89+
${{ matrix.testCase.sanitizerBuildParam }} \
90+
-e RUN_TESTS=1 jrtc
91+
- name: Run Integration Tests
92+
run: |
93+
set -ex
94+
source setup_jrtc_env.sh
95+
docker run --init --privileged \
96+
--ulimit memlock=-1 \
97+
--network host \
98+
--cap-add=SYS_ADMIN \
99+
--shm-size=1g \
100+
--mount type=tmpfs,destination=/dev/shm \
101+
-e VERBOSE=1 \
102+
-e JRTC_PATH=/jrtc \
103+
-v /tmp:/tmp \
104+
-v "$(pwd)":/jrtc_out_lib \
105+
${{ matrix.testCase.sanitizerBuildParam }} \
106+
--entrypoint=/jrtc/helper_build_files/run_all_integration_tests.sh \
107+
jrtc

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Introduction
2-
[![Build Status](https://belgrade.visualstudio.com/jrt-controller/_apis/build/status%2Fjrtc?repoName=microsoft%2Fjrt-controller&branchName=main)](https://belgrade.visualstudio.com/jrt-controller/_build/latest?definitionId=148&repoName=microsoft%2Fjrt-controller&branchName=main)
2+
[![Build Status](https://belgrade.visualstudio.com/jrt-controller/_apis/build/status%2Fjrtc?repoName=microsoft%2Fjrt-controller&branchName=main)](https://belgrade.visualstudio.com/jrt-controller/_build/latest?definitionId=148&repoName=microsoft%2Fjrt-controller&branchName=main) [![Docker Build and Test](https://github.com/microsoft/jrt-controller/actions/workflows/docker-build-and-test.yaml/badge.svg)](https://github.com/microsoft/jrt-controller/actions/workflows/docker-build-and-test.yaml)
33

44
*jrt-controller* is a real-time controller for network functions instrumented with the [jbpf framework](https://github.com/microsoft/jbpf).
55
Like jbpf, the controller is part of [Project Janus](https://www.microsoft.com/en-us/research/project/programmable-ran-platform/) and provides functionalities envisaged by the concept of real-time RIC in O-RAN.

azure-pipeline.yaml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,7 @@ pr:
1313
- main
1414
- gh-readonly-queue/main/*
1515

16-
pool:
17-
name: agent-pool-onprem-ubuntu
18-
# demands: Agent.CPU -equals 8
19-
2016
schedules:
21-
- cron: "0 0 1 * *"
22-
displayName: Monthly scheduled build
23-
branches:
24-
include:
25-
- main
26-
always: true
2717
- cron: "0 0 * * *"
2818
displayName: Daily scheduled build
2919
branches:
@@ -35,7 +25,6 @@ variables:
3525
acr: jrtc
3626
ComponentDetection.Timeout: 1200
3727
containerRegistry: $[format('{0}.azurecr.io',variables['acr'])]
38-
DOCKER_BUILDKIT: 1
3928
imageTag: "$[format('pipeline-{0}-{1}', replace(variables['build.buildnumber'], '.', '-'), variables['build.sourceversion'])]"
4029

4130
resources:
@@ -79,7 +68,7 @@ stages:
7968
outputformat: 'text'
8069
outputfile: '$(System.DefaultWorkingDirectory)/NOTICE'
8170

82-
- template: pipeline/build-for-os.yaml
71+
- template: pipeline/coverage-tests.yaml
8372

8473
- stage: Doxygen
8574
dependsOn: []

pipeline/build-lib.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ parameters:
77
default: ""
88

99
steps:
10-
- template: submodules.yaml
10+
- checkout: self
11+
submodules: recursive
1112

1213
- template: images/build.v2.yaml@templates
1314
parameters:

pipeline/build.yaml

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,6 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT license.
33

4-
parameters:
5-
- name: dockerTypes
6-
displayName: "Configuration Types"
7-
type: object
8-
default:
9-
- value: "azurelinux"
10-
displayName: "Azure Linux"
11-
id: "mariner"
12-
- value: "ubuntu22_04"
13-
displayName: "Ubuntu 22.04"
14-
id: "ubuntu22_04"
15-
- value: "ubuntu24_04"
16-
displayName: "Ubuntu 24.04"
17-
id: "ubuntu24_04"
18-
19-
- name: testCases
20-
displayName: Test Cases
21-
type: object
22-
default:
23-
- description: "Address Sanitizer"
24-
id: test1
25-
sanitizerBuildParam: "-e SANITIZER=1"
26-
27-
- description: "No Address Sanitizer"
28-
id: test2
29-
sanitizerBuildParam: "-e SANITIZER=0"
30-
314
stages:
325
- stage: CoverageTests
336
displayName: CoverageTests
@@ -80,27 +53,3 @@ stages:
8053
#failIfCoverageEmpty: false # boolean. Fail when code coverage results are missing. Default: false.
8154

8255
- template: agentpool/cleanup.yaml@templates
83-
84-
- ${{ each dockerType in parameters.dockerTypes }}:
85-
- stage: ${{ dockerType.id }}
86-
displayName: ${{ dockerType.displayName }}
87-
dependsOn: []
88-
jobs:
89-
- ${{ each testCase in parameters.testCases }}:
90-
- job: ${{ testCase.id }}_${{ dockerType.id }}
91-
dependsOn: []
92-
displayName: Test - ${{ testCase.description }}
93-
workspace:
94-
clean: all
95-
steps:
96-
- template: agentpool/cleanup.yaml@templates
97-
- template: setup-on-vm.yaml
98-
- template: print-debug-info.yaml
99-
- template: build-lib.yaml
100-
parameters:
101-
dockerType: ${{ dockerType.value }}
102-
- template: standard-tests.yaml
103-
parameters:
104-
dockerType: ${{ dockerType.value }}
105-
testCase: ${{ testCase }}
106-
- template: agentpool/cleanup.yaml@templates

pipeline/setup-on-vm.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.

pipeline/standard-tests.yaml

Lines changed: 0 additions & 77 deletions
This file was deleted.

pipeline/submodules.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)