Skip to content

Commit

Permalink
Refactor GitHub Actions (#767)
Browse files Browse the repository at this point in the history
  • Loading branch information
gab-arrobo authored Feb 22, 2024
1 parent f01eb9b commit c07114b
Show file tree
Hide file tree
Showing 12 changed files with 152 additions and 257 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/delete-untagged.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2021 Intel Corporation
name: Delete untagged images
name: Untagged images

on:
schedule:
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/fossa-scanning.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/golangci-lint.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/manual.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/markdown.yml

This file was deleted.

123 changes: 123 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Intel Corporation

name: Master workflow

on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
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/[email protected]
with:
version: latest
args: -v --config ./.golangci.yml

check-spelling:
name: Markdown spellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Check Spelling
uses: rojopolis/[email protected]
with:
config_path: .spellcheck.yml
task_name: Markdown

route-control-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- name: Create virtual environment
run: python -m venv venv

- name: Install dependencies
run: |
source ./venv/bin/activate
pip install -r requirements.txt
- name: Run tests
run: |
source ./venv/bin/activate
python -m unittest ./conf/test_route_control.py
- name: Clean up virtual environment
run: rm -rf venv

unit-tests-pfcp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Run unit tests for PFCP Agent
run: make test

integration-tests-up4:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Run integration tests for PFCP Agent & UP4
run: make test-up4-integration-docker || (docker logs pfcpiface; exit 1)

integration-tests-bess:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Run integration tests for PFCP Agent & UP4
run: make test-bess-integration-native

license-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: reuse lint
uses: fsfe/reuse-action@v1

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
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,30 @@ jobs:
VERSION: "PR-${{ github.event.pull_request.number }}"
runs-on: ubuntu-latest
steps:
# Checkout and build
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Generate protobuf
run: |
make pb
run: make pb

- name: Build the BESS-UPF Docker image
run: |
DOCKER_TARGETS=bess make docker-build
run: DOCKER_TARGETS=bess make docker-build

- name: Build the PFCP Agent Docker image
run: |
DOCKER_TARGETS=pfcpiface make docker-build
run: DOCKER_TARGETS=pfcpiface make docker-build

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

# Format the code
- name: Shell Format
# https://github.com/mvdan/sh/issues/288
run: |
wget -qO shfmt https://github.com/mvdan/sh/releases/download/v3.1.1/shfmt_v3.1.1_linux_amd64
chmod +x shfmt && sudo mv shfmt /bin
# https://github.com/mvdan/sh/issues/288
shfmt -l -w $(shfmt -f . | grep -v vendor/)
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Go Format
run: |
make fmt
run: make fmt

- name: Python format
run: |
Expand All @@ -58,8 +50,7 @@ jobs:
isort .
- name: Show all CI changes
run: |
git --no-pager diff
run: git --no-pager diff

# Verify P4 constants
- name: Build P4 constants
Expand All @@ -72,25 +63,21 @@ jobs:
if: ${{ steps.check.outputs.PORCELAIN != '' }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('Please run make p4-constants and commit changes')
script: core.setFailed('Please run make p4-constants and commit changes')

# Build again and commit
- name: Build the BESS-UPF Docker image (after format)
run: |
DOCKER_TARGETS=bess make docker-build
run: DOCKER_TARGETS=bess make docker-build

- name: Build the PFCP Agent Docker image (after format)
run: |
DOCKER_TARGETS=pfcpiface make docker-build
run: DOCKER_TARGETS=pfcpiface make docker-build

# - name: Update PR with changes
# uses: gr2m/[email protected]
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# body: |
# Updated with changes from CI
# body: Updated with changes from CI
# branch: ${{ github.event.pull_request.head.ref }}
# author: "Github Actions <actions@github>"
# commit-message: "Actions: Updated with changes from CI"
Expand All @@ -106,5 +93,4 @@ jobs:

- name: Push Docker image
if: steps.docker-login.conclusion == 'success'
run: |
make docker-push
run: make docker-push
38 changes: 0 additions & 38 deletions .github/workflows/py-workflow.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/reuse.yml

This file was deleted.

Loading

0 comments on commit c07114b

Please sign in to comment.