From 530a2331bffe23dce2444252f1f31573dbdcedc0 Mon Sep 17 00:00:00 2001 From: Manav Darji Date: Tue, 5 Sep 2023 16:13:16 +0530 Subject: [PATCH] .github/workflows: run more parallel CI jobs (#976) * .github/workflows: run parallel CI jobs * undo --- .github/workflows/ci.yml | 111 ++++++++++++++++++++++++++++++++++----- 1 file changed, 98 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3bd11b2fce..4ffe4bdf76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ concurrency: cancel-in-progress: true jobs: - tests: + build: if: (github.event.action != 'closed' || github.event.pull_request.merged == true) strategy: matrix: @@ -35,10 +35,6 @@ jobs: if: runner.os == 'Linux' run: sudo apt update && sudo apt install build-essential - - name: Golang-ci install - if: runner.os == 'Linux' - run: make lintci-deps - - uses: actions/cache@v3 with: path: | @@ -51,24 +47,69 @@ jobs: - name: Build run: make all + lint: + if: (github.event.action != 'closed' || github.event.pull_request.merged == true) + strategy: + matrix: + os: [ ubuntu-20.04 ] # list of os: https://github.com/actions/virtual-environments + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - run: | + git submodule update --init --recursive --force + git fetch --no-tags --prune --depth=1 origin +refs/heads/master:refs/remotes/origin/master + + - uses: actions/setup-go@v3 + with: + go-version: 1.20.x + + - name: Install dependencies on Linux + if: runner.os == 'Linux' + run: sudo apt update && sudo apt install build-essential + + - name: Golang-ci install + if: runner.os == 'Linux' + run: make lintci-deps + - name: Lint if: runner.os == 'Linux' run: make lint + unit-tests: + if: (github.event.action != 'closed' || github.event.pull_request.merged == true) + strategy: + matrix: + os: [ ubuntu-20.04 ] # list of os: https://github.com/actions/virtual-environments + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - run: | + git submodule update --init --recursive --force + git fetch --no-tags --prune --depth=1 origin +refs/heads/master:refs/remotes/origin/master + + - uses: actions/setup-go@v3 + with: + go-version: 1.20.x + + - name: Install dependencies on Linux + if: runner.os == 'Linux' + run: sudo apt update && sudo apt install build-essential + + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/Library/Caches/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-go- + - name: Test run: make test #- name: Data race tests # run: make test-race - - name: test-integration - run: make test-integration - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 - with: - file: ./cover.out - # # TODO: make it work # - name: Reproducible build test # run: | @@ -81,6 +122,50 @@ jobs: # fi integration-tests: + if: (github.event.action != 'closed' || github.event.pull_request.merged == true) + strategy: + matrix: + os: [ ubuntu-20.04 ] # list of os: https://github.com/actions/virtual-environments + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - run: | + git submodule update --init --recursive --force + git fetch --no-tags --prune --depth=1 origin +refs/heads/master:refs/remotes/origin/master + + - uses: actions/setup-go@v3 + with: + go-version: 1.20.x + + - name: Install dependencies on Linux + if: runner.os == 'Linux' + run: sudo apt update && sudo apt install build-essential + + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/Library/Caches/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-go- + + - name: test-integration + run: make test-integration + + codecov: + if: (github.event.action != 'closed' || github.event.pull_request.merged == true) + strategy: + matrix: + os: [ ubuntu-20.04 ] # list of os: https://github.com/actions/virtual-environments + runs-on: ${{ matrix.os }} + steps: + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + file: ./cover.out + + matic-cli-tests: if: (github.event.action != 'closed' || github.event.pull_request.merged == true) strategy: matrix: