From 50ce73d67de472442f12338338319419cab531da Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Thu, 28 Mar 2024 11:07:55 -0600 Subject: [PATCH] Update .travis.yml --- .travis.yml | 76 +++++++++++++++++++++++++++++++++++---------- ci/after_success.sh | 17 ---------- ci/build.sh | 18 ----------- ci/install.sh | 12 ------- ci/test.sh | 31 ------------------ 5 files changed, 59 insertions(+), 95 deletions(-) delete mode 100755 ci/after_success.sh delete mode 100755 ci/build.sh delete mode 100755 ci/install.sh delete mode 100755 ci/test.sh diff --git a/.travis.yml b/.travis.yml index 8b932c8..2cccd6d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,31 +1,73 @@ language: go go: -- 1.20.x + - 1.20.x addons: apt: + update: true packages: - - ruby-full - update: true + - ruby jobs: include: - - os: linux - dist: focal - - os: linux - dist: focal - env: - - BUILD_DOCKER=1 + - name: "Coverage" + os: linux + dist: jammy + install: + - sudo gem install coveralls-lcov + - go install github.com/jandelgado/gcov2lcov@latest + - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2 + - go get ./... + script: + - go build -ldflags="-X main.Commit=$(git rev-parse HEAD)" cmd/koinos-p2p/main.go + - go test -v github.com/koinos/koinos-p2p/internal -coverprofile=internal.out -coverpkg=./internal/... + - go test -v github.com/koinos/koinos-p2p/internal/node -coverprofile=node.out -coverpkg=./internal/... + - go test -v github.com/koinos/koinos-p2p/internal/p2p -coverprofile=p2p.out -coverpkg=./internal/... + - gcov2lcov -infile=internal.out -outfile=internal.info + - gcov2lcov -infile=node.out -outfile=node.info + - gcov2lcov -infile=p2p.out -outfile=p2p.info + - golangci-lint run ./... + after_success: + - coveralls-lcov --repo-token "$COVERALLS_REPO_TOKEN" --service-name travis-pro coverage.info -install: -- source ci/install.sh - -script: -- ci/build.sh && ci/test.sh - -after_success: -- ci/after_success.sh + - name: "Docker and Integration Tests" + os: linux + dist: jammy + services: + - docker + env: + - TAG=`if [ $TRAVIS_BRANCH == "master" ]; then echo -n latest; else echo -n $TRAVIS_BRANCH; fi` + - CHAIN_TAG=$TAG + before_install: + - sudo systemctl stop docker.service && sudo systemctl stop docker.socket + - sudo apt-get install ca-certificates curl + - sudo install -m 0755 -d /etc/apt/keyrings + - sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc + - sudo chmod a+r /etc/apt/keyrings/docker.asc + - | + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + - sudo apt-get update + install: + - sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + - git clone https://github.com/koinos/koinos-integration-tests.git + - pushd koinos-integration-tests + - go get ./... + - popd + before_script: + - echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin + - docker build . -t $TRAVIS_REPO_SLUG:$TAG + script: + - pushd koinos-integration-tests + - ./run.sh + after_success: + - | + if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then + docker push $TRAVIS_REPO_SLUG:$TAG + fi notifications: slack: diff --git a/ci/after_success.sh b/ci/after_success.sh deleted file mode 100755 index 177b2cd..0000000 --- a/ci/after_success.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -if [[ -z $BUILD_DOCKER ]]; then - coveralls-lcov --repo-token "$COVERALLS_REPO_TOKEN" --service-name travis-pro ./build/merged.info -else - if [ "$TRAVIS_PULL_REQUEST_BRANCH" != "" ]; then - exit 0 - fi - - TAG="$TRAVIS_BRANCH" - if [ "$TAG" = "master" ]; then - TAG="latest" - fi - - echo "$DOCKER_PASSWORD" | docker login -u $DOCKER_USERNAME --password-stdin - docker push koinos/koinos-p2p:$TAG -fi diff --git a/ci/build.sh b/ci/build.sh deleted file mode 100755 index 7a884c4..0000000 --- a/ci/build.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -e -set -x - -if [[ -z $BUILD_DOCKER ]]; then - go get ./... - mkdir -p build - go build -ldflags="-X main.Commit=$(git rev-parse HEAD)" -o build/koinos_p2p cmd/koinos-p2p/main.go -else - TAG="$TRAVIS_BRANCH" - if [ "$TAG" = "master" ]; then - TAG="latest" - fi - - echo "$DOCKER_PASSWORD" | docker login -u $DOCKER_USERNAME --password-stdin - docker build . -t koinos/koinos-p2p:$TAG -fi diff --git a/ci/install.sh b/ci/install.sh deleted file mode 100755 index 226c422..0000000 --- a/ci/install.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -if [[ -z $BUILD_DOCKER ]]; then - sudo apt-get install -y lcov ruby - sudo gem install coveralls-lcov - go install github.com/jandelgado/gcov2lcov@latest - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2 -else - sudo curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose - sudo chmod +x /usr/local/bin/docker-compose - docker-compose --version -fi diff --git a/ci/test.sh b/ci/test.sh deleted file mode 100755 index cb1ccda..0000000 --- a/ci/test.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -set -e -set -x - -if [[ -z $BUILD_DOCKER ]]; then - go test -v github.com/koinos/koinos-p2p/internal -coverprofile=./build/internal.out -coverpkg=./internal/... - go test -v github.com/koinos/koinos-p2p/internal/node -coverprofile=./build/node.out -coverpkg=./internal/... - go test -v github.com/koinos/koinos-p2p/internal/p2p -coverprofile=./build/p2p.out -coverpkg=./internal/... - - gcov2lcov -infile=./build/internal.out -outfile=./build/internal.info - gcov2lcov -infile=./build/node.out -outfile=./build/node.info - gcov2lcov -infile=./build/p2p.out -outfile=./build/p2p.info - - lcov -a ./build/internal.info -a ./build/node.info -a ./build/p2p.info -o ./build/merged.info - - golangci-lint run ./... -else - TAG="$TRAVIS_BRANCH" - if [ "$TAG" = "master" ]; then - TAG="latest" - fi - - export P2P_TAG=$TAG - - git clone https://github.com/koinos/koinos-integration-tests.git - - cd koinos-integration-tests - go get ./... - ./run.sh -fi