Skip to content

Commit

Permalink
create environment to build new branch and keep in sync, point to for…
Browse files Browse the repository at this point in the history
…k of sonic-swss
  • Loading branch information
bradh352 committed Nov 21, 2024
1 parent 5c7dcb0 commit 4ee890a
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 2 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/buildsonic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
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 PLATFORM=broadcom
- name: Make target/sonic-broadcom.bin
run: |
make SONIC_BUILD_JOBS=4 target/sonic-broadcom.bin
- name: Upload 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 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
fail_on_unmatched_files: true
43 changes: 43 additions & 0 deletions .github/workflows/sync_upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'Sync With Upstream'

on:
schedule:
- cron: '30 0 * * *'
tags-ignore:
- '**'
workflow_dispatch:

jobs:
sync_latest_from_upstream:
runs-on: ubuntu-latest
name: Sync latest commits from upstream repo
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Checkout sonic-build
uses: actions/checkout@v4
with:
submodules: "recursive"
fetch-depth: 0
- name: Update
run: |
git config --global user.name '[github actions]'
git config --global user.email 'bradh352@users.noreply.github.com'
git pull
git remote add upstream https://github.com/sonic-net/sonic-buildimage.git
git fetch upstream
if ! git rebase upstream/202311 ; then
while ! git rebase --skip ; do
echo "Skipped Commit"
done
fi
cd src/sonic-swss
git checkout 202311-broadcom
git pull
cd ../..
git add .
if git status | grep "nothing to commit" > /dev/null ; then
echo "nothing to commit"
else
git commit -am "update sonic-swss and sonic-sairedis branches"
fi
git push --force
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
branch = 202311
[submodule "sonic-swss"]
path = src/sonic-swss
url = https://github.com/sonic-net/sonic-swss
branch = 202311
url = https://github.com/bradh352/sonic-swss
branch = 202311-broadcom
[submodule "src/p4c-bm/p4c-bm"]
path = platform/p4/p4c-bm/p4c-bm
url = https://github.com/krambn/p4c-bm
Expand Down

0 comments on commit 4ee890a

Please sign in to comment.