diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 7a75ac5..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,54 +0,0 @@ -version: 2.1 - -#orbs: -# go: circleci/go@1.11.0 - -jobs: - test: - docker: - - image: cimg/go:1.20.13 - environment: - TEST_RESULTS_DIR: /tmp/test-results - steps: - - checkout - - run: mkdir -p ${TEST_RESULTS_DIR} - - restore_cache: - keys: - - go-mod-v4-{{ checksum "go.sum" }} - - cc-test-reporter-v1{{ checksum "cc-test-reporter" }} - - run: - name: Install Dependencies - command: go get -t -v ./... - - run: - name: Setup Code Climate test-reporter - command: | - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - chmod +x ./cc-test-reporter - - save_cache: - key: go-mod-v4-{{ checksum "go.sum" }} - paths: - - "/go/pkg/mod" - - run: - name: Run tests - command: | - ./cc-test-reporter before-build - gotestsum \ - --junitfile ${TEST_RESULTS_DIR}/gotestsum-report.xml \ - -- \ - -failfast \ - -covermode=atomic \ - -coverprofile=c.out \ - ./... - ./cc-test-reporter after-build --prefix=waku-poker-planning --exit-code $? - - - store_artifacts: - path: /tmp/test-results - destination: raw-test-output - - - store_test_results: - path: /tmp/test-results - -workflows: - main: - jobs: - - test \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..51aa425 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: ci + +on: + push: + branches: [ "main" ] + pull_request: + +jobs: + + test: + runs-on: ubuntu-latest + steps: + - name: Set environment variables + run: | + echo "GIT_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_ENV" + echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> "$GITHUB_ENV" + + - name: Setup Code Climate test-reporter + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter + chmod +x /tmp/cc-test-reporter + /tmp/cc-test-reporter before-build + + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.20' + + - name: Setup gotestsum + uses: autero1/action-gotestsum@v2.0.0 + with: + gotestsum_version: 1.11.0 + + - name: Build + run: go build -v ./... + + - name: Test + run: | + mkdir -p /tmp/test-results + gotestsum \ + --junitfile /tmp/test-results/gotestsum-report.xml \ + -- \ + -failfast \ + -covermode atomic \ + -coverprofile c.out \ + ./... + /tmp/cc-test-reporter after-build \ + --id ${{ secrets.CC_TEST_REPORTER_ID }} \ + --prefix waku-poker-planning \ + --exit-code $? \ No newline at end of file