-
Notifications
You must be signed in to change notification settings - Fork 63
62 lines (54 loc) · 1.9 KB
/
mcad-CI.yml
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
# This workflow will build mcad and run unit test and E2E tests
name: MCAD-CI
on:
pull_request:
branches:
- 'main'
- 'release-*'
jobs:
MCAD-CI:
runs-on: ubuntu-latest
steps:
- name: run docker resource config
run: |
sudo touch /etc/systemd/system/slice.conf
cat <<EOF > /etc/systemd/system/slice.conf
[Unit]
Description=Slice that limits docker resources
Before=slices.target
[Slice]
CPUAccounting=true
CPUQuota=50%
EOF
new_content='{ "exec-opts": ["native.cgroupdriver=cgroupfs"], "cgroup-parent": "/slice.conf" }'
sudo sed -i 's|{ "exec-opts": \["native.cgroupdriver=cgroupfs"\], "cgroup-parent": "/actions_job" }|'"$new_content"'|' /etc/docker/daemon.json
sudo systemctl start slice.conf
cat /etc/docker/daemon.json
sudo systemctl restart docker
sleep 10
docker info | grep CPU
- name: checkout code
uses: actions/checkout@v3
with:
ref: "refs/pull/${{ github.event.number }}/merge"
fetch-depth: 0
- name: Set latest tag and Branch name
run: |
BRANCH=${{ github.event.pull_request.head.ref }}
echo "GIT_BRANCH=$(echo "$BRANCH" | sed 's/[^A-Za-z0-9._-]/-/g' )" >> $GITHUB_ENV
echo "TAG=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19.10
- name: Build
run:
make mcad-controller
- name: Run Unit tests
run: make run-test
- name: Build Image
run: |
make images -e GIT_BRANCH=${{ env.GIT_BRANCH }} TAG=${{ env.GIT_BRANCH }}-${{ env.TAG }}
- name: Run E2E tests
run: |
make run-e2e -e GIT_BRANCH=${{ env.GIT_BRANCH }} TAG=${{ env.GIT_BRANCH }}-${{ env.TAG }}