Skip to content

Commit

Permalink
github push
Browse files Browse the repository at this point in the history
  • Loading branch information
sambacha committed Jun 29, 2022
1 parent 000e0e3 commit c577c33
Show file tree
Hide file tree
Showing 14 changed files with 659 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: goreleaser

on:
push:
# run only against tags
tags:
- '*'

permissions:
contents: write
# packages: write
# issues: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Fetch all tags
run: git fetch --force --tags
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions .golang-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

linters:
disable-all: true
enable:
- staticcheck
- gofmt
- govet
- gosimple
- structcheck
- varcheck
- unused
- typecheck
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM golang:1.16.9

RUN apt-get update && apt-get install -y \
curl \
clang \
libsqlite3-dev \
patch \
tar \
xz-utils \
python \
python3-pip \
python-setuptools \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

RUN useradd -ms /bin/bash notary \
&& pip install codecov

ENV GO111MODULE=on

RUN go get golang.org/x/lint/golint \
github.com/client9/misspell/cmd/misspell \
github.com/gordonklaus/ineffassign \
github.com/securego/gosec/cmd/gosec/... \
github.com/fzipp/gocyclo/cmd/gocyclo


ENV GOFLAGS=-mod=vendor \
NOTARYDIR=/go/src/github.com/theupdateframework/notary

COPY . ${NOTARYDIR}
RUN chmod -R a+rw /go && chmod 0600 ${NOTARYDIR}/fixtures/database/*

WORKDIR ${NOTARYDIR}
39 changes: 39 additions & 0 deletions dappspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
project_name: dappspec
builds:
- ldflags:
- "-s -w"
- "-extldflags=-zrelro"
- "-extldflags=-znow"
env:
- "CGO_ENABLED=0"
- "GO111MODULE=on"
flags:
- -mod=readonly
- -trimpath
goos:
- linux
- darwin
- windows
goarch:
- amd64
main: ./dappspec
source:
enabled: true
changelog:
use: github
groups:
- title: "Breaking changes"
regexp: "^.*BREAKING CHANGE[(\\w)]*:+.*$"
order: 0
- title: Features
regexp: "^.*feat[(\\w)]*:+.*$"
order: 1
- title: "Bug fixes"
regexp: "^.*fix[(\\w)]*:+.*$"
order: 2
- title: Others
order: 999
release:
# If set to auto, will mark the release as not ready for production
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
prerelease: auto
6 changes: 6 additions & 0 deletions generator.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

package proto

// this file exists solely to allow us to use `go generate` to build our
// compiled GRPC interface for Go.
//go:generate protoc -I ./ ./signer.proto --go_out=plugins=grpc:.
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/sambacha/dappspec

go 1.18

require github.com/russross/blackfriday v1.6.0
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww=
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
1 change: 1 addition & 0 deletions gocco
Submodule gocco added at 626123
14 changes: 14 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"tag_name": "nightly-bfc6790f134ad56746f12e9e1c7f183add780889"
},
{
"tag_name": "nightly"
},
{
"tag_name": "nightly-6422ea7fefef8cbc00fcb00cd2576f0a99c10e08"
},
{
"tag_name": "nightly-123ad0a427dc938a0a911eae3332de6576370a51"
}
]
25 changes: 25 additions & 0 deletions scripts/check-vendored.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

set -eu -o pipefail

go mod tidy
if [ -d vendor ]; then
rm -rf vendor/
go mod vendor
fi

DIFF_PATH="vendor/ go.mod go.sum"

# shellcheck disable=SC2046
DIFF=$(git status --porcelain -- $DIFF_PATH)

if [ "$DIFF" ]; then
echo
echo "These files were modified:"
echo
echo "$DIFF"
echo
exit 1
else
echo "$DIFF_PATH is correct"
fi
7 changes: 7 additions & 0 deletions scripts/go-lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env /bash
FILES=$(git diff --cached --name-only --diff-filter=ACMR)

gofumpt -l -w .
golangci-lint run --new --fix

git add $FILES
35 changes: 35 additions & 0 deletions scripts/rel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

set -euo pipefail

GITHUB_TOKEN='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'

get_last_page() {
local url="$1"
curl -sSf -I -H "Authorization: Bearer $GITHUB_TOKEN" \
"$url" |
grep -E '^link: ' |
sed -e 's/^link:.*page=//g' -e 's/>.*$//g' || echo "1"
}

generate() {
local url="$1"
local file="$2"
last_page="$(get_last_page "$url")"
tmp="$(mktemp -d)"

for i in $(seq 1 "$last_page"); do
echo "page: $i"
curl -H "Authorization: Bearer $GITHUB_TOKEN" -sSf "$url?page=$i" | jq 'map({tag_name: .tag_name})' >"$tmp/$i.json"
done

if test "$last_page" -eq "1"; then
cp -f "$tmp"/1.json "$file"
else
jq --compact-output -s 'add' "$tmp"/*.json >"$file"
fi
du -hs "$file"
}

# www/docs/static/releases.json
generate "https://api.github.com/repos/foundry-rs/foundry/releases" "releases.json"
Loading

0 comments on commit c577c33

Please sign in to comment.