mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 08:15:19 +00:00
template and re-use ci workflows
This commit is contained in:
parent
1d95af8c9a
commit
644bd0acec
16
.github/workflows/ci-commit.yml
vendored
Normal file
16
.github/workflows/ci-commit.yml
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
name: Continuous Integration (Commit)
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
# run per commit ci checks against this commit
|
||||||
|
jobs:
|
||||||
|
proto-lint:
|
||||||
|
uses: ./.github/workflows/proto.yml
|
||||||
|
golangci-lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
- name: golangci-lint
|
||||||
|
uses: reviewdog/action-golangci-lint@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.github_token }}
|
||||||
|
reporter: github-pr-review
|
31
.github/workflows/ci-default.yml
vendored
Normal file
31
.github/workflows/ci-default.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
name: Continuous Integration (Default Checks)
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout repo from current commit
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: '1.18'
|
||||||
|
check-latest: true
|
||||||
|
cache: true
|
||||||
|
- name: build application
|
||||||
|
run: make build
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout repo from current commit
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: '1.18'
|
||||||
|
check-latest: true
|
||||||
|
cache: true
|
||||||
|
- name: run unit tests
|
||||||
|
run: make test
|
33
.github/workflows/ci-master.yml
vendored
Normal file
33
.github/workflows/ci-master.yml
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
name: Continuous Integration (Kava Master)
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
# run CI on any push to the master branch
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
jobs:
|
||||||
|
# run per commit ci checks against master branch
|
||||||
|
commit-checks:
|
||||||
|
uses: ./.github/workflows/ci-commit.yml
|
||||||
|
# run default ci checks against master branch
|
||||||
|
default-checks:
|
||||||
|
uses: ./.github/workflows/ci-default.yml
|
||||||
|
# build and upload versions of kava for use on internal infrastructure
|
||||||
|
# configurations for databases, cpu architectures and operating systems
|
||||||
|
publish-internal:
|
||||||
|
# only run if all checks pass
|
||||||
|
needs: [commit-checks, default-checks]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: set build tag
|
||||||
|
run: echo "BUILD_TAG=$(date +%s)-$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV
|
||||||
|
- name: build rocksdb dependency
|
||||||
|
run: bash ${GITHUB_WORKSPACE}/.github/scripts/install-rocksdb.sh
|
||||||
|
env:
|
||||||
|
ROCKSDB_VERSION: v7.7.3
|
||||||
|
- name: Build and upload release artifacts
|
||||||
|
run: bash ${GITHUB_WORKSPACE}/.github/scripts/publish-internal-release-artifacts.sh
|
||||||
|
env:
|
||||||
|
BUILD_TAG: ${{ env.BUILD_TAG }}
|
||||||
|
AWS_REGION: us-east-1
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_KEY_SECRET }}
|
11
.github/workflows/ci-pr.yml
vendored
Normal file
11
.github/workflows/ci-pr.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
name: Continuous Integration (PR)
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
# run CI on pull requests to master or a release branch
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- 'releases/**'
|
||||||
|
# run default ci checks against current PR
|
||||||
|
jobs:
|
||||||
|
default:
|
||||||
|
uses: ./.github/workflows/ci-default.yml
|
78
.github/workflows/ci.yml
vendored
78
.github/workflows/ci.yml
vendored
@ -1,78 +0,0 @@
|
|||||||
name: Continuous Integration
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
# run CI on pull requests to master or a release branch
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- 'releases/**'
|
|
||||||
push:
|
|
||||||
# run CI on any push to the master branch
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
# concurrently lint, build, and run tests against kava based off current commit
|
|
||||||
jobs:
|
|
||||||
golangci-lint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@master
|
|
||||||
- name: golangci-lint
|
|
||||||
uses: reviewdog/action-golangci-lint@v1
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.github_token }}
|
|
||||||
reporter: github-pr-review
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: checkout repo from current commit
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '1.18'
|
|
||||||
check-latest: true
|
|
||||||
cache: true
|
|
||||||
- name: build application
|
|
||||||
run: make build
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: checkout repo from current commit
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '1.18'
|
|
||||||
check-latest: true
|
|
||||||
cache: true
|
|
||||||
- name: run unit tests
|
|
||||||
run: make test
|
|
||||||
# only run on merges to master
|
|
||||||
publish:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.ref_name == 'master'
|
|
||||||
steps:
|
|
||||||
- name: checkout repo from current commit
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '1.18'
|
|
||||||
check-latest: true
|
|
||||||
cache: true
|
|
||||||
- name: build application
|
|
||||||
run: make build
|
|
||||||
- name: run unit tests
|
|
||||||
run: make test
|
|
||||||
- name: set build tag
|
|
||||||
run: echo "BUILD_TAG=$(date +%s)-$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV
|
|
||||||
- name: build rocksdb dependency
|
|
||||||
run: bash ${GITHUB_WORKSPACE}/.github/scripts/install-rocksdb.sh
|
|
||||||
env:
|
|
||||||
ROCKSDB_VERSION: v7.7.3
|
|
||||||
- name: Build and upload release artifacts
|
|
||||||
run: bash ${GITHUB_WORKSPACE}/.github/scripts/publish-internal-release-artifacts.sh
|
|
||||||
env:
|
|
||||||
BUILD_TAG: ${{ env.BUILD_TAG }}
|
|
||||||
AWS_REGION: us-east-1
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_KEY_SECRET }}
|
|
3
.github/workflows/proto.yml
vendored
3
.github/workflows/proto.yml
vendored
@ -1,8 +1,7 @@
|
|||||||
name: Protobuf Checks
|
name: Protobuf Checks
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_call:
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-proto:
|
check-proto:
|
||||||
|
Loading…
Reference in New Issue
Block a user