Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/crypto deps #832

Merged
merged 12 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Breaking Changes:
"@Minor-Release":
- "go.mod"
- "go.sum"
- "crypto/**"
- Earthfile
- ".github/**"

Expand Down
53 changes: 5 additions & 48 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: New Pull Request -> Lint, Test, Analyze

on:
pull_request:
types: [opened, reopened, synchronize]
types: [opened, reopened, synchronize, labeled, edited]

permissions:
contents: read
Expand All @@ -11,7 +11,7 @@ permissions:
issues: write

jobs:
lint-protos:
validate-protos:
runs-on: ubuntu-latest
env:
EARTHLY_TOKEN: ${{ secrets.EARTHLY_TOKEN }}
Expand All @@ -25,7 +25,6 @@ jobs:
with:
version: v0.7.10
- uses: actions/checkout@v4
- run: task lint

run-tests:
runs-on: ubuntu-latest
Expand All @@ -43,51 +42,9 @@ jobs:
- uses: actions/checkout@v4
- run: task tests

codeql-analysis:
name: Run CodeQL Analysis
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["go", "typescript"]
queries: ['crypto-com/cosmos-sdk-codeql@v0.0.7']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

test-coverage:
name: Scan/Upload Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_PAT }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

analyze-pull:
runs-on: ubuntu-latest
needs: [lint-protos]
needs: [validate-protos]
env:
EARTHLY_TOKEN: ${{ secrets.EARTHLY_TOKEN }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -96,7 +53,7 @@ jobs:
PR_NUMBER: ${{ github.event.number }}
steps:
- uses: actions/checkout@v4
- uses: actions/labeler@v5
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GH_ACTIONS_PAT }}"
- uses: jefflinse/pr-semver-bump@v1.6.0
Expand All @@ -116,7 +73,7 @@ jobs:

add-to-merge-queue:
runs-on: ubuntu-latest
needs: [run-tests, analyze-pull, codeql-analysis, test-coverage]
needs: [run-tests, analyze-pull]
env:
EARTHLY_TOKEN: ${{ secrets.EARTHLY_TOKEN }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
Expand Down
23 changes: 1 addition & 22 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,6 @@ jobs:
old-version: ${{ steps.pr-semver-bump.outputs.old-version }}
skipped: ${{ steps.pr-semver-bump.outputs.skipped }}

run-goreleaser:
if: needs.bump-tag.outputs.skipped == false
runs-on: ubuntu-latest
needs: [bump-tag]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Run only on tag
- uses: actions/setup-go@v4
with:
go-version: stable
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-images:
if: needs.bump-tag.outputs.skipped == false
runs-on: ubuntu-latest
Expand All @@ -77,4 +56,4 @@ jobs:
with:
version: v0.7.10
- uses: actions/checkout@v4

- run: task publish
3 changes: 0 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
"**/.trunk/*logs/": true,
"**/.trunk/*plugins/": true,
"**/node_modules": true,
"go.work": true,
"go.sum": true,
"go.work.sum": true,
"**/CODE_OF_CONDUCT.md": true,
"**/codecov.yml": true,
"**/SECURITY.md": true,
Expand Down
22 changes: 10 additions & 12 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,24 @@ RUN apk add --update --no-cache \
openssl \
util-linux

WORKDIR /sonr
# repo - Creates repository container environment
repo:
FROM +base
ARG EARTHLY_GIT_BRANCH

# setup - clones all repositories
setup:
LOCALLY
GIT CLONE git@github.com:sonrhq/chain.git chain
GIT CLONE git@github.com:sonrhq/identity.git identity
GIT CLONE git@github.com:sonrhq/service.git service
GIT CLONE git@github.com:sonrhq/rails.git rails
GIT CLONE --branch $EARTHLY_GIT_BRANCH git@github.com:sonrhq/sonr.git sonr
CACHE --sharing shared sonr
WORKDIR /sonr

# gomod - downloads and caches all dependencies for earthly. go.mod and go.sum will be updated locally.
gomod:
FROM +base
COPY ./go.mod ./go.sum ./
RUN go mod download
CACHE --sharing shared /go/pkg/mod

SAVE ARTIFACT go.mod AS LOCAL go.mod
SAVE ARTIFACT go.sum AS LOCAL go.sum

# test - runs all tests
test:
FROM +gomod
FROM +repo
COPY . .
RUN go test -v ./...
24 changes: 16 additions & 8 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,37 @@ tasks:

init:
cmds:
- earthly --no-sat +setup
- earthly --no-sat +repo

build:
deps:
- init
cmds:
- earthly sat wake builder
- earthly --sat=builder --org=sonrhq ./chain+build
- earthly --sat=builder --org=sonrhq ./rails+build
- earthly --sat=builder --org=sonrhq github.com/sonrhq/chain+build
- earthly --sat=builder --org=sonrhq github.com/sonrhq/rails+build

tests:
deps:
- init
cmds:
- earthly sat wake tester
- earthly --sat=tester --org=sonrhq ./identity+test
- earthly --sat=tester --org=sonrhq ./service+test
- earthly --sat=tester --org=sonrhq ./chain+test
- earthly --sat=tester --org=sonrhq github.com/sonrhq/identity+test
- earthly --sat=tester --org=sonrhq github.com/sonrhq/service+test
- earthly --sat=tester --org=sonrhq github.com/sonrhq/chain+test

lint:
deps:
- init
cmds:
- earthly sat wake linter
- earthly --sat=linter --org=sonrhq ./identity+lint
- earthly --sat=linter --org=sonrhq ./service+lint
- earthly --sat=linter --org=sonrhq github.com/sonrhq/identity+lint
- earthly --sat=linter --org=sonrhq github.com/sonrhq/service+lint

publish:
deps:
- init
cmds:
- earthly sat wake builder
- earthly --sat=builder --org=sonrhq github.com/sonrhq/chain+build --push
- earthly --sat=builder --org=sonrhq github.com/sonrhq/rails+build --push
6 changes: 3 additions & 3 deletions crypto/core/curves/ec_point.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
"fmt"
"math/big"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"

"github.com/sonrhq/sonr/crypto/internal"
"github.com/sonrhq/sonr/crypto/core"
"github.com/sonrhq/sonr/crypto/core"
"github.com/sonrhq/sonr/crypto/internal"
)

var curveNameToId = map[string]byte{
Expand Down
2 changes: 1 addition & 1 deletion crypto/core/curves/ec_point_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"math/big"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/stretchr/testify/require"

"github.com/sonrhq/sonr/crypto/core"
Expand Down
2 changes: 1 addition & 1 deletion crypto/core/curves/ec_scalar.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"math/big"

"filippo.io/edwards25519"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/bwesterb/go-ristretto"

"github.com/sonrhq/sonr/crypto/internal"
Expand Down
2 changes: 1 addition & 1 deletion crypto/core/curves/k256_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"math/big"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"

mod "github.com/sonrhq/sonr/crypto/core"
"github.com/sonrhq/sonr/crypto/internal"
Expand Down
2 changes: 1 addition & 1 deletion crypto/core/curves/k256_curve.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"math/big"
"sync"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"

"github.com/sonrhq/sonr/crypto/core/curves/native"
secp256k1 "github.com/sonrhq/sonr/crypto/core/curves/native/k256"
Expand Down
2 changes: 1 addition & 1 deletion crypto/core/curves/k256_curve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"sync"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion crypto/core/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"math"
"math/big"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"golang.org/x/crypto/hkdf"

"github.com/sonrhq/sonr/crypto/internal"
Expand Down
2 changes: 1 addition & 1 deletion crypto/dkg/gennaro/participant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"math/big"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/stretchr/testify/require"

"github.com/sonrhq/sonr/crypto/core/curves"
Expand Down
2 changes: 1 addition & 1 deletion crypto/dkg/gennaro/rounds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"fmt"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/stretchr/testify/require"

"github.com/sonrhq/sonr/crypto/core/curves"
Expand Down
2 changes: 1 addition & 1 deletion crypto/dkg/gennaro2p/genarro2p_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"reflect"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/stretchr/testify/require"

"github.com/sonrhq/sonr/crypto/core/curves"
Expand Down
2 changes: 1 addition & 1 deletion crypto/paillier/psf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"math/big"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/stretchr/testify/require"

crypto "github.com/sonrhq/sonr/crypto/core"
Expand Down
2 changes: 1 addition & 1 deletion crypto/sharing/v1/k256_feldman_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"math/big"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion crypto/sharing/v1/k256_pedersen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"math/big"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/stretchr/testify/require"

core "github.com/sonrhq/sonr/crypto/core/curves"
Expand Down
2 changes: 1 addition & 1 deletion crypto/tecdsa/gg20/dealer/dealer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"math/big"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/stretchr/testify/require"

"github.com/sonrhq/sonr/crypto/core/curves"
Expand Down
Loading
Loading