From f30e08e1f8d3ee4402356b09e880001441b9f3e3 Mon Sep 17 00:00:00 2001 From: GuillaumeBchd <45106812+GuillaumeBchd@users.noreply.github.com> Date: Wed, 2 Feb 2022 21:43:42 +0100 Subject: [PATCH 01/13] Breakout unit testing per OS. Issue: #353 --- .github/workflows/build-test-linux.yml | 68 +++++++++++++++++++ .../{build.yml => build-test-macos.yml} | 28 +++----- 2 files changed, 77 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/build-test-linux.yml rename .github/workflows/{build.yml => build-test-macos.yml} (75%) diff --git a/.github/workflows/build-test-linux.yml b/.github/workflows/build-test-linux.yml new file mode 100644 index 0000000000..a568cea076 --- /dev/null +++ b/.github/workflows/build-test-linux.yml @@ -0,0 +1,68 @@ +name: build-and-test-linux + +on: + push: + branches: + - master + + paths-ignore: + - '**.md' + - '.github/**' + - '!.github/workflows/build-*' + + + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + build-linux: + name: Build-linux + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ~1.15.15 + id: go + + - name: Configure git with longpath enabled (for windows) + run: git config --global core.longpaths true + + - name: Check out code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + submodules: 'true' + + - name: Debug go.mod + run: cat go.mod + + - name: Cache build output + uses: actions/cache@v2 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + /home/runner/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Test + run: make test + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 + with: + verbose: true + + - name: Build + run: make build \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build-test-macos.yml similarity index 75% rename from .github/workflows/build.yml rename to .github/workflows/build-test-macos.yml index df3dc8dd97..02ebcdd192 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build-test-macos.yml @@ -1,4 +1,4 @@ -name: build-and-test +name: build-and-test-macos on: push: @@ -20,24 +20,11 @@ concurrency: cancel-in-progress: true jobs: - build: - name: Build - runs-on: ${{ matrix.os }} + build-macos: + name: Build-macos + runs-on: macos-latest strategy: fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest] - include: - - os: ubuntu-latest - cachepath: | - ~/.cache/go-build - ~/go/pkg/mod - /home/runner/.cache/go-build - - os: macos-latest - cachepath: | - ~/Library/Caches/go-build - ~/go/pkg/mod - /Users/runner/Library/Caches/go-build steps: - name: Set up Go 1.x @@ -61,7 +48,10 @@ jobs: - name: Cache build output uses: actions/cache@v2 with: - path: ${{ matrix.cachepath }} + path: | + ~/Library/Caches/go-build + ~/go/pkg/mod + /Users/runner/Library/Caches/go-build key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- @@ -75,4 +65,4 @@ jobs: verbose: true - name: Build - run: make build + run: make build \ No newline at end of file From 7cc7a47a2dd466fbedb4eae8ccc3bccccbc2c3ee Mon Sep 17 00:00:00 2001 From: GuillaumeBchd <45106812+GuillaumeBchd@users.noreply.github.com> Date: Wed, 2 Feb 2022 22:42:57 +0100 Subject: [PATCH 02/13] removed upload step from build-test-macos.yml --- .github/workflows/build-test-macos.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index 02ebcdd192..f2c127fe14 100644 --- a/.github/workflows/build-test-macos.yml +++ b/.github/workflows/build-test-macos.yml @@ -59,10 +59,5 @@ jobs: - name: Test run: make test - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 - with: - verbose: true - - name: Build run: make build \ No newline at end of file From 82584dfac251e19b3c978ad6a4fe4669004602a9 Mon Sep 17 00:00:00 2001 From: GuillaumeBchd <45106812+GuillaumeBchd@users.noreply.github.com> Date: Wed, 2 Feb 2022 23:19:16 +0100 Subject: [PATCH 03/13] added on push main, to support future migration to this branch --- .github/workflows/build-test-linux.yml | 3 +-- .github/workflows/build-test-macos.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-test-linux.yml b/.github/workflows/build-test-linux.yml index a568cea076..6528f9194a 100644 --- a/.github/workflows/build-test-linux.yml +++ b/.github/workflows/build-test-linux.yml @@ -2,8 +2,7 @@ name: build-and-test-linux on: push: - branches: - - master + branches: [master, main] paths-ignore: - '**.md' diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index f2c127fe14..055dc930cd 100644 --- a/.github/workflows/build-test-macos.yml +++ b/.github/workflows/build-test-macos.yml @@ -2,8 +2,7 @@ name: build-and-test-macos on: push: - branches: - - master + branches: [master, main] paths-ignore: - '**.md' From cbe8e5bc6be49093b1ea8187577971c1a0126eeb Mon Sep 17 00:00:00 2001 From: GuillaumeBchd <45106812+GuillaumeBchd@users.noreply.github.com> Date: Wed, 2 Feb 2022 23:20:36 +0100 Subject: [PATCH 04/13] removed strategy since we aren't using matrix for github --- .github/workflows/build-test-linux.yml | 2 -- .github/workflows/build-test-macos.yml | 2 -- 2 files changed, 4 deletions(-) diff --git a/.github/workflows/build-test-linux.yml b/.github/workflows/build-test-linux.yml index 6528f9194a..de69ca9135 100644 --- a/.github/workflows/build-test-linux.yml +++ b/.github/workflows/build-test-linux.yml @@ -22,8 +22,6 @@ jobs: build-linux: name: Build-linux runs-on: ubuntu-latest - strategy: - fail-fast: false steps: - name: Set up Go 1.x diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index 055dc930cd..6e6582ade5 100644 --- a/.github/workflows/build-test-macos.yml +++ b/.github/workflows/build-test-macos.yml @@ -22,8 +22,6 @@ jobs: build-macos: name: Build-macos runs-on: macos-latest - strategy: - fail-fast: false steps: - name: Set up Go 1.x From 273ade50ed69db6129e4dfbaf23337734b8159f5 Mon Sep 17 00:00:00 2001 From: GuillaumeBchd <45106812+GuillaumeBchd@users.noreply.github.com> Date: Wed, 2 Feb 2022 23:21:49 +0100 Subject: [PATCH 05/13] removed unused step for linux and macos --- .github/workflows/build-test-linux.yml | 3 --- .github/workflows/build-test-macos.yml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/build-test-linux.yml b/.github/workflows/build-test-linux.yml index de69ca9135..1208f5be08 100644 --- a/.github/workflows/build-test-linux.yml +++ b/.github/workflows/build-test-linux.yml @@ -30,9 +30,6 @@ jobs: go-version: ~1.15.15 id: go - - name: Configure git with longpath enabled (for windows) - run: git config --global core.longpaths true - - name: Check out code uses: actions/checkout@v2 with: diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index 6e6582ade5..64c6aa4e1b 100644 --- a/.github/workflows/build-test-macos.yml +++ b/.github/workflows/build-test-macos.yml @@ -30,9 +30,6 @@ jobs: go-version: ~1.15.15 id: go - - name: Configure git with longpath enabled (for windows) - run: git config --global core.longpaths true - - name: Check out code uses: actions/checkout@v2 with: From ba049a7554ea1624859090950fddb1d798e76a90 Mon Sep 17 00:00:00 2001 From: GuillaumeBchd <45106812+GuillaumeBchd@users.noreply.github.com> Date: Wed, 2 Feb 2022 23:24:46 +0100 Subject: [PATCH 06/13] removed the 'restore-keys' to avoid caching old dependencies pkgs --- .github/workflows/build-test-linux.yml | 2 -- .github/workflows/build-test-macos.yml | 2 -- 2 files changed, 4 deletions(-) diff --git a/.github/workflows/build-test-linux.yml b/.github/workflows/build-test-linux.yml index 1208f5be08..dae3c61d39 100644 --- a/.github/workflows/build-test-linux.yml +++ b/.github/workflows/build-test-linux.yml @@ -47,8 +47,6 @@ jobs: ~/go/pkg/mod /home/runner/.cache/go-build key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - name: Test run: make test diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index 64c6aa4e1b..45940d8e6b 100644 --- a/.github/workflows/build-test-macos.yml +++ b/.github/workflows/build-test-macos.yml @@ -47,8 +47,6 @@ jobs: ~/go/pkg/mod /Users/runner/Library/Caches/go-build key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - name: Test run: make test From 8ce5ff436ffebbe6252a1b95c4e56667278ca641 Mon Sep 17 00:00:00 2001 From: GuillaumeBchd <45106812+GuillaumeBchd@users.noreply.github.com> Date: Wed, 2 Feb 2022 23:27:27 +0100 Subject: [PATCH 07/13] added back the upload to Codecov in macos --- .github/workflows/build-test-macos.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index 45940d8e6b..e82795fb54 100644 --- a/.github/workflows/build-test-macos.yml +++ b/.github/workflows/build-test-macos.yml @@ -51,5 +51,10 @@ jobs: - name: Test run: make test + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 + with: + verbose: true + - name: Build run: make build \ No newline at end of file From ce38777c3d35e33854264c9f63b32eaf9e852bef Mon Sep 17 00:00:00 2001 From: GuillaumeBchd <45106812+GuillaumeBchd@users.noreply.github.com> Date: Wed, 2 Feb 2022 23:28:34 +0100 Subject: [PATCH 08/13] removed useless 'id' in the setup --- .github/workflows/build-test-linux.yml | 1 - .github/workflows/build-test-macos.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/build-test-linux.yml b/.github/workflows/build-test-linux.yml index dae3c61d39..99ded8f7bf 100644 --- a/.github/workflows/build-test-linux.yml +++ b/.github/workflows/build-test-linux.yml @@ -28,7 +28,6 @@ jobs: uses: actions/setup-go@v2 with: go-version: ~1.15.15 - id: go - name: Check out code uses: actions/checkout@v2 diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index e82795fb54..004b1712ac 100644 --- a/.github/workflows/build-test-macos.yml +++ b/.github/workflows/build-test-macos.yml @@ -28,7 +28,6 @@ jobs: uses: actions/setup-go@v2 with: go-version: ~1.15.15 - id: go - name: Check out code uses: actions/checkout@v2 From a20a2984d78766252ce83d16c376ca5861ed20f5 Mon Sep 17 00:00:00 2001 From: GuillaumeBchd <45106812+GuillaumeBchd@users.noreply.github.com> Date: Wed, 2 Feb 2022 23:37:28 +0100 Subject: [PATCH 09/13] removed restore-keys in windows workflow, changed the testing by installing make, doing make test and make build, added upload to codecov in the windows pipeline --- .github/workflows/build-test-windows.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-test-windows.yml b/.github/workflows/build-test-windows.yml index e73409d3bc..979ad35954 100644 --- a/.github/workflows/build-test-windows.yml +++ b/.github/workflows/build-test-windows.yml @@ -38,8 +38,17 @@ jobs: ~/go/pkg/mod C:\Users\runneradmin\AppData\Local\go-build key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + + - name: Install make + run: choco install make - name: Run Unit tests - run: go test ./... + run: make test + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 + with: + verbose: true + + - name: Run build + run: make build From 2cf8bd29e3fd91ff3ebe69d24e35f0cd4baf173c Mon Sep 17 00:00:00 2001 From: GuillaumeBchd <45106812+GuillaumeBchd@users.noreply.github.com> Date: Wed, 2 Feb 2022 23:39:04 +0100 Subject: [PATCH 10/13] change jobs name in linux and macos to match the windows pipeline --- .github/workflows/build-test-linux.yml | 3 +-- .github/workflows/build-test-macos.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-test-linux.yml b/.github/workflows/build-test-linux.yml index 99ded8f7bf..a0c4b3c43b 100644 --- a/.github/workflows/build-test-linux.yml +++ b/.github/workflows/build-test-linux.yml @@ -19,8 +19,7 @@ concurrency: cancel-in-progress: true jobs: - build-linux: - name: Build-linux + linux-unittest: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index 004b1712ac..bf31c9197f 100644 --- a/.github/workflows/build-test-macos.yml +++ b/.github/workflows/build-test-macos.yml @@ -19,8 +19,7 @@ concurrency: cancel-in-progress: true jobs: - build-macos: - name: Build-macos + macos-unittest: runs-on: macos-latest steps: From 83e75171a56b6c8fe703e8f95f2a451b05563b5c Mon Sep 17 00:00:00 2001 From: GuillaumeBchd <45106812+GuillaumeBchd@users.noreply.github.com> Date: Wed, 2 Feb 2022 23:41:37 +0100 Subject: [PATCH 11/13] removed runner cache, based on test done by khanhntd --- .github/workflows/build-test-linux.yml | 1 - .github/workflows/build-test-macos.yml | 1 - .github/workflows/build-test-windows.yml | 1 - 3 files changed, 3 deletions(-) diff --git a/.github/workflows/build-test-linux.yml b/.github/workflows/build-test-linux.yml index a0c4b3c43b..9076ce1541 100644 --- a/.github/workflows/build-test-linux.yml +++ b/.github/workflows/build-test-linux.yml @@ -43,7 +43,6 @@ jobs: path: | ~/.cache/go-build ~/go/pkg/mod - /home/runner/.cache/go-build key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - name: Test diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index bf31c9197f..9d60643514 100644 --- a/.github/workflows/build-test-macos.yml +++ b/.github/workflows/build-test-macos.yml @@ -43,7 +43,6 @@ jobs: path: | ~/Library/Caches/go-build ~/go/pkg/mod - /Users/runner/Library/Caches/go-build key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - name: Test diff --git a/.github/workflows/build-test-windows.yml b/.github/workflows/build-test-windows.yml index 979ad35954..e16725427f 100644 --- a/.github/workflows/build-test-windows.yml +++ b/.github/workflows/build-test-windows.yml @@ -36,7 +36,6 @@ jobs: path: | %LocalAppData%\go-build ~/go/pkg/mod - C:\Users\runneradmin\AppData\Local\go-build key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - name: Install make From 20ed2557ce12161b57875b153b0ccb9191d52e42 Mon Sep 17 00:00:00 2001 From: GuillaumeBchd <45106812+GuillaumeBchd@users.noreply.github.com> Date: Thu, 3 Feb 2022 00:05:14 +0100 Subject: [PATCH 12/13] added license on top of files, added the on push main branch in build-test-windows.yml --- .github/workflows/build-test-linux.yml | 5 +++-- .github/workflows/build-test-macos.yml | 5 +++-- .github/workflows/build-test-windows.yml | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-test-linux.yml b/.github/workflows/build-test-linux.yml index 9076ce1541..399222fbc0 100644 --- a/.github/workflows/build-test-linux.yml +++ b/.github/workflows/build-test-linux.yml @@ -1,9 +1,10 @@ -name: build-and-test-linux +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: MIT +name: build-and-test-linux on: push: branches: [master, main] - paths-ignore: - '**.md' - '.github/**' diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index 9d60643514..410c2fa751 100644 --- a/.github/workflows/build-test-macos.yml +++ b/.github/workflows/build-test-macos.yml @@ -1,9 +1,10 @@ -name: build-and-test-macos +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: MIT +name: build-and-test-macos on: push: branches: [master, main] - paths-ignore: - '**.md' - '.github/**' diff --git a/.github/workflows/build-test-windows.yml b/.github/workflows/build-test-windows.yml index e16725427f..89702db90c 100644 --- a/.github/workflows/build-test-windows.yml +++ b/.github/workflows/build-test-windows.yml @@ -1,10 +1,10 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: MIT name: build-and-test-windows on: push: - branches: - - master - + branches: [master, main] paths-ignore: - '**.md' - '.github/**' From f085214225c9c2819680896be00457dad97e22c4 Mon Sep 17 00:00:00 2001 From: GuillaumeBchd <45106812+GuillaumeBchd@users.noreply.github.com> Date: Thu, 3 Feb 2022 00:07:06 +0100 Subject: [PATCH 13/13] removed useless 'Debug go.mod' step since we do not use restore-keys anymore --- .github/workflows/build-test-linux.yml | 3 --- .github/workflows/build-test-macos.yml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/build-test-linux.yml b/.github/workflows/build-test-linux.yml index 399222fbc0..b18db19759 100644 --- a/.github/workflows/build-test-linux.yml +++ b/.github/workflows/build-test-linux.yml @@ -35,9 +35,6 @@ jobs: fetch-depth: 0 submodules: 'true' - - name: Debug go.mod - run: cat go.mod - - name: Cache build output uses: actions/cache@v2 with: diff --git a/.github/workflows/build-test-macos.yml b/.github/workflows/build-test-macos.yml index 410c2fa751..3cc3f6e873 100644 --- a/.github/workflows/build-test-macos.yml +++ b/.github/workflows/build-test-macos.yml @@ -35,9 +35,6 @@ jobs: fetch-depth: 0 submodules: 'true' - - name: Debug go.mod - run: cat go.mod - - name: Cache build output uses: actions/cache@v2 with: