Skip to content

Commit

Permalink
Update docker workflow (#1320)
Browse files Browse the repository at this point in the history
* Update docker workflow

* run workflow when workflow file modified

* fix path option

* test options for free space

* remove "Free space"

* different save space method

* disable docker push (for now)

* cleanup

* push to docker-hub only for main an release tags

* add some debug info to docker storage space

* bump up the runner to a bigger instance

* Revert "bump up the runner to a bigger instance"

This reverts commit 00d22fb.

* bump up GHA instance to a $/min bigger one

* Downgrade to 4 cores and test again
  • Loading branch information
gpmayorga authored Apr 17, 2023
1 parent b3a240b commit 8812cde
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: docker
on:
push:
branches: [main, 'release-v**']
pull_request:
paths:
- ".github/workflows/docker.yml"
workflow_dispatch:
inputs:
docker_tag:
Expand All @@ -14,7 +17,7 @@ jobs:
docker:
strategy:
matrix:
os: [ ubuntu-latest ]
os: [ ubuntu-latest-4-cores ]
target: [ release, test ]
runs-on: ${{ matrix.os }}
env:
Expand All @@ -23,20 +26,17 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Free Space
- name: Free space
# https://github.com/actions/runner-images/issues/2840#issuecomment-1284059930
run: |
echo "Listing 100 largest packages"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
df -h
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y azure-cli google-cloud-sdk microsoft-edge-stable google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
df -h
echo "Removing large directories"
rm -rf /usr/share/dotnet/
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: check available docker space
run: |
docker volume ls
df -h
- name: Set docker tag
run: |
if [ "${WORKFLOW_TAG}" != "" ]; then
Expand All @@ -50,6 +50,11 @@ jobs:
- if: matrix.target == 'test'
name: Build docker test
run: docker build --build-arg RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} --build-arg OPTS="--features=fast-runtime" -t centrifugeio/centrifuge-chain:test-${{ env.DOCKER_TAG }}-latest .
- if: failure()
name: Check available space after build failed
run: |
docker volume ls
df -h
- name: Login to Docker Hub
uses: docker/login-action@dd4fa0671be5250ee6f50aedf4cb05514abda2c7
with:
Expand All @@ -65,3 +70,4 @@ jobs:
run: docker images
- name: Push image to Docker Hub
run: docker push --all-tags --quiet centrifugeio/centrifuge-chain
if: contains(github.ref, 'refs/tags/release-v') || github.ref == 'refs/heads/main'

0 comments on commit 8812cde

Please sign in to comment.