Skip to content

Commit

Permalink
Merge branch 'master' into macos11-support
Browse files Browse the repository at this point in the history
  • Loading branch information
algojack authored Aug 22, 2022
2 parents bc194be + e4d6d42 commit cdbd2bd
Show file tree
Hide file tree
Showing 91 changed files with 355 additions and 389 deletions.
129 changes: 36 additions & 93 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ workflows:
version: 2
"circleci_build_and_test":
jobs:
- build:
name: << matrix.platform >>_build
- test:
name: << matrix.platform >>_test
matrix: &matrix-default
parameters:
platform: ["amd64", "arm64"]
Expand All @@ -75,8 +75,8 @@ workflows:
- /rel\/.*/
- << pipeline.parameters.valid_nightly_branch >>

- build_nightly:
name: << matrix.platform >>_build_nightly
- test_nightly:
name: << matrix.platform >>_test_nightly
matrix: &matrix-nightly
parameters:
platform: ["amd64", "arm64", "mac_amd64", "mac_arm64"]
Expand All @@ -87,64 +87,49 @@ workflows:
- << pipeline.parameters.valid_nightly_branch >>
context: slack-secrets

- test:
name: << matrix.platform >>_test
matrix:
<<: *matrix-default
requires:
- << matrix.platform >>_build

- test_nightly:
name: << matrix.platform >>_test_nightly
matrix:
<<: *matrix-nightly
requires:
- << matrix.platform >>_build_nightly
context: slack-secrets

- integration:
name: << matrix.platform >>_integration
matrix:
<<: *matrix-default
requires:
- << matrix.platform >>_build
filters:
<<: *filters-default

- integration_nightly:
name: << matrix.platform >>_integration_nightly
matrix:
<<: *matrix-nightly
requires:
- << matrix.platform >>_build_nightly
filters:
<<: *filters-nightly
context: slack-secrets

- e2e_expect:
name: << matrix.platform >>_e2e_expect
matrix:
<<: *matrix-default
requires:
- << matrix.platform >>_build
filters:
<<: *filters-default

- e2e_expect_nightly:
name: << matrix.platform >>_e2e_expect_nightly
matrix:
<<: *matrix-nightly
requires:
- << matrix.platform >>_build_nightly
filters:
<<: *filters-nightly
context: slack-secrets

- e2e_subs:
name: << matrix.platform >>_e2e_subs
matrix:
<<: *matrix-default
requires:
- << matrix.platform >>_build
filters:
<<: *filters-default

- e2e_subs_nightly:
name: << matrix.platform >>_e2e_subs_nightly
matrix:
<<: *matrix-nightly
requires:
- << matrix.platform >>_build_nightly
filters:
<<: *filters-nightly
context:
- slack-secrets
- aws-secrets
Expand Down Expand Up @@ -226,12 +211,20 @@ commands:
$msys2 pacman --sync --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-libtool unzip autoconf automake
generic_build:
description: Run basic build and store in workspace for re-use by different architectures
description: >
Run basic build.
If command execution time increases _appreciably_, revisit CI topology:
* Historically, the command executes _quickly_ (< 3m with resource class >= medium).
* Consequently, it's faster to embed the command in a combined build + test workflow rather than independent build and test workflows.
parameters:
build_dir:
type: string
default: << pipeline.parameters.build_dir >>
steps:
- prepare_build_dir
- checkout
- prepare_go
- restore_libsodium
- restore_cache:
keys:
Expand Down Expand Up @@ -260,13 +253,6 @@ commands:
key: 'go-cache-v4-{{ arch }}-{{ .Branch }}-{{ .Revision }}'
paths:
- tmp/go-cache
- persist_to_workspace:
root: << parameters.build_dir >>
paths:
- project
- go
- gimme
- .gimme

cache_libsodium:
description: Cache libsodium for build
Expand Down Expand Up @@ -313,17 +299,10 @@ commands:
type: string
default: << pipeline.parameters.result_path >>
steps:
- attach_workspace:
at: << parameters.build_dir >>
- run: |
mkdir -p << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}
touch << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/results.xml
touch << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/testresults.json
- restore_cache:
keys:
- 'go-cache-v4-{{ arch }}-{{ .Branch }}-{{ .Revision }}'
- 'go-cache-v4-{{ arch }}-{{ .Branch }}-'
- 'go-cache-v4-{{ arch }}-'
- run:
name: Run build tests
no_output_timeout: << parameters.no_output_timeout >>
Expand Down Expand Up @@ -385,8 +364,6 @@ commands:
type: string
default: << pipeline.parameters.result_path >>
steps:
- attach_workspace:
at: << parameters.build_dir >>
- run: |
mkdir -p << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}
touch << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/results.xml
Expand Down Expand Up @@ -492,33 +469,6 @@ commands:
scripts/travis/test_release.sh
jobs:
build:
parameters:
platform:
type: string
executor: << parameters.platform >>_medium
working_directory: << pipeline.parameters.build_dir >>/project
steps:
- prepare_build_dir
- checkout
- prepare_go
- generic_build

build_nightly:
parameters:
platform:
type: string
executor: << parameters.platform >>_medium
working_directory: << pipeline.parameters.build_dir >>/project
steps:
- prepare_build_dir
- checkout
- prepare_go
- generic_build
- slack/notify: &slack-fail-event
event: fail
template: basic_fail_1

test:
parameters:
platform:
Expand All @@ -527,8 +477,7 @@ jobs:
working_directory: << pipeline.parameters.build_dir >>/project
parallelism: 4
steps:
- prepare_build_dir
- prepare_go
- generic_build
- generic_test:
platform: << parameters.platform >>
result_subdir: << parameters.platform >>_test
Expand All @@ -543,15 +492,15 @@ jobs:
working_directory: << pipeline.parameters.build_dir >>/project
parallelism: 4
steps:
- prepare_build_dir
- prepare_go
- generic_build
- generic_test:
platform: << parameters.platform >>
result_subdir: << parameters.platform >>_test_nightly
no_output_timeout: 45m
- upload_coverage
- slack/notify:
<<: *slack-fail-event
- slack/notify: &slack-fail-event
event: fail
template: basic_fail_1

integration:
parameters:
Expand All @@ -563,8 +512,7 @@ jobs:
environment:
E2E_TEST_FILTER: "GO"
steps:
- prepare_build_dir
- prepare_go
- generic_build
- generic_integration:
platform: << parameters.platform >>
result_subdir: << parameters.platform >>_integration
Expand All @@ -580,8 +528,7 @@ jobs:
environment:
E2E_TEST_FILTER: "GO"
steps:
- prepare_build_dir
- prepare_go
- generic_build
- generic_integration:
platform: << parameters.platform >>
result_subdir: << parameters.platform >>_integration_nightly
Expand All @@ -599,8 +546,7 @@ jobs:
environment:
E2E_TEST_FILTER: "EXPECT"
steps:
- prepare_build_dir
- prepare_go
- generic_build
- generic_integration:
platform: << parameters.platform >>
result_subdir: << parameters.platform >>_e2e_expect
Expand All @@ -616,8 +562,7 @@ jobs:
environment:
E2E_TEST_FILTER: "EXPECT"
steps:
- prepare_build_dir
- prepare_go
- generic_build
- generic_integration:
platform: << parameters.platform >>
result_subdir: << parameters.platform>>_e2e_expect_nightly
Expand All @@ -634,8 +579,7 @@ jobs:
environment:
E2E_TEST_FILTER: "SCRIPTS"
steps:
- prepare_build_dir
- prepare_go
- generic_build
- generic_integration:
platform: << parameters.platform >>
result_subdir: << parameters.platform >>_e2e_subs
Expand All @@ -654,8 +598,7 @@ jobs:
# one of the platforms in the matrix.
CI_KEEP_TEMP_PLATFORM: "amd64"
steps:
- prepare_build_dir
- prepare_go
- generic_build
- generic_integration:
platform: << parameters.platform >>
result_subdir: << parameters.platform >>_e2e_subs_nightly
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: reviewdog-golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
golangci_lint_version: "v1.41.1"
golangci_lint_version: "v1.47.3"
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
reporter: "github-pr-check"
tool_name: "Lint Errors"
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
run: |
cd cicdtmp/golangci-lint
git clone https://github.com/golangci/golangci-lint.git .
git checkout tags/v1.41.1
git checkout tags/v1.47.3
CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint
./golangci-lint-cgo --version
cd ../../
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fix: build
$(GOPATH1)/bin/algofix */

lint: deps
$(GOPATH1)/bin/golint ./...
$(GOPATH1)/bin/golangci-lint run -c .golangci.yml

vet:
go vet ./...
Expand Down
3 changes: 1 addition & 2 deletions agreement/fuzzer/tests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"math"
"math/rand"
Expand Down Expand Up @@ -440,7 +439,7 @@ func TestFuzzer(t *testing.T) {
t.Run(testName, func(t *testing.T) {
partitiontest.PartitionTest(t) // Check if this expect test should by run, may SKIP
jsonFilename := jsonFiles[testName]
jsonBytes, err := ioutil.ReadFile(jsonFilename)
jsonBytes, err := os.ReadFile(jsonFilename)
require.NoError(t, err)
var fuzzerTest FuzzerTestFile
err = json.Unmarshal(jsonBytes, &fuzzerTest)
Expand Down
3 changes: 1 addition & 2 deletions cmd/algod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package main
import (
"flag"
"fmt"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
Expand Down Expand Up @@ -119,7 +118,7 @@ func run() int {
}

// Load genesis
genesisText, err := ioutil.ReadFile(genesisPath)
genesisText, err := os.ReadFile(genesisPath)
if err != nil {
fmt.Fprintf(os.Stderr, "Cannot read genesis file %s: %v\n", genesisPath, err)
return 1
Expand Down
5 changes: 2 additions & 3 deletions cmd/algod/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package main

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -30,15 +29,15 @@ import (

func BenchmarkAlgodStartup(b *testing.B) {
tmpDir := b.TempDir()
genesisFile, err := ioutil.ReadFile("../../installer/genesis/devnet/genesis.json")
genesisFile, err := os.ReadFile("../../installer/genesis/devnet/genesis.json")
require.NoError(b, err)

dataDirectory = &tmpDir
bInitAndExit := true
initAndExit = &bInitAndExit
b.StartTimer()
for n := 0; n < b.N; n++ {
err := ioutil.WriteFile(filepath.Join(tmpDir, config.GenesisJSONFile), genesisFile, 0766)
err := os.WriteFile(filepath.Join(tmpDir, config.GenesisJSONFile), genesisFile, 0766)
require.NoError(b, err)
fmt.Printf("file %s was written\n", filepath.Join(tmpDir, config.GenesisJSONFile))
run()
Expand Down
Loading

0 comments on commit cdbd2bd

Please sign in to comment.