From 49f1469f8e65ce236f7d2d305055915766add40a Mon Sep 17 00:00:00 2001 From: Naoki Kosaka Date: Wed, 1 Jan 2020 01:01:51 +0900 Subject: [PATCH] Replace CircleCI to GitHub Actions v2. --- .circleci/config.yml | 46 -------------------------------------- .github/workflows/main.yml | 34 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 46 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/main.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index c24a92e..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,46 +0,0 @@ -version: 2 -jobs: - test: - docker: - - image: circleci/golang - environment: - REDIS_URL: redis://localhost:6379/0 - - image: redis:alpine - steps: - - checkout - - run: - name: build - command: | - go version - go test -coverprofile=coverage.txt -covermode=atomic -p 1 . ./worker ./cli ./State - bash <(curl -s https://codecov.io/bash) - docker: - docker: - - image: docker:git - steps: - - checkout - - setup_remote_docker - - run: - name: build docker image - command: | - docker build -t ${DOCKER_USER}/activity-relay:edge . - docker tag ${DOCKER_USER}/activity-relay:edge ${DOCKER_USER}/activity-relay:$(echo ${CIRCLE_SHA1}|head -c7) - - run: - name: upload image to docker hub. - command: | - docker login --username=${DOCKER_USER} --password=${DOCKER_PASS} - docker push ${DOCKER_USER}/activity-relay:edge - docker push ${DOCKER_USER}/activity-relay:$(echo ${CIRCLE_SHA1}|head -c7) - -workflows: - version: 2 - build: - jobs: - - test - - docker: - requires: - - test - filters: - branches: - only: - - master diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..cc7b47c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,34 @@ +name: Test and Build +on: [push] + +jobs: + go-test: + name: Test and Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: actions/setup-go@v1 + with: + go-version: '1.13.x' + - name: Execute test and upload coverage + run: | + go version + go test -coverprofile=coverage.txt -covermode=atomic -p 1 . ./worker ./cli ./State + bash <(curl -s https://codecov.io/bash) + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + REDIS_URL: redis://localhost:${{ job.services.redis.ports['6379'] }} + - name: Build Docker Images + run: | + docker build -t ${{ secrets.REGISTORY_USER }}/activity-relay:edge . + docker tag ${{ secrets.REGISTORY_USER }}/activity-relay:edge ${{ secrets.REGISTORY_USER }}/activity-relay:$(echo ${GITHUB_SHA}|head -c7) + - name: Push Docker Images to DockerHub + run: | + docker login -u ${{ secrets.REGISTORY_USER }} -p ${{ secrets.REGISTORY_PASS }} + docker push ${{ secrets.REGISTORY_USER }}/activity-relay:edge + docker push ${{ secrets.REGISTORY_USER }}/activity-relay:$(echo ${GITHUB_SHA}|head -c7) + services: + redis: + image: redis + ports: + - 6379/tcp