2020-11-24 16:12:39 +08:00
|
|
|
name: Code Checker
|
|
|
|
# TODO: do not trigger action for some document file update
|
|
|
|
|
|
|
|
# This workflow is triggered on pushes or pull request to the repository.
|
|
|
|
on:
|
2022-02-21 20:11:51 +08:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-11-24 16:12:39 +08:00
|
|
|
pull_request:
|
|
|
|
# file paths to consider in the event. Optional; defaults to all.
|
|
|
|
paths:
|
|
|
|
- 'scripts/**'
|
|
|
|
- 'internal/**'
|
|
|
|
- 'cmd/**'
|
|
|
|
- 'build/**'
|
|
|
|
- '.github/workflows/code-checker.yaml'
|
|
|
|
- '.env'
|
|
|
|
- docker-compose.yml
|
|
|
|
- Makefile
|
|
|
|
- '!**.md'
|
2021-05-14 18:23:30 +08:00
|
|
|
- '!build/ci/jenkins/**'
|
2021-09-29 23:28:55 +08:00
|
|
|
# FIXME(wxyu): not need to run code check, update the ci-passed rules and remove these two lines
|
|
|
|
- go.mod
|
|
|
|
- go.sum
|
2023-03-10 13:35:52 +08:00
|
|
|
- .golangci.yml
|
|
|
|
- rules.go
|
2020-11-24 16:12:39 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
ubuntu:
|
2022-02-09 14:27:46 +08:00
|
|
|
name: ${{ matrix.name }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
2023-02-16 17:26:35 +08:00
|
|
|
timeout-minutes: 120
|
2020-11-24 16:12:39 +08:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-02-09 14:27:46 +08:00
|
|
|
include:
|
2022-11-23 10:39:11 +08:00
|
|
|
- name: Code Checker AMD64 Ubuntu 20.04
|
|
|
|
os: ubuntu-20.04
|
2020-11-24 16:12:39 +08:00
|
|
|
env:
|
2022-08-26 10:06:54 +08:00
|
|
|
UBUNTU: 20.04
|
2020-11-24 16:12:39 +08:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
2022-11-23 10:39:11 +08:00
|
|
|
- name: 'Generate CCache Hash'
|
2022-10-23 08:41:33 +08:00
|
|
|
env:
|
|
|
|
CORE_HASH: ${{ hashFiles( 'internal/core/**/*.cpp', 'internal/core/**/*.cc', 'internal/core/**/*.c', 'internal/core/**/*.h', 'internal/core/**/*.hpp', 'internal/core/**/CMakeLists.txt') }}
|
|
|
|
run: |
|
|
|
|
echo "corehash=${CORE_HASH}" >> $GITHUB_ENV
|
|
|
|
echo "Set CCache hash to ${CORE_HASH}"
|
2020-12-09 20:07:27 +08:00
|
|
|
- name: Cache CCache Volumes
|
2023-02-16 17:26:35 +08:00
|
|
|
# uses: actions/cache@v3
|
|
|
|
uses: pat-s/always-upload-cache@v3
|
2020-11-24 17:04:48 +08:00
|
|
|
with:
|
2022-08-26 10:06:54 +08:00
|
|
|
path: .docker/amd64-ubuntu20.04-ccache
|
2022-10-23 08:41:33 +08:00
|
|
|
key: ubuntu20.04-ccache-${{ env.corehash }}
|
2022-08-26 10:06:54 +08:00
|
|
|
restore-keys: ubuntu20.04-ccache-
|
2020-12-09 20:07:27 +08:00
|
|
|
- name: Cache Go Mod Volumes
|
2022-05-30 14:54:02 +08:00
|
|
|
uses: actions/cache@v3
|
2020-12-09 20:07:27 +08:00
|
|
|
with:
|
2022-08-26 10:06:54 +08:00
|
|
|
path: .docker/amd64-ubuntu20.04-go-mod
|
|
|
|
key: ubuntu20.04-go-mod-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: ubuntu20.04-go-mod-
|
2022-11-23 10:39:11 +08:00
|
|
|
- name: Cache Conan Packages
|
2023-02-16 17:26:35 +08:00
|
|
|
# uses: actions/cache@v3
|
|
|
|
uses: pat-s/always-upload-cache@v3
|
2022-11-23 10:39:11 +08:00
|
|
|
with:
|
|
|
|
path: .docker/amd64-ubuntu20.04-conan
|
2022-12-13 11:27:21 +08:00
|
|
|
key: ubuntu20.04-conan-${{ hashFiles('internal/core/conanfile.*') }}
|
2022-11-23 10:39:11 +08:00
|
|
|
restore-keys: ubuntu20.04-conan-
|
2020-11-24 16:12:39 +08:00
|
|
|
- name: Code Check
|
2020-12-09 20:07:27 +08:00
|
|
|
env:
|
2022-11-23 10:39:11 +08:00
|
|
|
OS_NAME: 'ubuntu20.04'
|
2020-11-24 16:12:39 +08:00
|
|
|
run: |
|
2022-11-23 10:39:11 +08:00
|
|
|
./build/builder.sh /bin/bash -c "make check-proto-product && make verifiers"
|
2022-03-31 14:49:28 +08:00
|
|
|
centos:
|
|
|
|
name: Code Checker CentOS 7
|
2022-11-23 10:39:11 +08:00
|
|
|
# Run in centos docker
|
2022-08-26 10:06:54 +08:00
|
|
|
runs-on: ubuntu-20.04
|
2023-02-16 17:26:35 +08:00
|
|
|
timeout-minutes: 120
|
2022-03-31 14:49:28 +08:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
2022-11-23 10:39:11 +08:00
|
|
|
- name: 'Generate CCache Hash'
|
2022-10-23 08:41:33 +08:00
|
|
|
env:
|
|
|
|
CORE_HASH: ${{ hashFiles( 'internal/core/**/*.cpp', 'internal/core/**/*.cc', 'internal/core/**/*.c', 'internal/core/**/*.h', 'internal/core/**/*.hpp', 'internal/core/**/CMakeLists.txt') }}
|
|
|
|
run: |
|
|
|
|
echo "corehash=${CORE_HASH}" >> $GITHUB_ENV
|
|
|
|
echo "Set CCache hash to ${CORE_HASH}"
|
2022-03-31 14:49:28 +08:00
|
|
|
- name: Cache CCache Volumes
|
2023-02-16 17:26:35 +08:00
|
|
|
# uses: actions/cache@v3
|
|
|
|
uses: pat-s/always-upload-cache@v3
|
2022-03-31 14:49:28 +08:00
|
|
|
with:
|
|
|
|
path: .docker/amd64-centos7-ccache
|
2022-10-23 08:41:33 +08:00
|
|
|
key: centos7-ccache-${{ env.corehash }}
|
2022-03-31 14:49:28 +08:00
|
|
|
restore-keys: centos7-ccache-
|
|
|
|
- name: Cache Third Party
|
2022-05-30 14:54:02 +08:00
|
|
|
uses: actions/cache@v3
|
2022-03-31 14:49:28 +08:00
|
|
|
with:
|
|
|
|
path: .docker/thirdparty
|
2022-05-30 14:54:02 +08:00
|
|
|
key: centos7-thirdparty-${{ hashFiles('internal/core/thirdparty/**') }}
|
2022-03-31 14:49:28 +08:00
|
|
|
restore-keys: centos7-thirdparty-
|
|
|
|
- name: Cache Go Mod Volumes
|
2022-05-30 14:54:02 +08:00
|
|
|
uses: actions/cache@v3
|
2022-03-31 14:49:28 +08:00
|
|
|
with:
|
|
|
|
path: .docker/amd64-centos7-go-mod
|
|
|
|
key: centos7-go-mod-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: centos7-go-mod-
|
2022-11-23 10:39:11 +08:00
|
|
|
- name: Cache Conan Packages
|
2023-02-16 17:26:35 +08:00
|
|
|
# uses: actions/cache@v3
|
|
|
|
uses: pat-s/always-upload-cache@v3
|
2022-11-23 10:39:11 +08:00
|
|
|
with:
|
|
|
|
path: .docker/amd64-centos7-conan
|
2023-02-16 17:26:35 +08:00
|
|
|
key: centos7-conan-${{ hashFiles('internal/core/conanfile.*') }}
|
|
|
|
# restore-keys: centos7-conan-
|
2022-03-31 14:49:28 +08:00
|
|
|
- name: Code Check
|
|
|
|
env:
|
2022-11-23 10:39:11 +08:00
|
|
|
OS_NAME: 'centos7'
|
2022-03-31 14:49:28 +08:00
|
|
|
run: |
|
2022-11-23 10:39:11 +08:00
|
|
|
./build/builder.sh /bin/bash -c "make install"
|