diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..bc9503b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + - package-ecosystem: gomod + directory: "/" + schedule: + interval: daily diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e13631d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,18 @@ +name: Build + +on: + pull_request: + push: + branches: ["main"] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.0.0 + - uses: actions/setup-go@v4 + with: + go-version: 1.20.2 # The Go version to download (if necessary) and use. + - name: Build CLI + run: go install ./... diff --git a/.github/workflows/cloc.yml b/.github/workflows/cloc.yml new file mode 100644 index 0000000..325f176 --- /dev/null +++ b/.github/workflows/cloc.yml @@ -0,0 +1,25 @@ +name: Count Lines of Code + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the main branch +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + cloc: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4.0.0 + + # Runs djdefi/cloc-action + - name: Count Lines of Code (cloc) + uses: djdefi/cloc-action@5 diff --git a/.github/workflows/golangci.yml b/.github/workflows/golangci.yml new file mode 100644 index 0000000..5c59e28 --- /dev/null +++ b/.github/workflows/golangci.yml @@ -0,0 +1,27 @@ +name: golangci-lint +on: + push: + tags: + - v* + branches: + - main + pull_request: +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + # pull-requests: read +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v4 + with: + go-version: 1.20.2 + - uses: actions/checkout@v4.0.0 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version + version: latest + args: --timeout 10m diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0b5ac84 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,60 @@ +name: Release + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v20.15.10 + - "v[0-9]+.[0-9]+.[0-9]+.?[0-9]*" # Push events to matching v*, v20.15.10.1 + - "v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+" # Push events to matching alpha releases + - "v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+" # Push events to matching beta releases + - "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+" # Push events to matching release candidates + + +jobs: + native-build-cli: + runs-on: ${{matrix.os}} + strategy: + matrix: + os: [ubuntu-20.04, macos-latest] + steps: + - uses: actions/checkout@v4.0.0 + - uses: actions/setup-go@v4 + with: + go-version: 1.20.2 # The Go version to download (if necessary) and use. + - name: Build CLI + shell: bash + run: | + make build + cp "build/jackalapi" "jackalapi-$RUNNER_OS" + - uses: actions/upload-artifact@v3 + with: + name: jackalapi-${{runner.os}} + path: jackalapi-${{runner.os}} + + Release: + needs: + [native-build-cli] + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4.0.0 + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/} + - name: Declare Commit Variables + id: is_pre_release + shell: bash + run: | + echo "::set-output name=IS_PRE_RELEASE::$(echo "${{ steps.get_version.outputs.VERSION }}" | awk 'BEGIN{prerelease="false"} /beta|alpha/{prerelease="true"} END{print prerelease}')" + - uses: actions/download-artifact@v3 + with: + name: jackalapi-Linux + - uses: actions/download-artifact@v3 + with: + name: jackalapi-macOS + - name: Release + uses: softprops/action-gh-release@v1 + with: + prerelease: ${{ steps.is_pre_release.outputs.IS_PRE_RELEASE }} + files: | + jackalapi-macOS + jackalapi-Linux