forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (83 loc) · 2.85 KB
/
buildsonic.yaml
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
name: Build Sonic
on:
push:
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: self-hosted
name: "Build Sonic"
steps:
- name: Install needed packages
run: |
sudo apt-get update
sudo apt-get install -y sudo curl wget ca-certificates cmake ninja-build autoconf automake libtool g++ pkg-config python3-pip git
sudo apt-get dist-upgrade -y --assume-yes
- name: Install j2cli
run: |
pip3 install --user j2cli
- name: Clean up from prior runs
run: |
docker image prune --all --force
docker builder prune --all --force
mydir=`pwd`
sudo rm -rf *
sudo rm -rf .git
cd ..
sudo rm -rf ${mydir}
mkdir -p ${mydir}
cd ${mydir}
sudo rm -rf /var/cache/sonic
- name: Checkout sonic-build
uses: actions/checkout@v4
with:
submodules: "recursive"
fetch-depth: 0
- name: "Make Init"
run: |
sudo mkdir -p /var/cache/sonic/artifacts
sudo chown $USER: /var/cache/sonic/artifacts
sudo chmod 777 /var/cache/sonic/artifacts
make init
- name: Configure Broadcom
run: |
make configure SONIC_CONFIG_BUILD_JOBS=2 PLATFORM=broadcom SONIC_VERSION_CONTROL_COMPONENTS=none MIRROR_SNAPSHOT=n SONIC_DPKG_CACHE_METHOD=cache
- name: Make target/sonic-broadcom.bin
run: |
make target/sonic-broadcom.bin SONIC_VERSION_CONTROL_COMPONENTS=none MIRROR_SNAPSHOT=n SONIC_DPKG_CACHE_METHOD=cache
- name: Configure Mellanox
run: |
make configure PLATFORM=mellanox SONIC_VERSION_CONTROL_COMPONENTS=none MIRROR_SNAPSHOT=n SONIC_DPKG_CACHE_METHOD=cache
- name: Make target/sonic-mellanox.bin
run: |
make target/sonic-mellanox.bin SONIC_VERSION_CONTROL_COMPONENTS=none MIRROR_SNAPSHOT=n SONIC_DPKG_CACHE_METHOD=cache
- name: Upload Broadcom artifact
uses: actions/upload-artifact@v4
with:
name: "sonic-broadcom.bin"
path: 'target/sonic-broadcom.bin'
if-no-files-found: error
overwrite: true
retention-days: 30
- name: Upload Mellanox artifact
uses: actions/upload-artifact@v4
with:
name: "sonic-mellanox.bin"
path: 'target/sonic-mellanox.bin'
if-no-files-found: error
overwrite: true
retention-days: 30
- name: Upload Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: false
make_latest: true
generate_release_notes: true
files: |
target/sonic-broadcom.bin
target/sonic-mellanox.bin
fail_on_unmatched_files: true