Skip to content

Commit f436cf3

Browse files
matttjakecoffmandeivid-rodriguezjurre
committed
Initial commit
Co-authored-by: Jake Coffman <jakecoffman@github.com> Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net> Co-authored-by: Jurre Stender <jurre@github.com>
0 parents  commit f436cf3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3996
-0
lines changed

.github/SECURITY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
If you discover a security issue in this repository,
2+
please submit it through the [GitHub Security Bug Bounty](https://hackerone.com/github).
3+
4+
Thanks for helping make GitHub safe for everyone.

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/" # Location of package manifests
5+
schedule:
6+
interval: "weekly"

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI Build + Unit Test
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v3
17+
with:
18+
go-version: 1.19
19+
20+
- name: Build
21+
run: go build -v ./...
22+
23+
- name: Test
24+
run: go test -v ./...
25+
26+
lint:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v3
30+
31+
- name: Set up Go
32+
uses: actions/setup-go@v3
33+
with:
34+
go-version: 1.19
35+
36+
- name: Run golangci-lint
37+
uses: golangci/golangci-lint-action@v3
38+
with:
39+
version: v1.49
40+
41+
- name: Run shellcheck
42+
run: shellcheck **/*.sh
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "main" ]
20+
schedule:
21+
- cron: '22 17 * * 1'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'go' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v3
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v2
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
52+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53+
# queries: security-extended,security-and-quality
54+
55+
56+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57+
# If this step fails, then you should remove it and run the build manually (see below)
58+
- name: Autobuild
59+
uses: github/codeql-action/autobuild@v2
60+
61+
# ℹ️ Command-line programs to run using the OS shell.
62+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63+
64+
# If the Autobuild fails above, remove it and uncomment the following three lines.
65+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66+
67+
# - run: |
68+
# echo "Run, Build Application using script"
69+
# ./location_of_script_within_repo/buildscript.sh
70+
71+
- name: Perform CodeQL Analysis
72+
uses: github/codeql-action/analyze@v2

.github/workflows/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release binary builder
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
releases-matrix:
9+
name: Release Go Binary
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
goos: [linux, windows, darwin]
14+
goarch: ["386", amd64, arm64]
15+
exclude:
16+
- goarch: "386"
17+
goos: darwin
18+
- goarch: arm64
19+
goos: windows
20+
steps:
21+
- uses: actions/checkout@v3
22+
- uses: wangyoucao577/go-release-action@v1.29
23+
with:
24+
goversion: 1.19
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
goos: ${{ matrix.goos }}
27+
goarch: ${{ matrix.goarch }}
28+
binary_name: dependabot
29+
project_path: cmd/dependabot
30+
ldflags: >-
31+
-X github.com/dependabot/cli/cmd/dependabot/internal/cmd.version=${{ github.event.release.tag_name }}

.github/workflows/smoke.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Runs all ecosystems cached and concurrently.
2+
name: Smoke
3+
4+
on:
5+
workflow_dispatch:
6+
pull_request:
7+
branches: ["main"]
8+
9+
env:
10+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11+
12+
jobs:
13+
smoke:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
suite:
19+
- actions
20+
- bundler
21+
- cargo
22+
- composer
23+
- docker
24+
- elm
25+
- go
26+
- gradle
27+
- hex
28+
- maven
29+
- npm
30+
- nuget
31+
- pip
32+
- pip-compile
33+
- pipenv
34+
- poetry
35+
- pub
36+
- submodules
37+
- terraform
38+
steps:
39+
- uses: actions/checkout@v3
40+
41+
- name: Set up Go
42+
uses: actions/setup-go@v3
43+
with:
44+
go-version: 1.19
45+
46+
# Download the Proxy cache. The job is ideally 100% cached so no real calls are made.
47+
- name: Download artifacts
48+
run: script/download-cache.sh ${{ matrix.suite }}
49+
50+
- name: ${{ matrix.suite }}
51+
env:
52+
LOCAL_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
run: |
54+
set -o pipefail
55+
URL=https://api.github.com/repos/dependabot/smoke-tests/contents/tests/smoke-${{ matrix.suite }}.yaml
56+
curl $(gh api $URL --jq .download_url) -o smoke.yaml
57+
go run cmd/dependabot/dependabot.go test -f=smoke.yaml -o=result.yaml --timeout 20m --cache=cache 2>&1 | tee -a log.txt
58+
59+
- name: Diff
60+
if: always()
61+
continue-on-error: true
62+
run: diff --ignore-space-change smoke.yaml result.yaml && echo "Contents are identical" || exit 0
63+
64+
- name: Create summary
65+
run: tail -n100 log.txt | grep -P '\d+/\d+ calls cached \(\d+%\)' >> $GITHUB_STEP_SUMMARY
66+
67+
# No upload at the end:
68+
# - If a test is uncachable in some regard, the cache would grow unbound.
69+
# - We might want to consider erroring if the cache is changed.
70+
71+
# Allows us to add a check requirement on allsmoke which covers all in the matrix above
72+
allsmoke:
73+
if: ${{ always() }}
74+
runs-on: ubuntu-latest
75+
name: Smoke result
76+
needs: smoke
77+
steps:
78+
- name: Echo needs
79+
run: echo "${{ toJSON(needs) }}" # for debugging
80+
- name: Check success
81+
run: |
82+
if [ "${{ needs.smoke.result }}" = "success" ]; then
83+
exit 0
84+
else
85+
exit 1
86+
fi

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tmp
2+
testdata/caches
3+
cache

.golangci.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
run:
2+
tests: true
3+
skip-dirs:
4+
- test-updater
5+
6+
linters:
7+
enable:
8+
- depguard
9+
- errcheck
10+
- exportloopref
11+
- gocritic
12+
- gocyclo
13+
- gofmt
14+
- goimports
15+
- gosec
16+
- gosimple
17+
- govet
18+
- ineffassign
19+
- misspell
20+
- nakedret
21+
- prealloc
22+
- revive
23+
- staticcheck
24+
- typecheck
25+
- unconvert
26+
- unused
27+
disable:
28+
- gochecknoglobals # we allow global variables in packages
29+
- gochecknoinits # we allow inits in packages
30+
- goconst # we allow repeated values to go un-const'd
31+
- lll # we allow any line length
32+
- structcheck # structcheck is disabled because of go1.18
33+
- unparam # we allow function calls to name unused parameters
34+
35+
linters-settings:
36+
errcheck:
37+
check-type-assertions: true
38+
goconst:
39+
min-len: 2
40+
min-occurrences: 3
41+
gocritic:
42+
enabled-tags:
43+
- diagnostic
44+
- experimental
45+
- opinionated
46+
- performance
47+
- style
48+
disabled-checks:
49+
- hugeParam
50+
- octalLiteral
51+
- singleCaseSwitch
52+
govet:
53+
check-shadowing: true
54+
nolintlint:
55+
require-explanation: true
56+
require-specific: true
57+
58+
issues:
59+
exclude-rules:
60+
- path: internal/infra/proxy.go
61+
text: "G306: Expect WriteFile permissions to be 0600 or less"

Brewfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Usage:
2+
# $ brew bundle
3+
4+
tap 'homebrew/core'
5+
6+
brew 'go'
7+
8+
tap 'golangci/tap'
9+
brew 'golangci-lint'

0 commit comments

Comments
 (0)