From 76cd8da8315011e47452abba81966ef1571fc3f2 Mon Sep 17 00:00:00 2001 From: tnasu Date: Fri, 4 Feb 2022 17:34:14 +0900 Subject: [PATCH] Refactor filenames and improve process on github actions --- .github/workflows/{tests.yml => abci.yml} | 4 +- .github/workflows/build.yml | 46 +++++++++++++++++ .github/workflows/coverage.yml | 62 +++++++---------------- 3 files changed, 67 insertions(+), 45 deletions(-) rename .github/workflows/{tests.yml => abci.yml} (95%) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/abci.yml similarity index 95% rename from .github/workflows/tests.yml rename to .github/workflows/abci.yml index fd5f2540f..bf9807abe 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/abci.yml @@ -1,6 +1,6 @@ name: Tests -# Tests runs different tests (test_abci_apps, test_abci_cli, test_apps) -# This workflow runs on every push to master or release branch and every pull requests +# Test runs different tests (test_abci_apps, test_abci_cli, test_apps) +# This workflow runs on every push to main or release branch and every pull requests # All jobs will pass without running if no *{.go, .mod, .sum} files have been modified on: pull_request: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..23885a2a7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,46 @@ +name: Build for Linux +on: + pull_request: + push: + +jobs: + + build-linux: + name: Build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - goarch: "amd64" + gcc: "gcc" + package: "" + host: "" + - goarch: "arm64" + gcc: "aarch64-linux-gnu-gcc" + package: "g++-aarch64-linux-gnu" + host: "aarch64-linux-gnu" + - goarch: "arm" + gcc: "arm-linux-gnueabi-gcc" + package: "g++-arm-linux-gnueabi" + host: "arm-linux-gnueabi" + timeout-minutes: 5 + steps: + - run: sudo apt update && sudo apt install -y ${{ matrix.package }} qemu-user-binfmt + if: "matrix.package != ''" + - uses: actions/setup-go@v2 + with: + go-version: "^1.15.4" + - uses: actions/checkout@v2.4.0 + - uses: technote-space/get-diff-action@v6.0.1 + with: + PATTERNS: | + **/**.go + go.mod + go.sum + - name: Build Linux + run: GOOS=linux GOARCH=${{ matrix.goarch }} CC=${{ matrix.gcc }} TARGET_HOST=${{ matrix.host }} make build + if: "env.GIT_DIFF != ''" + - name: Build Linux with Libsodium + run: GOOS=linux GOARCH=${{ matrix.goarch }} CC=${{ matrix.gcc }} TARGET_HOST=${{ matrix.host }} LIBSODIUM=1 make build + if: "env.GIT_DIFF != ''" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 05ea9f94c..d334986bf 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -10,8 +10,8 @@ jobs: - uses: actions/checkout@v2.4.0 - name: Create a file with all the pkgs run: go list ./... > pkgs.txt - - name: Split pkgs into 4 files - run: split -d -n l/4 pkgs.txt pkgs.txt.part. + - name: Split pkgs into 6 files + run: split -d -n l/6 pkgs.txt pkgs.txt.part. # cache multiple - uses: actions/upload-artifact@v2 with: @@ -29,6 +29,14 @@ jobs: with: name: "${{ github.sha }}-03" path: ./pkgs.txt.part.03 + - uses: actions/upload-artifact@v2 + with: + name: "${{ github.sha }}-04" + path: ./pkgs.txt.part.04 + - uses: actions/upload-artifact@v2 + with: + name: "${{ github.sha }}-05" + path: ./pkgs.txt.part.05 build-libsodium: name: Build libsodium @@ -42,46 +50,6 @@ jobs: name: libsodium path: crypto/vrf/internal/vrf/sodium - build-linux: - name: Build - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - goarch: "amd64" - gcc: "gcc" - package: "" - host: "" - - goarch: "arm64" - gcc: "aarch64-linux-gnu-gcc" - package: "g++-aarch64-linux-gnu" - host: "aarch64-linux-gnu" - - goarch: "arm" - gcc: "arm-linux-gnueabi-gcc" - package: "g++-arm-linux-gnueabi" - host: "arm-linux-gnueabi" - timeout-minutes: 5 - steps: - - run: sudo apt update && sudo apt install -y ${{ matrix.package }} qemu-user-binfmt - if: "matrix.package != ''" - - uses: actions/setup-go@v2 - with: - go-version: "^1.15.4" - - uses: actions/checkout@v2.4.0 - - uses: technote-space/get-diff-action@v6.0.1 - with: - PATTERNS: | - **/**.go - go.mod - go.sum - - name: Build Linux - run: GOOS=linux GOARCH=${{ matrix.goarch }} CC=${{ matrix.gcc }} TARGET_HOST=${{ matrix.host }} make build - if: "env.GIT_DIFF != ''" - - name: Build Linux with Libsodium - run: GOOS=linux GOARCH=${{ matrix.goarch }} CC=${{ matrix.gcc }} TARGET_HOST=${{ matrix.host }} LIBSODIUM=1 make build - if: "env.GIT_DIFF != ''" - tests: runs-on: ubuntu-latest needs: build-libsodium @@ -89,7 +57,7 @@ jobs: fail-fast: false matrix: vrf: ["r2ishiguro", "libsodium"] - part: ["00", "01", "02", "03"] + part: ["00", "01", "02", "03", "04", "05"] steps: - uses: actions/setup-go@v2 with: @@ -145,6 +113,14 @@ jobs: with: name: "${{ github.sha }}-03-coverage" if: env.GIT_DIFF + - uses: actions/download-artifact@v2 + with: + name: "${{ github.sha }}-04-coverage" + if: env.GIT_DIFF + - uses: actions/download-artifact@v2 + with: + name: "${{ github.sha }}-05-coverage" + if: env.GIT_DIFF - run: | cat ./*profile.out | grep -v "mode: atomic" >> coverage.txt if: env.GIT_DIFF