-
Notifications
You must be signed in to change notification settings - Fork 30
136 lines (129 loc) · 5.13 KB
/
Copy pathbuild-test.yml
File metadata and controls
136 lines (129 loc) · 5.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: "Build and test"
on:
push:
branches:
- main
pull_request:
# 'labeled' is needed so that adding the run-test-on-mult-nodes label to an
# open pull request triggers the multi-node job below.
types:
- opened
- reopened
- synchronize
- labeled
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
checks:
name: Format and License Checks
runs-on: [self-hosted, 1ES.Pool=gha-scitt-pool]
container: mcr.microsoft.com/azurelinux/base/core:3.0
steps:
- run: |
gpg --import /etc/pki/rpm-gpg/MICROSOFT-RPM-GPG-KEY
tdnf update -y
tdnf install -y --disablerepo azurelinux-official-ms-non-oss build-essential ca-certificates git
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: ./scripts/setup-env.sh
- run: ./scripts/ci-checks.sh
build-test:
name: CI
needs: checks
runs-on: [self-hosted, 1ES.Pool=gha-scitt-pool]
container:
image: mcr.microsoft.com/azurelinux/base/core:3.0
options: --user root --publish-all --cap-add NET_ADMIN --cap-add NET_RAW --cap-add SYS_PTRACE -v /lib/modules:/lib/modules:ro
env:
# Helps to distinguish between CI and local builds.
SCITT_CI: 1
# Additional CMake flags.
ENABLE_CLANG_TIDY: ON
ENABLE_DOTNET_TESTS: 1
steps:
- name: Setup environment
run: |
gpg --import /etc/pki/rpm-gpg/MICROSOFT-RPM-GPG-KEY
tdnf update -y
tdnf install -y --disablerepo azurelinux-official-ms-non-oss build-essential ca-certificates git
- name: Checkout repository with tags
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
# Work-around for https://github.com/actions/runner/issues/2033
- name: Work around git safe.directory in container
run: chown -R $(id -u):$(id -g) $PWD
- run: ./scripts/setup-env.sh
- run: ./build.sh
- name: Install dotnet test dependencies
run: |
tdnf install -y dotnet-sdk-8.0.x86_64
- run: ./run_functional_tests.sh
- name: "Upload logs"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: success() || failure()
with:
name: logs
path: |
/tmp/pytest-of-root/*current/*current/*.{out,err}
/tmp/pytest-of-root/*current/*current/config.json
if-no-files-found: warn
build-test-multi-node:
name: CI (3 node cluster)
needs: checks
# Running a cluster is a lot more expensive than a single node, so it is
# opt-in: label the pull request with run-test-on-mult-nodes, or trigger the
# workflow manually.
if: ${{ contains(github.event.pull_request.labels.*.name, 'run-test-on-mult-nodes') || github.event_name == 'workflow_dispatch' }}
runs-on: [self-hosted, 1ES.Pool=gha-scitt-pool]
env:
SCITT_CI: 1
# Run the tests against a cluster fronted by a round robin load balancer,
# rather than against a single node.
DOCKER: 1
NODE_COUNT: 3
# Puts the sibling containers in this container's network namespace, so
# that the load balancer is reachable on localhost from the tests.
DOCKER_IN_DOCKER: 1
container:
image: mcr.microsoft.com/azurelinux/base/core:3.0
# The nodes and the load balancer run as sibling containers, started
# through the host's Docker daemon.
options: --user root -v /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Setup environment
run: |
gpg --import /etc/pki/rpm-gpg/MICROSOFT-RPM-GPG-KEY
tdnf update -y
# Only the Docker client is needed, as the daemon is the host's one.
# docker/build.sh builds with BuildKit, which requires the buildx CLI
# plugin. The application itself is built into the image, so none of
# the CCF build dependencies are required here.
tdnf install -y --disablerepo azurelinux-official-ms-non-oss \
ca-certificates docker-buildx git hostname jq moby-cli openssl \
python3-pip tar
- name: Checkout repository with tags
uses: actions/checkout@v7
with:
# docker/build.sh derives the image version with git describe.
fetch-depth: 0
# Work-around for https://github.com/actions/runner/issues/2033
- name: Work around git safe.directory in container
run: |
chown -R $(id -u):$(id -g) $PWD
git config --global --add safe.directory $PWD
- name: Build the image
run: ./docker/build.sh
- name: Run functional tests against a ${{ env.NODE_COUNT }} node cluster
run: ./run_functional_tests.sh
- name: "Upload logs"
uses: actions/upload-artifact@v7
if: success() || failure()
with:
name: logs-multi-node
path: |
/tmp/pytest-of-root/*current/*current/*.{out,err}
/tmp/pytest-of-root/*current/*current/config.json
if-no-files-found: warn