Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github actions #1467

Merged
merged 39 commits into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d73da60
migrate lint and unit tests
vedhavyas Mar 1, 2021
f4c69f4
update workflow
vedhavyas Mar 1, 2021
b579a7f
seperate workflows and install subkey
vedhavyas Mar 1, 2021
d2c961b
fix env ref
vedhavyas Mar 1, 2021
53a2a3c
migrate cmd tests
vedhavyas Mar 1, 2021
1f9db2b
use matrix
vedhavyas Mar 1, 2021
5f955cf
use matrix
vedhavyas Mar 1, 2021
dbdb732
migrate integration tests
vedhavyas Mar 1, 2021
d3dc751
migrate testworld
vedhavyas Mar 1, 2021
99acd5a
ensure pullrequest and push wont trigger multiple times
vedhavyas Mar 1, 2021
76e6b85
use explicit ubuntu version
vedhavyas Mar 1, 2021
8dc0b8f
add debug line
vedhavyas Mar 1, 2021
277bc6a
enable logging
vedhavyas Mar 1, 2021
f0101a3
upgrade gocelery
vedhavyas Mar 2, 2021
35fb4d6
rewrite notifications tests
vedhavyas Mar 2, 2021
1c529d1
set debug writer
vedhavyas Mar 2, 2021
d3a90bf
add caching
vedhavyas Mar 2, 2021
f147171
use compact printer
vedhavyas Mar 2, 2021
43a4a03
ensure distinct cache keys
vedhavyas Mar 2, 2021
4928ec6
faster unit tests?
vedhavyas Mar 2, 2021
4f754db
more cache optimisations
vedhavyas Mar 2, 2021
14f96e8
rename to checks
vedhavyas Mar 2, 2021
a799313
test build
vedhavyas Mar 3, 2021
bcafc2c
revert build workflow tests
vedhavyas Mar 3, 2021
b9ac9c3
update build flow with docker details
vedhavyas Mar 3, 2021
570481b
remove travis.yml and xgo
vedhavyas Mar 4, 2021
ac97674
add more os
vedhavyas Mar 4, 2021
45ecad3
not ready for windows test runner yet
vedhavyas Mar 4, 2021
7f60aa6
accomodate nix installation for darwin
vedhavyas Mar 4, 2021
b9d4752
remove mac as well
vedhavyas Mar 4, 2021
8bb619c
add release
vedhavyas Mar 5, 2021
ce5182f
update release
vedhavyas Mar 5, 2021
7e200bf
build with tag
vedhavyas Mar 5, 2021
1341308
on release
vedhavyas Mar 5, 2021
f964809
add stack.go to uncovered
vedhavyas Mar 5, 2021
a3be669
use a different releaser
vedhavyas Mar 5, 2021
9a6c31c
minor changes
vedhavyas Mar 5, 2021
adee027
use github sha
vedhavyas Mar 5, 2021
c811a39
release changes
vedhavyas Mar 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# build workflow builds docker images, pushes images to docker hub and updates swagger API
on:
push:
branches: [develop, master]
name: Build
jobs:
build:
strategy:
matrix:
go-version: [1.15.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
env:
GOPATH: ${{ github.workspace }}
SWAGGER_API_KEY: ${{ secrets.swagger_api_key }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are these secrets configured?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github secrets. they are decrypted transparently only pushed to develop or master

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they should be present under project settings

DOCKER_USERNAME: ${{ secrets.docker_username }}
DOCKER_PASSWORD: ${{ secrets.docker_password }}
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Check out code
uses: actions/checkout@v2
with:
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
fetch-depth: 0
- uses: actions/cache@v2
with:
path: ${{ env.GOPATH }}/pkg/mod
key: ${{ runner.os }}-go-${{ github.job }}
- name: Build docker images
run: make build-docker
- name: Push images to Docker Hub
run: make push-to-docker
- name: Push API to swagger
run: make push-to-swagger
39 changes: 39 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# lint workflow runs golangci-lint, re generate swagger api and checks for any diffs
on:
push:
branches: [develop, master]
pull_request:
name: Checks
jobs:
lint:
name: lint check
strategy:
matrix:
go-version: [1.15.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
env:
GOPATH: ${{ github.workspace }}
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Check out code
uses: actions/checkout@v2
with:
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
- uses: actions/cache@v2
with:
path: ${{ env.GOPATH }}/pkg/mod
key: ${{ runner.os }}-go-${{ github.job }}
- name: Install dependencies
run: |
make install-deps
- name: Lint check
run: |
make lint-check gen-swagger
echo "Checking that swagger gen didn't result in a modified git tree" && git diff --exit-code ./http
83 changes: 83 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# release workflow gets triggered when a tag is pushed
# build job builds artifacts on different os and uploads them to a temporary location
# release job pulls the artifacts down, creates a changelog and creates a new draft release
on:
push:
tags:
- 'v*.*.*'
name: Release
jobs:
build:
strategy:
matrix:
go-version: [1.15.x]
os: [ubuntu-latest, macos-latest]
arch: [amd64]
runs-on: ${{ matrix.os }}
env:
GOPATH: ${{ github.workspace }}
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Check out code
uses: actions/checkout@v2
with:
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
fetch-depth: 0
- uses: actions/cache@v2
with:
path: ${{ env.GOPATH }}/pkg/mod
key: ${{ runner.os }}-go-${{ github.job }}-${{ matrix.arch }}
- name: Build ${{ matrix.os }}-${{ matrix.arch }} binary
run: arch=${{ matrix.arch }} make build-binary
- uses: actions/upload-artifact@v2
with:
name: ${{ github.sha }}-artifacts
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}/*.tar.gz
if-no-files-found: error
release:
needs: build
strategy:
matrix:
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
env:
GOPATH: ${{ github.workspace }}
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
steps:
- name: Check out code
uses: actions/checkout@v2
with:
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: ${{ github.sha }}-artifacts
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
- name: Downloaded artifacts
run: ls -R *.tar.gz
- name: Generate changelog
id: changelog
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
onlyLastTag: "true"
stripHeaders: "true"
stripGeneratorNotice: "true"
output: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}/CHANGELOG.md
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}/CHANGELOG.md
files: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}/*.tar.gz
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57 changes: 57 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# test works flow run unit, cmd, integration and testworld tests parallely in 4 jobs
on:
push:
branches: [develop, master]
pull_request:
name: Tests
jobs:
tests:
name: ${{ matrix.test }} tests on ${{ matrix.os }}
strategy:
matrix:
go-version: [1.15.x]
#TODO(ved): enable macos once we port to go-subkey on gsrpc
os: [ubuntu-latest]
test: [unit, cmd, integration, testworld]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these run in parallel?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeap

runs-on: ${{ matrix.os }}
env:
GOPATH: ${{ github.workspace }}
MATRIX_TEST: ${{ matrix.test }}
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Check out code
uses: actions/checkout@v2
with:
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}
fetch-depth: 0
- uses: actions/cache@v2
with:
path: ${{ env.GOPATH }}/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.test }}
- name: Run tests
run: |
if [ "${MATRIX_TEST}" != "unit" ]; then
[[ -s ${HOME}/.nvm/nvm.sh ]] && . ${HOME}/.nvm/nvm.sh # This loads NVM
nvm install 10.15.1
nvm alias default 10.15.1
npm install -g [email protected]
sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume
. ${HOME}/.nix-profile/etc/profile.d/nix.sh
nix-env -iA cachix -f https://cachix.org/api/v1/install
cachix use dapp
git clone --recursive https://github.com/dapphub/dapptools ${HOME}/.dapp/dapptools
bash -c "cd ${HOME}/.dapp/dapptools && git checkout b76035185e67be430d851af81ad62c5f42c3e965"
nix-env -f ${HOME}/.dapp/dapptools -iA dapp seth solc
fi
echo "${HOME}/.cargo/bin" >> $GITHUB_PATH
make install-deps
make install-subkey
test=${{ matrix.test }} make run-tests
- name: Upload coverage
run: bash <(curl -s https://codecov.io/bash)
79 changes: 0 additions & 79 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.14-stretch as builder
FROM golang:1.15-buster as builder

RUN apt-get -y update && apt-get -y upgrade && apt-get -y install wget && apt-get install ca-certificates -y

Expand All @@ -8,7 +8,7 @@ RUN wget -P /go/bin/ https://storage.googleapis.com/centrifuge-dev-public/subkey

RUN go install -ldflags "-X github.com/centrifuge/go-centrifuge/version.gitCommit=`git rev-parse HEAD`" ./cmd/centrifuge/...

FROM debian:stretch-slim
FROM debian:buster-slim
RUN apt-get -y update && apt-get -y upgrade && apt-get install ca-certificates -y

WORKDIR /root/
Expand Down
Loading