Create CI.yaml in Github Actions (#475)

* Migrate gitlab-CI to Github-Actions
This commit is contained in:
Yasser Isa 2024-03-07 12:24:01 -07:00 committed by GitHub
parent cc04b52bec
commit 38b751e551
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 59 additions and 174 deletions

58
.github/workflows/CI.yaml vendored Normal file
View File

@ -0,0 +1,58 @@
name: CI
on:
push:
tags:
- "v*.*.*"
release:
types: [published]
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['>=1.22.0']
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Build ${{ matrix.go-version }}
run: |
make
make test
- name: Race conditions test
run: make race
- name: test Build Docker image
run: docker build .
docker_set_env:
needs: [build]
if: github.event_name == 'release'
uses: zcash/.github/.github/workflows/standard-versioning-for-docker.yaml@main
docker_build_push:
uses: zcash/.github/.github/workflows/build-and-push-docker-hub.yaml@main
needs: [build, docker_set_env]
if: github.event_name == 'release'
with:
image_name: ${{ github.event.repository.name }}
image_tags: ${{ needs.docker_set_env.outputs.tags }}
dockerfile: ./Dockerfile
context: .
secrets:
dockerhub_registry: ${{ secrets.DOCKERHUB_REGISTRY }}
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}

View File

@ -1,130 +0,0 @@
# /************************************************************************
# File: .gitlab-ci.yml
# Author: mdr0id
# Date: 7/16/2019
# Description: Used to setup runners/jobs for lightwalletd
# Usage: Commit source and the pipeline will trigger the according jobs.
#
# Known bugs/missing features:
#
# IMPORTANT NOTE: any job with preceeding '.'' is ignored in pipeline
# ************************************************************************/
image: golang:1.11-alpine
stages:
- build
- test
- deploy
- monitor
before_script:
- apk update && apk add make git gcc musl-dev curl bash
# ************************************************************************/
# BUILD
# ************************************************************************/
.lint-check:
stage: build
script:
- make lint
.build-docs:
stage: build
script:
- make docs
build:build-linux:
stage: build
script:
- make
artifacts:
paths:
- ./lightwalletd
.build-windows:
stage: build
script:
- make
.build-mac:
stage: build
script:
- make
# Build against latest Golang
.build-latest:
stage: build
image: golang:latest-alpine
script:
- make
allow_failure: true
# ************************************************************************/
# TEST
# ************************************************************************/
test:test-unittest:
stage: test
dependencies:
- build:build-linux
script:
- make test
after_script:
- bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN
.test:test-race-conditions:
stage: test
dependencies:
- build:build-linux
script:
- make race
allow_failure: true
.test:test-coverage:
stage: test
dependencies:
- build:build-linux
script:
- make coverage
- make coverage_report
- make coverage_html
artifacts:
paths:
- ./coverage.html
# ************************************************************************/
# DEPLOY
# ************************************************************************/
.deploy_staging:
stage: deploy
script:
- make
- make test
environment:
name: staging
only:
- master
after_script:
- bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN
.release-candidate:
stage: deploy
script:
- echo "Generating v0.0.1-rc"
when: manual
.release-production:
stage: deploy
script:
- echo "Generating v0.0.1"
when: manual
# ************************************************************************/
# MONITOR
# ************************************************************************/
.monitor-release:
stage: deploy
script:
- echo "Building docker image for v0.0.0"
- make image
when: manual

View File

@ -1,47 +1,4 @@
# /************************************************************************
# File: Dockerfile
# Author: mdr0id
# Date: 9/3/2019
# Description: Used for devs that have not built zcashd or lightwalletd on
# on existing system
# USAGE:
#
# To build image: make docker_img
# To run container: make docker_image_run
#
# This will place you into the container where you can run zcashd, zcash-cli,
# lightwalletd server etc..
#
# First you need to get zcashd sync to current height on testnet, from outside container:
# make docker_img_run_zcashd
#
# Sometimes you need to manually start zcashd for the first time, from inside the container:
# zcashd -printtoconsole
#
# Once the block height is at least 280,000 you can go ahead and start lightwalletd
# make docker_img_run_lightwalletd_insecure_server
#
# If you need a random bash session in the container, use:
# make docker_img_bash
#
# If you get kicked out of docker or it locks up...
# To restart, check to see what container you want to restart via docker ps -a
# Then, docker restart <container id>
# The reattach to it, docker attach <container id>
#
# Known bugs/missing features/todos:
#
# *** DO NOT USE IN PRODUCTION ***
#
# - Create docker-compose with according .env scaffolding
# - Determine librustzcash bug that breaks zcashd alpine builds at runtime
# - Once versioning is stable add config flags for images
# - Add mainnet config once lightwalletd stack supports it
#
# ************************************************************************/
# Create layer in case you want to modify local lightwalletd code
FROM golang:1.17 AS lightwalletd_base
FROM golang:1.22 AS lightwalletd_base
ADD . /go/src/github.com/zcash/lightwalletd
WORKDIR /go/src/github.com/zcash/lightwalletd