From d237d98c155e775ac9efc80dde43c9a73ce505d6 Mon Sep 17 00:00:00 2001 From: Chris Lane Date: Wed, 28 Apr 2021 17:11:07 -0400 Subject: [PATCH] chore: migrate into Github Actions Replace Travis CI integration in favor of Github Actions. --- .github/workflows/build.yml | 57 +++++++++++++++++++++++++++ .github/workflows/codeql-analysis.yml | 40 +++---------------- .travis.yml | 15 ------- Makefile | 6 +-- README.md | 4 +- 5 files changed, 65 insertions(+), 57 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..edce04e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,57 @@ +name: Go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + # TODO: is it possible to DRY out these jobs? Aside from `runs-on`, they are + # identical. + build-linux: + runs-on: [ ubuntu-latest ] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + + - name: Set up Revive (linter) + run: go get -u github.com/boyter/scc github.com/mgechev/revive + env: + GO111MODULE: off + + + - name: Build + run: make build + + - name: Test + run: make test + + build-osx: + runs-on: [ macos-latest ] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + + - name: Set up Revive (linter) + run: go get -u github.com/boyter/scc github.com/mgechev/revive + env: + GO111MODULE: off + + - name: Build + run: make build + + - name: Test + run: make test + + # TODO: windows diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index aee0045..941e993 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,23 +1,12 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# ******** NOTE ******** - -name: "CodeQL" +name: CodeQL on: push: branches: [ master ] + pull_request: - # The branches below must be a subset of the branches above branches: [ master ] + schedule: - cron: '45 23 * * 0' @@ -30,37 +19,18 @@ jobs: fail-fast: false matrix: language: [ 'go' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more... - # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection steps: - name: Checkout repository uses: actions/checkout@v2 - # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v1 with: languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - #- name: Autobuild - #uses: github/codeql-action/autobuild@v1 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - - run: make + - name: Autobuild + uses: github/codeql-action/autobuild@v1 - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v1 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4a7b350..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: go - -go: - - 1.14.x - -os: - - linux - - osx - -env: - - GO111MODULE=on - -install: true - -script: make ci diff --git a/Makefile b/Makefile index 2a0e1d4..e337d6e 100644 --- a/Makefile +++ b/Makefile @@ -40,17 +40,13 @@ releases := \ ## build: build an executable for your architecture .PHONY: build -build: $(dist_dir) clean vendor generate man +build: $(dist_dir) clean fmt lint vet vendor generate man $(GO) build $(BUILD_FLAGS) -o $(dist_dir)/cheat $(cmd_dir) ## build-release: build release executables .PHONY: build-release build-release: $(releases) -## ci: build a "release" executable for the current architecture (used in ci) -.PHONY: ci -ci: | setup prepare build - # cheat-darwin-amd64 $(dist_dir)/cheat-darwin-amd64: prepare GOARCH=amd64 GOOS=darwin \ diff --git a/README.md b/README.md index 7aaa58b..149812a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ +![Workflow status](https://github.com/cheat/cheat/workflows/build/badge.svg) + cheat ===== -[![Build Status](https://travis-ci.com/cheat/cheat.svg?branch=master)](https://travis-ci.com/cheat/cheat) - `cheat` allows you to create and view interactive cheatsheets on the command-line. It was designed to help remind \*nix system administrators of options for commands that they use frequently, but not frequently enough to