run all in bazel #112
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Commit | |
on: | |
pull_request: | |
branches: [main] | |
paths-ignore: | |
- '**/*.md' | |
push: | |
branches: [main] | |
paths-ignore: | |
- '**/*.md' | |
concurrency: | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run | |
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.actor }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: Build & Test (${{ matrix.envoy.name }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
envoy: | |
- image: ghcr.io/mathetake/envoy-buildcontainer:v1.31-latest | |
envoy_image_tag: v1.31-latest | |
version: 1.31.0 | |
name: Debug build Envoy v1.31 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Frees up space # https://github.com/orgs/community/discussions/25678#discussioncomment-6533238 | |
run: rm -rf /opt/hostedtoolcache | |
- uses: actions/checkout@v4 | |
# To extract the Envoy binary from the buildcontainer, we run docker run in a single step. | |
- name: Run tests | |
run: | | |
mkdir -p /tmp/gha | |
docker run --user envoyxbuild -v $(pwd):/tmp/gha ${{ matrix.envoy.image }} /bin/bash -c "\ | |
git reset --hard && \ | |
git fetch origin ${{ github.sha }} && \ | |
git checkout --detach ${{ github.sha }} && \ | |
bazel build ${{ matrix.envoy.bazel_build_options }} //... && \ | |
bazel test ${{ matrix.envoy.bazel_build_options }} //... && \ | |
sudo cp bazel-bin/envoy /tmp/gha/envoy" | |
- name: Check Envoy binary | |
run: | | |
file ./envoy | |
./envoy --version | |
cp ./envoy /usr/local/bin/envoy | |
# TODO: Following should be a part of bazel build / test process. | |
- uses: actions/setup-go@v4 | |
with: | |
cache: false | |
go-version: 1.22 | |
- name: Install conformance tests | |
run: | | |
cd ./sdks/conformance-test | |
go install . | |
- name: Go SDK check | |
run: | | |
cd ./sdks/go | |
make all | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
- name: Cache cargo registry | |
uses: actions/cache@v4 | |
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@v4 | |
with: | |
path: ~/.cargo/git | |
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-index- | |
- name: Rust SDK check | |
run: | | |
cd ./sdks/rust | |
make all | |
- name: Login into GitHub Container Registry | |
if: github.event_name == 'push' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and Push ghcr.io/mathetake/envoy:${{ matrix.envoy.envoy_image_tag }} | |
if: github.event_name == 'push' | |
run: | | |
IMAGE=ghcr.io/mathetake/envoy:${{ matrix.envoy.envoy_image_tag }} | |
docker build -f .github/workflows/Dockerfile.envoy . \ | |
-t $IMAGE --build-arg ENVOY_IMAGE_TAG=${{ matrix.envoy.envoy_image_tag }} | |
docker push $IMAGE | |
MAIN_IMAGE_TAG=ghcr.io/mathetake/envoy:${{ matrix.envoy.envoy_image_tag }} | |
docker tag $IMAGE $MAIN_IMAGE_TAG | |
docker push $MAIN_IMAGE_TAG |