Skip to content

Commit ae5da82

Browse files
authored
migrate CI to github action (#685)
Signed-off-by: Woojoong Kim <woojoong.kim@intel.com>
1 parent 4a5462c commit ae5da82

File tree

24 files changed

+455
-212
lines changed

24 files changed

+455
-212
lines changed

.github/dependabot.yml

-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ updates:
1414
schedule:
1515
interval: "weekly"
1616

17-
- package-ecosystem: "docker"
18-
directory: "build/onos-e2t-sim-app"
19-
schedule:
20-
interval: "weekly"
21-
2217
- package-ecosystem: "gomod"
2318
directory: "/"
2419
schedule:

.github/workflows/build-test.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright 2024 Intel Corporation
3+
4+
name: Build and test workflow
5+
on:
6+
pull_request:
7+
branches:
8+
- master
9+
push:
10+
branches:
11+
- master
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-go@v5
19+
with:
20+
go-version-file: 'go.mod'
21+
- name: build
22+
run: make build
23+
test:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: actions/setup-go@v5
28+
with:
29+
go-version-file: 'go.mod'
30+
- name: Unit tests
31+
run: make test

.github/workflows/code-scan.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright 2024 Intel Corporation
3+
4+
name: Code scan workflow
5+
6+
on:
7+
pull_request:
8+
branches:
9+
- master
10+
push:
11+
branches:
12+
- master
13+
14+
jobs:
15+
version-check:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: check version
20+
run: make check-version
21+
lint:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-go@v5
26+
with:
27+
go-version-file: 'go.mod'
28+
- name: golang-lint
29+
run: make lint
30+
license:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
- name: check license
35+
run: make license
36+
fossa-check:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
- name: FOSSA scan
41+
uses: fossa-contrib/fossa-action@v3
42+
with:
43+
fossa-api-key: 6d304c09a3ec097ba4517724e4a4d17d

.github/workflows/master.yml

-89
This file was deleted.

.github/workflows/release.yml

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright 2024 Intel Corporation
3+
# Copyright 2024 Kyunghee University
4+
name: Publish image and tag/release code
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
11+
jobs:
12+
version-check:
13+
if: (github.repository_owner == 'onosproject')
14+
runs-on: ubuntu-latest
15+
outputs:
16+
valid_version: ${{ steps.version-check-step.outputs.valid_version }}
17+
dev_version: ${{ steps.dev-version-check-step.outputs.dev_version }}
18+
target_version: ${{ steps.get-target-version-step.outputs.target_version }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: check version
25+
id: version-check-step
26+
run: |
27+
make check-version; if [[ $? == 0 ]]; then echo "valid_version=true" >> $GITHUB_OUTPUT; else echo "valid_version=false" >> $GITHUB_OUTPUT; fi
28+
cat $GITHUB_OUTPUT
29+
30+
- name: check dev version
31+
id: dev-version-check-step
32+
run: |
33+
f_dev=$(./build/bin/version_check.sh is_dev)
34+
if [[ $f_dev == "true" ]]; then echo "dev_version=true" >> $GITHUB_OUTPUT; else echo "dev_version=false" >> $GITHUB_OUTPUT; fi
35+
cat $GITHUB_OUTPUT
36+
37+
- name: get target version
38+
id: get-target-version-step
39+
run: |
40+
echo "target_version=$(cat VERSION)" >> $GITHUB_OUTPUT
41+
cat $GITHUB_OUTPUT
42+
43+
tag_versions:
44+
runs-on: ubuntu-latest
45+
needs: version-check
46+
if: (github.repository_owner == 'onosproject') && (needs.version-check.outputs.valid_version == 'true') && (needs.version-check.outputs.dev_version == 'false')
47+
steps:
48+
- uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 0
51+
- name: create release using REST API
52+
run: |
53+
curl -L \
54+
-X POST \
55+
-H "Accept: application/vnd.github+json" \
56+
-H "Authorization: Bearer ${{ secrets.GH_ONOS_PAT }}" \
57+
-H "X-GitHub-Api-Version: 2022-11-28" \
58+
https://api.github.com/repos/${{ github.repository }}/releases \
59+
-d '{
60+
"tag_name": "v${{ needs.version-check.outputs.target_version }}",
61+
"target_commitish": "${{ github.event.repository.default_branch }}",
62+
"name": "v${{ needs.version-check.outputs.target_version }}",
63+
"draft": false,
64+
"prerelease": false,
65+
"generate_release_notes": true
66+
}'
67+
68+
publish-images:
69+
runs-on: ubuntu-latest
70+
needs: version-check
71+
if: (github.repository_owner == 'onosproject') && (needs.version-check.outputs.valid_version == 'true')
72+
env:
73+
REGISTRY: docker.io
74+
DOCKER_REPOSITORY: onosproject/
75+
steps:
76+
- uses: actions/checkout@v4
77+
with:
78+
fetch-depth: 0
79+
- uses: actions/setup-go@v5
80+
with:
81+
go-version-file: 'go.mod'
82+
- uses: docker/login-action@v3.1.0
83+
with:
84+
registry: ${{ env.REGISTRY }}
85+
username: ${{ secrets.DOCKER_USERNAME }}
86+
password: ${{ secrets.DOCKER_PASSWORD }}
87+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
88+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
89+
- name: Build and push Docker image with tag latest
90+
env:
91+
DOCKER_TAG: latest
92+
run: |
93+
ONOS_E2T_VERSION=${{ env.DOCKER_TAG }} make docker-build
94+
ONOS_E2T_VERSION=${{ env.DOCKER_TAG }} make docker-push
95+
- name: Build and push Docker image with tag
96+
if: needs.version-check.outputs.dev_version == 'false'
97+
env:
98+
DOCKER_TAG: v${{ needs.version-check.outputs.target_version }}
99+
run: |
100+
ONOS_E2T_VERSION=${{ env.DOCKER_TAG }} make docker-build
101+
ONOS_E2T_VERSION=${{ env.DOCKER_TAG }} make docker-push
102+
103+
bump-up-version:
104+
runs-on: ubuntu-latest
105+
needs: version-check
106+
if: (github.repository_owner == 'onosproject') && (needs.version-check.outputs.valid_version == 'true') && (needs.version-check.outputs.dev_version == 'false')
107+
steps:
108+
- uses: actions/checkout@v4
109+
with:
110+
fetch-depth: 0
111+
- name: increment version
112+
run: |
113+
IFS='.' read -r major minor patch <<< ${{ needs.version-check.outputs.target_version }}
114+
patch_update=$((patch+1))
115+
NEW_VERSION="$major.$minor.$patch_update-dev"
116+
echo $NEW_VERSION > VERSION
117+
echo "Updated version: $NEW_VERSION"
118+
119+
- name: Create Pull Request
120+
uses: peter-evans/create-pull-request@v6
121+
with:
122+
token: ${{ secrets.GH_ONOS_PAT }}
123+
commit-message: Update version
124+
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
125+
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
126+
signoff: true
127+
branch: version-update
128+
delete-branch: true
129+
title: Update version
130+
body: |
131+
Update VERSION file
132+
add-paths: |
133+
VERSION

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ coverage.txt
2020
*-output.out
2121
build/build-tools
2222

23+
api/asn1/*
24+
build/_input
25+
venv

0 commit comments

Comments
 (0)