Skip to content

Commit

Permalink
Update workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
ekhabarov committed Jan 23, 2025
1 parent 6402d5d commit 31a8d32
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 12 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
name: Build
on: [ pull_request ]

on:
push:
branches:
- main
pull_request:
types:
- labeled
- unlabeled
- opened
- edited
- reopened
- synchronize
- ready_for_review

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
build:
Expand All @@ -10,7 +27,7 @@ jobs:
uses: actions/checkout@v4

- name: Cache Bazel
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cache/bazel
Expand All @@ -19,8 +36,7 @@ jobs:
${{ runner.os }}-bazel-
- name: Build everything
run: bazel build //...

# - name: Test everything
# run: bazel test //...

env:
# Bazelisk will download bazel to here.
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc build //...
15 changes: 15 additions & 0 deletions .github/workflows/ci.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file contains Bazel settings to apply on CI only.
# It is referenced with a --bazelrc option in the call to bazel in ci.yaml

# Debug where options came from
build --announce_rc
# This directory is configured in GitHub actions to be persisted between runs.
# We do not enable the repository cache to cache downloaded external artifacts
# as these are generally faster to download again than to fetch them from the
# GitHub actions cache.
build --disk_cache=~/.cache/bazel
# Don't rely on test logs being easily accessible from the test runner,
# though it makes the log noisier.
test --test_output=errors
# Allows tests to run bazelisk-in-bazel, since this is the cache folder used
test --test_env=XDG_CACHE_HOME
20 changes: 15 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Release

on:
push:
tags:
Expand All @@ -13,7 +14,7 @@ jobs:
uses: actions/checkout@v4

- name: Cache Bazel
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cache/bazel
Expand All @@ -22,17 +23,26 @@ jobs:
${{ runner.os }}-bazel-
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push service-one image to ghcr.io
run: bazel run --stamp --embed_label=${{ github.ref_name }} //service-one:push_image
env:
# Bazelisk will download bazel to here.
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: bazel run --stamp --embed_label=${{ github.ref_name }} --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc //service-one:push_image

- name: Push authz image to ghcr.io
run: bazel run --stamp --embed_label=${{ github.ref_name }} //authz:push_image
env:
# Bazelisk will download bazel to here.
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: bazel run --stamp --embed_label=${{ github.ref_name }} --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc //authz:push_image

- name: Push envoy image to ghcr.io
run: bazel run --stamp --embed_label=${{ github.ref_name }} //envoy:push_image
env:
# Bazelisk will download bazel to here.
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: bazel run --stamp --embed_label=${{ github.ref_name }} --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc //envoy:push_image

0 comments on commit 31a8d32

Please sign in to comment.