diff --git a/.github/workflows/lint-and-build-using-make.yml b/.github/workflows/lint-and-build-using-make.yml new file mode 100644 index 00000000..1ba229a4 --- /dev/null +++ b/.github/workflows/lint-and-build-using-make.yml @@ -0,0 +1,73 @@ +# Copyright 2020 Adam Chalkley +# +# https://github.com/atc0005/elbow +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Lint and Build using Makefile + +# Run builds for Pull Requests (new, updated) +# `synchronized` seems to equate to pushing new commits to a linked branch +# (whether force-pushed or not) +on: + #push: + pull_request: + types: [opened, synchronize] + +jobs: + lint_code_with_makefile: + name: Lint codebase using Makefile + runs-on: ubuntu-latest + # Default: 360 minutes + timeout-minutes: 10 + container: + image: "index.docker.io/golang:latest" + + steps: + - name: Print go version + run: go version + + - name: Check out code into the Go module directory + uses: actions/checkout@v2.3.1 + + # bsdmainutils provides "column" which is used by the Makefile + - name: Install Ubuntu packages + run: apt-get update && apt-get install -y --no-install-recommends make gcc bsdmainutils + + - name: Install Go linting tools + run: make lintinstall + + - name: Run Go linting tools using project Makefile + run: make linting + + build_code_with_makefile: + name: Build codebase using Makefile + runs-on: ubuntu-latest + # Default: 360 minutes + timeout-minutes: 10 + container: + image: "index.docker.io/golang:latest" + + steps: + - name: Print go version + run: go version + + - name: Check out code into the Go module directory + uses: actions/checkout@v2.3.1 + + # bsdmainutils provides "column" which is used by the Makefile + - name: Install Ubuntu packages + run: apt-get update && apt-get install -y --no-install-recommends make gcc bsdmainutils + + - name: Build using project Makefile + run: make all diff --git a/.github/workflows/lint-and-test-only.yml b/.github/workflows/lint-and-test-only.yml new file mode 100644 index 00000000..3040e4f4 --- /dev/null +++ b/.github/workflows/lint-and-test-only.yml @@ -0,0 +1,41 @@ +# Copyright 2020 Adam Chalkley +# +# https://github.com/atc0005/elbow +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Quick Validation + +# Run builds for Pull Requests (new, updated) +# `synchronized` seems to equate to pushing new commits to a linked branch +# (whether force-pushed or not) +on: + push: + +jobs: + lint_and_test_code: + name: Lint and test using latest stable container + runs-on: ubuntu-latest + timeout-minutes: 10 + container: + image: index.docker.io/atc0005/go-ci:go-ci-lint-only + + steps: + - name: Check out code + uses: actions/checkout@v2.3.1 + + - name: Run golangci-lint using repo-provided config file settings + run: golangci-lint run -v + + - name: Run all tests + run: go test -mod=vendor -v ./...