forked from omec-project/nrf
-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (97 loc) · 2.87 KB
/
cdac-master.yml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# SPDX-License-Identifier: Apache-2.0
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Intel Corporation
name: CDAC Master workflow
on:
pull_request:
branches:
- cdacmaster
push:
branches:
- cdacmaster
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
if: github.repository_owner == '5GC-DEV'
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 --timeout=10m
hadolint:
name: hadolint
runs-on: ubuntu-latest
if: github.repository_owner == '5GC-DEV'
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
if: github.repository_owner == '5GC-DEV'
steps:
- uses: actions/checkout@v4
- name: reuse lint
uses: fsfe/reuse-action@v4
fossa-check:
runs-on: ubuntu-latest
if: github.repository_owner == '5GC-DEV'
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
if: github.repository_owner == '5GC-DEV'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Unit tests
run: go test ./...
docker-build-push-images:
runs-on: ubuntu-latest
if: github.repository_owner == '5GC-DEV'
needs: unit-tests
env:
REGISTRY: docker.io
DOCKER_REGISTRY: docker.io/
DOCKER_REPOSITORY: cdac5gc/
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.DCKRUSER }}
password: ${{ secrets.DCKRPASS }}
- name: Build and push "master-latest" Docker image
env:
DOCKER_TAG: master-latest
run: |
make docker-build
make docker-push
- name: Build and push "master-GIT_SHA" Docker image
env:
DOCKER_TAG: master-${{ env.GIT_SHA_SHORT }}
run: |
make docker-build
make docker-push