flowerinthenight / golang-monorepo Goto Github PK
View Code? Open in Web Editor NEWAn example of a golang-based monorepo.
License: MIT License
An example of a golang-based monorepo.
License: MIT License
Let's user edit ci file to correct their pipeline.
eg:
# .circleci/config.yaml
version: 2.1
jobs:
build:
working_directory: /go/src/github.com/liemle3893/golang-monorepo/
docker:
- image: golang:1.15
steps:
- checkout
- setup_remote_docker:
version: 18.06.0-ce
- run:
name: build
shell: /bin/bash
environment:
CI_COMMIT_BEFORE_SHA: << pipeline.git.base_revision >>
CI_COMMIT_SHA: <<pipeline.git.revision>>
COMMIT_ID: <<pipeline.git.revision>>
command: |
chmod +x ./build.sh
./build.sh
Where:
# Extract commit range (or single commit).
COMMIT_RANGE_SEP="..."
if [[ "x$CI_COMMIT_BEFORE_SHA" == "x" ]]; then
# CI_COMMIT_BEFORE_SHA defined
GIT_COMMIT_NUMBER=`git log --oneline | wc -l | bc`
if [[ $GIT_COMMIT_NUMBER == "1" ]]; then
# 4b825dc642cb6eb9a060e54bf8d69288fbee4904 is magic id which is always exists
CI_COMMIT_BEFORE_SHA="4b825dc642cb6eb9a060e54bf8d69288fbee4904"
COMMIT_RANGE_SEP=" "
else
CI_COMMIT_BEFORE_SHA=`git rev-parse HEAD~1`
fi
fi
if [[ "x$CI_COMMIT_SHA" == "x" ]]; then
# CI_COMMIT_SHA is not defined
CI_COMMIT_SHA=`git rev-parse HEAD`
fi
COMMIT_RANGE="${CI_COMMIT_BEFORE_SHA}${COMMIT_RANGE_SEP}${CI_COMMIT_SHA}"
This way, I can flexible using Gitlab or Circle CI as my choice.
Note: This also solve the problem when repo only have 1 commit.
More developers are using podman/desktop in their mac/win laptop. Would be great if the github actions uses podman in ubuntu, or perhaps uses an image that already has podman in it.
Some teams don't want to include the vendor directory in git and they prefer the CI system to download the dependencies during build time with caching (e.g in CircleCI).
What would be the best way to check if the git diff
of $COMMIT_RANGE
for Gopkg.lock (dep) or go.sum (go mod) modules should trigger a build for cmds and services?
I want to build and run local instead of in Docker,
how can I do that?
I'm wondering about how you reference local packages.
I see you reference pkg/utils
at samplesvc/main.go:7 directly from github. Done this why, pkg/util
will be downloaded from github using the new go modules behaviour - is my understanding there correct?
Say I have a case where I'd like to make some experimental changes to pkg/utils
- would I have to push those experimental changes up to github before they become available to samplesvc
? Or will sampelsvc
just reference it locally?
Thanks for putting this monorepo together :) And thanks for your help!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.