diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 29b24f0..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,70 +0,0 @@ -version: 2 -jobs: - tests: - docker: - - image: cimg/go:1.18 - - image: circleci/mongo:5.0 - name: mongo1 - - image: circleci/mongo:5.0 - name: mongo2 - - image: circleci/mongo:5.0 - name: mongo3 - steps: - - checkout - - - restore_cache: - keys: - - v1-pkg-cache - - - run: go get gotest.tools/gotestsum@v0.4.2 - - run: - name: Tests - command: | - mkdir -p /tmp/test-results - PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname) - gotestsum --junitfile /tmp/test-results/gotestsum-report.xml -- $PACKAGE_NAMES - - - save_cache: - key: v1-pkg-cache - paths: - - /go/pkg - - - store_artifacts: - path: /tmp/test-results - destination: raw-test-output - - - store_test_results: - path: /tmp/test-results - - lint: - docker: - - image: cimg/go:1.18 - steps: - - checkout - - - restore_cache: - keys: - - v1-pkg-cache - - - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/a31485fe906612b2884239fdf7c55aec76ea7596/install.sh | sh -s -- -d -b $(go env GOPATH)/bin v1.50.1 - - run: golangci-lint --version - - run: make lint - - - save_cache: - key: v1-pkg-cache - paths: - - /go/pkg - - salus: - machine: true - steps: - - checkout - - run: docker run -t -v $(pwd):/home/repo coinbase/salus - -workflows: - version: 2 - build: - jobs: - - tests - - lint - - salus diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml new file mode 100644 index 0000000..647ef98 --- /dev/null +++ b/.github/workflows/workflow.yaml @@ -0,0 +1,61 @@ +name: CI + +on: + push: + pull_request: + workflow_dispatch: + +permissions: + contents: read + pull-requests: read + checks: write + +env: + GO_VERSION: "1.18" + +jobs: + tests: + runs-on: ubuntu-latest + # running in a container enables us to use mongo{1,2,3} as a hostname + # in our tests, since we are all part of the same docker network. + # from the host, we would have to do port mappings + container: + # gh actions needs node, so use the node image + image: node + services: + mongo1: + image: mongo:5 + mongo2: + image: mongo:5 + mongo3: + image: mongo:5 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + - run: go install gotest.tools/gotestsum@latest + - run: | + REPORTDIR=$(mktemp -d) + ~/go/bin/gotestsum --junitfile $REPORTDIR/gotestsum-report.xml -- ./... + - uses: mikepenz/action-junit-report@v4 + if: success() || failure() + with: + report_paths: "$REPORTDIR/gotestsum-report.xml" + include_passed: true + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + - uses: golangci/golangci-lint-action@v6 + + salus: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: | + sudo docker run -t -v $(pwd):/home/repo coinbase/salus