Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2025 Canonical Ltd.
name: Docker Build

on:
workflow_call:
inputs:
branch_name:
description: "Name of the branch to checkout"
required: false
type: string
default: ${{ github.ref }}
build_directory:
description: "Directory where to run the build command from"
required: false
type: string
default: '.'
make_target:
description: "Makefile target to build"
required: false
type: string
default: "docker-build"

jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch_name }}

- name: Build Docker image
run: |
cd ${{ inputs.build_directory }}
make ${{ inputs.make_target }}
49 changes: 49 additions & 0 deletions .github/workflows/docs-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2025 The Linux Foundation
# SPDX-FileCopyrightText: 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: Publish Documents
# Calling workflow should include "secrets: inherit"

on:
workflow_call:
inputs:
remote_host:
description: "Address for host to sync charts to"
required: true
type: string
remote_path:
description: "Path on remote_host where charts should be stored"
required: true
type: string

jobs:
publish:
runs-on: ubuntu-latest
env:
BUILD_OUTPUT_PATH: _build/multiversion/
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Build docs
run: make multiversion

- name: List built files
run: ls $BUILD_OUTPUT_PATH*

- name: rsync deployments
uses: burnett01/rsync-deployments@7.0.1
with:
switches: -rvzh --delete-after --exclude=.git
path: ${{ env.BUILD_OUTPUT_PATH }}
remote_path: ${{ inputs.remote_path }}
remote_host: ${{ inputs.remote_host }}
remote_user: ${{ secrets.JENKINS_USERNAME }}
remote_key: ${{ secrets.JENKINS_SSHKEY }}
remote_key_pass: ${{ secrets.JENKINS_PASSPHRASE }}
33 changes: 33 additions & 0 deletions .github/workflows/go-build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2025 The Linux Foundation
# SPDX-FileCopyrightText: 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: Build and Test Go

on:
workflow_call:
inputs:
go-mod-path:
required: false
type: string
default: "go.mod"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ${{ inputs.go-mod-path }}
- name: build
run: make build

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Unit tests
run: make unit-test || make test
28 changes: 28 additions & 0 deletions .github/workflows/go-get-modules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2025 The Linux Foundation
# SPDX-FileCopyrightText: 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: Get All Go Modules

on:
workflow_call:
inputs:
go-dir:
description: "Location of Go modules to enumerate"
required: false
default: "."
outputs:
modules:
description: "Go modules in the current repo"
value: $ {{ jobs.get-modules.outputs.modules }}

jobs:
get-modules:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: create release using REST API
run: |
echo "modules=$(find ${{ inputs.go-dir }} -name go.mod | jq -R | jq -sc)" >> $GITHUB_OUTPUT
30 changes: 30 additions & 0 deletions .github/workflows/go-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2025 Canonical Ltd.
name: Lint Go Code

on:
workflow_call:
inputs:
build_directory:
description: "Directory where to run the lint command from"
required: false
type: string
default: '.'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v7.0.0
with:
version: latest
args: -v --config ./.golangci.yml
working-directory: ${{ inputs.build_directory }}
50 changes: 50 additions & 0 deletions .github/workflows/go-version-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# SPDX-FileCopyrightText: 2025 The Linux Foundation
# SPDX-License-Identifier: Apache-2.0
name: Golang Version Check
# Calling workflow should include "secrets: inherit"

on:
workflow_call:
outputs:
dev_version:
description: "The version for the release"
value: ${{ jobs.version-check.outputs.dev_version }}
target_version:
description: "The version for the release"
value: ${{ jobs.version-check.outputs.target_version }}

jobs:
version-check:
if: (github.repository_owner == 'onosproject')
runs-on: ubuntu-latest
outputs:
dev_version: ${{ steps.dev-version-check-step.outputs.dev_version }}
target_version: ${{ steps.get-target-version-step.outputs.target_version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: check dev version
id: dev-version-check-step
run: |
if [[ $(cat VERSION | tr -d '\n' | tail -c 4) =~ "-dev" ]]; then
echo "dev_version=true" >> $GITHUB_OUTPUT
else
echo "dev_version=false" >> $GITHUB_OUTPUT
fi

- name: get target version
id: get-target-version-step
run: |
echo "target_version=$(cat VERSION)" >> $GITHUB_OUTPUT

- name: check version
id: version-check-step
run: |
# check if version format is matched to SemVer
VER_REGEX='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$'
if [[ ! $(cat VERSION | tr -d '\n' | sed s/-dev//) =~ $VER_REGEX ]]; then
exit 1
fi
exit 0
44 changes: 15 additions & 29 deletions .github/workflows/release-helm-charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,24 @@
# Copyright 2025 The Linux Foundation

name: Publish image and tag/release code
# Calling workflow should include "secrets: inherit"

# yamllint disable-line rule:truthy
on:
workflow_call:
inputs:
CHARTS_REPO_URL:
description: "Repo URL to push charts to"
charts_repo_url:
description: "URL for the helm repository to push to"
required: false
type: string
UMBRELLA_CHART:
description: "The repository's umbrella chart, if applicable"
required: false
type: string
RSYNC_REMOTE_HOST:
description: "The remote host to sync charts to"
required: false
default: https://charts.aetherproject.org
remote_host:
description: "Address for host to sync charts to"
required: true
type: string
RSYNC_REMOTE_PATH:
description: "The path on the remote host to sync charts to"
required: false
remote_path:
description: "Path on remote_host where charts should be stored"
required: true
type: string

jobs:
Expand Down Expand Up @@ -81,18 +79,7 @@ jobs:
version: ${{ steps.version-change.outputs.version }}

version-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup yq
uses: vegardit/gha-setup-yq@v1
- name: Check all changed charts have unique versions
id: version-change
run: |
export COMPARISON_BRANCH=${{ github.event.before }}
${{ github.action_path }}/version_check.sh check_unique
uses: onosproject/.github/.github/workflows/version-check.yml@main

tag-versions:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -138,7 +125,6 @@ jobs:
- name: Publish all changed charts
# yamllint disable rule:line-length
run: |
export COMPARISON_BRANCH=${{ github.event.before }}
target_charts=${{ steps.get-charts.outputs.charts }}
rm -rf staging && mkdir -p staging/${{ github.repository }}
while IFS= read -r tc
Expand All @@ -148,8 +134,8 @@ jobs:
helm package $tc --destination staging/${{ github.repository }}/$tc
done <<< $target_charts
cd staging
curl -o current-index.yaml ${{ inputs.CHARTS_REPO_URL }}/index.yaml
helm repo index ${{ github.repository }} --url ${{ inputs.CHARTS_REPO_URL }}/${{ github.repository }} --merge current-index.yaml
curl -o current-index.yaml ${{ inputs.charts_repo_url }}/index.yaml
helm repo index ${{ github.repository }} --url ${{ inputs.charts_repo_url }}/${{ github.repository }} --merge current-index.yaml
rm -rf current-index.yaml
mv ${{ github.repository }}/index.yaml .
cd ..
Expand All @@ -160,8 +146,8 @@ jobs:
with:
switches: -rvzh
path: staging/
remote_path: ${{ inputs.RSYNC_REMOTE_PATH }}
remote_host: ${{ inputs.RSYNC_REMOTE_HOST }}
remote_path: ${{ inputs.remote_path }}
remote_host: ${{ inputs.remote_host }}
remote_user: ${{ secrets.JENKINS_USERNAME }}
remote_key: ${{ secrets.JENKINS_SSHKEY }}
remote_key_pass: ${{ secrets.JENKINS_PASSPHRASE }}
49 changes: 49 additions & 0 deletions .github/workflows/release-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2025 Canonical Ltd.
# SPDX-FileCopyrightText: 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: Release Image

on:
workflow_call:
inputs:
docker_tag:
required: false
type: string
default: "latest"
type: string
docker_registry:
description: "Docker Registry URL"
default: "docker.io"
type: string
docker_repository:
description: "Docker Repository"
default: "onosproject/"
type: string

jobs:
release-image:
runs-on: ubuntu-latest
env:
DOCKER_TAG: ${{ inputs.docker_tag }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true

- name: Login to Docker Registry
uses: docker/login-action@v3.4.0
with:
registry: ${{ inputs.docker_registry }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and Push to Docker Registry
env:
DOCKER_REGISTRY: ${{ inputs.docker_registry }}/
DOCKER_REPOSITORY: ${{ inputs.docker_repository }}
run: |
make docker-build
make docker-push
3 changes: 2 additions & 1 deletion .github/workflows/tag-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:

jobs:
tag-github:
if: github.repository_owner == 'onosproject'
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.version-change.outputs.changed }}
Expand Down Expand Up @@ -50,7 +51,7 @@ jobs:

- name: Create Github release
if: steps.version-change.outputs.changed == 'true'
uses: onos-project/.github/.github/actions/create-github-release-action@main
uses: onosproject/.github/.github/actions/create-github-release-action@main
with:
version: ${{ steps.version-change.outputs.version }}
env:
Expand Down
Loading