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 on-tag.yml #36

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 9 additions & 56 deletions .github/workflows/on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Docker build on tag
env:
DOCKER_CLI_EXPERIMENTAL: enabled
TAG_FMT: "^refs/tags/(((.?[0-9]+){3,4}))$"
DOCKER_BUILDKIT: 1
DOCKER_BUILDKIT: 0
COMPOSE_DOCKER_CLI_BUILD: 0

on:
Expand All @@ -21,40 +21,20 @@ jobs:
service:
- frontend
- backend
runner-label:
- ubuntu-latest
- self-hosted
fail-fast: false
runs-on: ${{ matrix.runner-label }}
continue-on-error: ${{ matrix.runner-label == 'self-hosted' }}
runs-on: ubuntu-latest
timeout-minutes: 120
name: Build ${{ matrix.service }} on ${{ matrix.runner-label }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.service }}-${{ matrix.runner-label }}
cancel-in-progress: true

name: Build and push to DockerHub
steps:
- name: Runner check
id: runner-check
run: |
echo "Running on ${{ matrix.runner-label }}"
if [ "${{ matrix.runner-label }}" = "self-hosted" ]; then
echo "Using self-hosted runner"
else
echo "Using GitHub-hosted runner"
fi

# Skip swap configuration for GitHub-hosted runners
- name: Configure swap
if: matrix.runner-label == 'self-hosted'
# Workaround based on JonasAlfredsson/[email protected]
- name: Replace the current swap file
shell: bash
run: |
sudo swapoff /mnt/swapfile || true
sudo rm -f /mnt/swapfile || true
sudo fallocate -l 13G /mnt/swapfile || true
sudo swapoff /mnt/swapfile
sudo rm -v /mnt/swapfile
sudo fallocate -l 13G /mnt/swapfile
sudo chmod 600 /mnt/swapfile
sudo mkswap /mnt/swapfile
sudo swapon /mnt/swapfile || true
sudo swapon /mnt/swapfile

- name: Show current memory and swap status
shell: bash
Expand All @@ -64,7 +44,6 @@ jobs:
sudo swapon --show

- name: Mount a tmpfs over /var/lib/docker
if: matrix.runner-label == 'self-hosted'
shell: bash
run: |
if [ ! -d "/var/lib/docker" ]; then
Expand All @@ -75,30 +54,6 @@ jobs:
sudo systemctl restart docker
sudo df -h | grep docker

- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-

- name: Cache Cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/index
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-

- name: Cache Cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-

- name: Set env variables
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV

Expand All @@ -112,7 +67,6 @@ jobs:
- name: Login to Docker
run: |
docker login -u "sondreb" -p "${{secrets.DOCKER_KEY}}"

- name: Checkout project
uses: actions/checkout@v4

Expand Down Expand Up @@ -145,7 +99,6 @@ jobs:
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--platform linux/amd64,linux/arm64 \
--progress=plain \
--tag blockcore/mempool-${{ matrix.service }}:$TAG \
--tag blockcore/mempool-${{ matrix.service }}:latest \
--build-context rustgbt=./rust \
Expand Down
Loading