Skip to content

ci: switch to github actions #6

ci: switch to github actions

ci: switch to github actions #6

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
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_SHA}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
echo "GITHUB_SHA=${GITHUB_SHA}, GITHUB_HEAD_REF=${GITHUB_HEAD_REF}"
echo "GIT_COMMIT_SHA=${GIT_COMMIT_SHA}, GIT_BRANCH=${GIT_BRANCH}"
- 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 --debug
echo $(git rev-parse HEAD)
echo $(git branch --show-current)
echo "GITHUB_SHA=${GITHUB_SHA}, GITHUB_HEAD_REF=${GITHUB_HEAD_REF}"
echo "GIT_COMMIT_SHA=${GIT_COMMIT_SHA}, GIT_BRANCH=${GIT_BRANCH}"
- 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 $? \
--debug
echo $(git rev-parse HEAD)
echo $(git branch --show-current)
echo "GITHUB_SHA=${GITHUB_SHA}, GITHUB_HEAD_REF=${GITHUB_HEAD_REF}"
echo "GIT_COMMIT_SHA=${GIT_COMMIT_SHA}, GIT_BRANCH=${GIT_BRANCH}"