From 0ff8815e488c503370d3c1843533ddde92b41bc7 Mon Sep 17 00:00:00 2001 From: Ghislain Bourgeois Date: Wed, 10 Jan 2024 11:14:41 -0500 Subject: [PATCH] chore: Add FOSSA check to GH actions --- .github/workflows/go.yml | 29 ------------ .github/workflows/golangci-lint.yml | 38 --------------- .github/workflows/main.yml | 71 +++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 67 deletions(-) delete mode 100644 .github/workflows/go.yml delete mode 100644 .github/workflows/golangci-lint.yml create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index 827472a..0000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2019 Communication Service/Software Laboratory, National Chiao Tung University (free5gc.org) -# -# SPDX-License-Identifier: Apache-2.0 - -name: Go - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: '1.14.4' - - - name: Build - run: go build -v ./... - - - name: Test - run: go test -v ./... diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml deleted file mode 100644 index 4e754bd..0000000 --- a/.github/workflows/golangci-lint.yml +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2019 Communication Service/Software Laboratory, National Chiao Tung University (free5gc.org) -# -# SPDX-License-Identifier: Apache-2.0 - -name: golangci-lint - -on: - push: - tags: - - v* - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - - golangci: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Run golangci-lint - uses: golangci/golangci-lint-action@v2 - with: - # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.35.0 - - # Optional: working directory, useful for monorepos - # working-directory: somedir - - # Optional: golangci-lint command line arguments. - # args: --issues-exit-code=0 - - # Optional: show only new issues if it's a pull request. The default value is `false`. - # only-new-issues: true - - # Optional: if set to true then the action will use pre-installed Go - # skip-go-installation: true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..7b2415b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,71 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2024 Canonical Ltd. + +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 + + lint: + name: 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/golangci-lint-action@v3.7.0 + with: + version: latest + args: -v --config ./.golangci.yml + + license-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: reuse lint + uses: fsfe/reuse-action@v2 + + fossa-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: FOSSA scan + uses: fossa-contrib/fossa-action@v3 + with: + fossa-api-key: 9dc8fa92e3dd565687317beb87b56d89 + + 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 ./...