-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First commit (moving
upfadapter
from smf
repo to its own repo)
Signed-off-by: Arrobo, Gabriel <[email protected]>
- Loading branch information
0 parents
commit 24ad88b
Showing
30 changed files
with
2,474 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright 2022 Intel Corporation | ||
|
||
version: 2 | ||
updates: | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
day: "sunday" | ||
time: "21:00" | ||
timezone: "America/Los_Angeles" | ||
|
||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
day: "sunday" | ||
time: "21:00" | ||
timezone: "America/Los_Angeles" | ||
|
||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
day: "sunday" | ||
time: "21:00" | ||
timezone: "America/Los_Angeles" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright 2023 Canonical Ltd. | ||
# Copyright 2024 Intel Corporation | ||
|
||
name: Main workflow | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
|
||
- name: Build | ||
run: go build | ||
|
||
docker-build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build Docker image | ||
run: make docker-build | ||
|
||
staticcheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: WillAbides/[email protected] | ||
with: | ||
go-version-file: 'go.mod' | ||
|
||
- uses: dominikh/[email protected] | ||
with: | ||
version: latest | ||
install-go: false | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
|
||
- name: golangci-lint | ||
uses: golangci/[email protected] | ||
with: | ||
version: latest | ||
args: -v --config ./.golangci.yml | ||
|
||
hadolint: | ||
name: hadolint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Dockerfile linter | ||
uses: hadolint/[email protected] | ||
# For now, ignoring: | ||
# DL3008 warning: Pin versions in apt get install (e.g., apt-get install <package>=<version>); and | ||
# DL3018 warning: Pin versions in apk add (e.g., apk add <package>=<version>) | ||
with: | ||
dockerfile: Dockerfile | ||
ignore: DL3008,DL3018 | ||
|
||
license-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: reuse lint | ||
uses: fsfe/reuse-action@v4 | ||
|
||
fossa-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: FOSSA scan | ||
uses: fossa-contrib/fossa-action@v3 | ||
with: | ||
fossa-api-key: 0c3bbcdf20e157bbd487dae173751b28 | ||
|
||
unit-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
|
||
- name: Unit tests | ||
run: go test ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright 2024 Intel Corporation | ||
name: GitHub release and Docker images | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
push-images: | ||
runs-on: ubuntu-latest | ||
if: github.repository_owner == 'omec-project' | ||
env: | ||
REGISTRY: registry.aetherproject.org | ||
DOCKER_REGISTRY: registry.aetherproject.org/ | ||
DOCKER_REPOSITORY: sdcore/ | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
|
||
- run: echo GIT_SHA_SHORT=$(git rev-parse --short HEAD) >> $GITHUB_ENV | ||
|
||
- uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ secrets.AETHER_REGISTRY_USERNAME }} | ||
password: ${{ secrets.AETHER_REGISTRY_PASSWORD }} | ||
|
||
- name: Build and push "main-latest" Docker image | ||
env: | ||
DOCKER_TAG: main-latest | ||
run: | | ||
make docker-build | ||
make docker-push | ||
- name: Build and push "main-GIT_SHA" Docker image | ||
env: | ||
DOCKER_TAG: main-${{ env.GIT_SHA_SHORT }} | ||
run: | | ||
make docker-build | ||
make docker-push | ||
# CAUTION: Other actions depend on this name "tag-github" | ||
tag-github: | ||
runs-on: ubuntu-latest | ||
if: github.repository_owner == 'omec-project' | ||
outputs: | ||
changed: ${{ steps.version-change.outputs.changed }} | ||
version: ${{ steps.version-change.outputs.version }} | ||
release_branch: ${{ steps.version-change.outputs.release_branch }} | ||
version_branch: ${{ steps.version-change.outputs.version_branch }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get changes | ||
id: version-file | ||
run: | | ||
if git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep VERSION; then | ||
echo "changed=true" >> $GITHUB_OUTPUT | ||
version_before=$(git show ${{ github.event.before }}:VERSION) | ||
echo "version_before=$version_before" >> $GITHUB_OUTPUT | ||
else | ||
echo "VERSION file was not changed" | ||
fi | ||
- name: Validate change in version file | ||
id: version-change | ||
if: steps.version-file.outputs.changed == 'true' | ||
run: | | ||
version=$(cat VERSION) | ||
version_before_full=${{ steps.version-file.outputs.version_before }} | ||
version_before=${version_before_full::-4} | ||
echo "version=$version" | ||
echo "version_before=$version_before" | ||
validate="^[0-9]+\.[0-9]+\.[0-9]+$" | ||
if [[ $version =~ $validate ]]; then | ||
echo "changed=true" >> $GITHUB_OUTPUT | ||
echo "version=$version" >> $GITHUB_OUTPUT | ||
else | ||
echo "Version change not for release" | ||
fi | ||
if [[ $version_before =~ $validate ]]; then | ||
IFS='.' read -r major minor patch <<< "$version" | ||
IFS='.' read -r major_b minor_b patch_b <<< "$version_before" | ||
if [[ "$major" -ne "$major_b" ]] || [[ "$minor" -ne "$minor_b" ]]; then | ||
version_branch="$major_b.$minor_b" | ||
echo "release_branch=true" >> $GITHUB_OUTPUT | ||
echo "version_branch=$version_branch" >> $GITHUB_OUTPUT | ||
fi | ||
else | ||
echo "Version change not for branch release" | ||
fi | ||
- name: Create release using REST API | ||
if: steps.version-change.outputs.changed == 'true' | ||
run: | | ||
curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.GH_OMEC_PAT }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/${{ github.repository }}/releases \ | ||
-d '{ | ||
"tag_name": "v${{ steps.version-change.outputs.version }}", | ||
"target_commitish": "${{ github.event.repository.default_branch }}", | ||
"name": "v${{ steps.version-change.outputs.version }}", | ||
"draft": false, | ||
"prerelease": false, | ||
"generate_release_notes": true | ||
}' | ||
release-image: | ||
runs-on: ubuntu-latest | ||
needs: tag-github | ||
if: needs.tag-github.outputs.changed == 'true' | ||
env: | ||
REGISTRY: docker.io | ||
DOCKER_REGISTRY: docker.io/ | ||
DOCKER_REPOSITORY: omecproject/ | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
|
||
- uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Build and push release Docker image | ||
env: | ||
DOCKER_TAG: rel-${{ needs.tag-github.outputs.version }} | ||
run: | | ||
make docker-build | ||
make docker-push | ||
update-version: | ||
runs-on: ubuntu-latest | ||
needs: tag-github | ||
if: needs.tag-github.outputs.changed == 'true' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Increment version | ||
run: | | ||
version=${{ needs.tag-github.outputs.version }} | ||
IFS='.' read -r major minor patch <<< "$version" | ||
patch_update=$((patch+1)) | ||
NEW_VERSION="$major.$minor.$patch_update-dev" | ||
echo $NEW_VERSION > VERSION | ||
echo "Updated version: $NEW_VERSION" | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
token: ${{ secrets.GH_OMEC_PAT }} | ||
commit-message: Update version | ||
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | ||
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> | ||
signoff: true | ||
branch: version-update | ||
delete-branch: true | ||
title: Update version | ||
body: | | ||
Update VERSION file | ||
add-paths: | | ||
VERSION | ||
branch-release: | ||
runs-on: ubuntu-latest | ||
needs: tag-github | ||
if: (needs.tag-github.outputs.changed == 'true') && (needs.tag-github.outputs.release_branch == 'true') | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_OMEC_PAT }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: peterjgrainger/[email protected] | ||
with: | ||
branch: "rel-${{ needs.tag-github.outputs.version_branch }}" | ||
sha: '${{ github.event.pull_request.head.sha }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright 2024 Intel Corporation | ||
name: Stale issue/pr | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
env: | ||
DAYS_BEFORE_STALE: 120 | ||
DAYS_BEFORE_CLOSE: 15 | ||
|
||
jobs: | ||
stale: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/stale@v9 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
stale-issue-message: 'This issue has been stale for ${{ env.DAYS_BEFORE_STALE }} days and will be closed in ${{ env.DAYS_BEFORE_CLOSE }} days. Comment to keep it open.' | ||
stale-pr-message: 'This pull request has been stale for ${{ env.DAYS_BEFORE_STALE }} days and will be closed in ${{ env.DAYS_BEFORE_CLOSE }} days. Comment to keep it open.' | ||
stale-issue-label: 'stale/issue' | ||
stale-pr-label: 'stale/pr' | ||
days-before-stale: ${{ env.DAYS_BEFORE_STALE }} | ||
days-before-close: ${{ env.DAYS_BEFORE_CLOSE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# SPDX-FileCopyrightText: 2021 Open Networking Foundation <[email protected]> | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
||
# Toolchain | ||
.idea/ | ||
.vscode/ | ||
GPATH | ||
GRTAGS | ||
GTAGS | ||
TAGS | ||
tags | ||
cscope.* | ||
.DS_Store | ||
|
||
# debug | ||
*.log | ||
*.pcap | ||
vendor* | ||
*.patch | ||
|
||
# coverage | ||
./.coverage |
Oops, something went wrong.