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

Update docker workflow #1320

Merged
merged 14 commits into from
Apr 17, 2023
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'