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

optimising sharder and miner builds #3247

Open
wants to merge 8 commits into
base: sprint-1.14
Choose a base branch
from
54 changes: 26 additions & 28 deletions .github/workflows/build-&-publish-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ jobs:
echo "BRANCH=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo ${GITHUB_REF#refs/*/} || echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV
echo "SHA=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo $GITHUB_SHA || echo '${{ github.event.pull_request.head.sha }}')" >> $GITHUB_ENV

- uses: actions/checkout@v3

- name: Setup go 1.20
uses: actions/setup-go@v2
- name: Setup go 1.21.5
uses: actions/setup-go@v4
with:
go-version: '1.20' # The Go version to download (if necessary) and use.
go-version: '1.21.5' # The Go version to download (if necessary) and use.

- uses: actions/checkout@v4

- name: Install Dependencies
run: |
sudo apt update -y
sudo apt -y install build-essential

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Install Dependencies
run: |
sudo apt update -y
sudo apt -y install build-essential nghttp2 libnghttp2-dev libssl-dev wget

- name: Get changed files using defaults
id: changed-files
Expand All @@ -83,20 +83,19 @@ jobs:
docker push $ZCHAIN_BUILD_BASE_REGISTRY:$TAG-$SHORT_SHA

docker build -f docker.local/build.base/Dockerfile.run_base docker.local/build.base -t $ZCHAIN_BUILDRUN
docker tag $ZCHAIN_BUILDRUN $ZCHAIN_BUILD_RUN_REGISTRY:$TAG
docker tag $ZCHAIN_BUILDRUN $ZCHAIN_BUILD_RUN_REGISTRY:staging
docker tag $ZCHAIN_BUILDRUN $ZCHAIN_BUILD_RUN_REGISTRY:$TAG-$SHORT_SHA
docker push $ZCHAIN_BUILD_RUN_REGISTRY:$TAG
docker push $ZCHAIN_BUILD_RUN_REGISTRY:staging
docker push $ZCHAIN_BUILD_RUN_REGISTRY:$TAG-$SHORT_SHA

- name: Build & Push
run: |
make install-mockery
make build-mocks

sed 's,%COPY%,COPY --from=miner_build $APP_DIR,g' "$DOCKERFILE_MINER.template" > "$DOCKERFILE_MINER"
# sed 's,%COPY%,COPY --from=miner_build $APP_DIR,g' "$DOCKERFILE_MINER.template" > "$DOCKERFILE_MINER"
docker build --build-arg GIT_COMMIT=$GITHUB_SHA -t miner:latest -f "$DOCKERFILE_MINER" .


docker tag miner:latest ${MINER_REGISTRY}:$TAG
docker tag miner:latest $MINER_REGISTRY:latest
docker push ${MINER_REGISTRY}:$TAG
Expand Down Expand Up @@ -130,25 +129,24 @@ jobs:
echo "BRANCH=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo ${GITHUB_REF#refs/*/} || echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV
echo "SHA=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo $GITHUB_SHA || echo '${{ github.event.pull_request.head.sha }}')" >> $GITHUB_ENV

- uses: actions/checkout@v3

- name: Setup go 1.20
uses: actions/setup-go@v2
- name: Setup go 1.21.5
uses: actions/setup-go@v4
with:
go-version: '1.20' # The Go version to download (if necessary) and use.
go-version: '1.21.5' # The Go version to download (if necessary) and use.

- uses: actions/checkout@v4

- name: Install Dependencies
run: |
sudo apt update -y
sudo apt -y install build-essential

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Install Dependencies
run: |
sudo apt update -y
sudo apt -y install build-essential nghttp2 libnghttp2-dev libssl-dev wget

- name: Get changed files using defaults
id: changed-files
uses: tj-actions/changed-files@v18.4
Expand All @@ -166,15 +164,15 @@ jobs:
run: |
SHORT_SHA=$(echo ${{ env.SHA }} | head -c 8)
docker build -f docker.local/build.base/Dockerfile.build_base . -t $ZCHAIN_BUILDBASE
docker tag $ZCHAIN_BUILDBASE $ZCHAIN_BUILD_BASE_REGISTRY:$TAG
docker tag $ZCHAIN_BUILDBASE $ZCHAIN_BUILD_BASE_REGISTRY:staging
docker tag $ZCHAIN_BUILDBASE $ZCHAIN_BUILD_BASE_REGISTRY:$TAG-$SHORT_SHA
docker push $ZCHAIN_BUILD_BASE_REGISTRY:$TAG
docker push $ZCHAIN_BUILD_BASE_REGISTRY:staging
docker push $ZCHAIN_BUILD_BASE_REGISTRY:$TAG-$SHORT_SHA

docker build -f docker.local/build.base/Dockerfile.run_base docker.local/build.base -t $ZCHAIN_BUILDRUN
docker tag $ZCHAIN_BUILDRUN $ZCHAIN_BUILD_RUN_REGISTRY:$TAG
docker tag $ZCHAIN_BUILDRUN $ZCHAIN_BUILD_RUN_REGISTRY:staging
docker tag $ZCHAIN_BUILDRUN $ZCHAIN_BUILD_RUN_REGISTRY:$TAG-$SHORT_SHA
docker push $ZCHAIN_BUILD_RUN_REGISTRY:$TAG
docker push $ZCHAIN_BUILD_RUN_REGISTRY:staging
docker push $ZCHAIN_BUILD_RUN_REGISTRY:$TAG-$SHORT_SHA

- name: Build & Push
Expand Down