diff --git a/.github/workflows/build-test-linux.yml b/.github/workflows/build-test-linux.yml new file mode 100644 index 0000000000..b18db19759 --- /dev/null +++ b/.github/workflows/build-test-linux.yml @@ -0,0 +1,55 @@ +# 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/**' + - '!.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: + linux-unittest: + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ~1.15.15 + + - name: Check out code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + submodules: 'true' + + - name: Cache build output + uses: actions/cache@v2 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + + - 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 54% rename from .github/workflows/build.yml rename to .github/workflows/build-test-macos.yml index df3dc8dd97..3cc3f6e873 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build-test-macos.yml @@ -1,10 +1,10 @@ -name: build-and-test +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: MIT +name: build-and-test-macos on: push: - branches: - - master - + branches: [master, main] paths-ignore: - '**.md' - '.github/**' @@ -20,34 +20,14 @@ concurrency: cancel-in-progress: true jobs: - build: - name: Build - runs-on: ${{ matrix.os }} - 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 + macos-unittest: + runs-on: macos-latest 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 @@ -55,16 +35,13 @@ jobs: fetch-depth: 0 submodules: 'true' - - name: Debug go.mod - run: cat go.mod - - name: Cache build output uses: actions/cache@v2 with: - path: ${{ matrix.cachepath }} + path: | + ~/Library/Caches/go-build + ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - name: Test run: make test @@ -75,4 +52,4 @@ jobs: verbose: true - name: Build - run: make build + run: make build \ No newline at end of file diff --git a/.github/workflows/build-test-windows.yml b/.github/workflows/build-test-windows.yml index e73409d3bc..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/**' @@ -36,10 +36,18 @@ jobs: path: | %LocalAppData%\go-build ~/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