v3/.github/workflows/build.yml

50 lines
1.5 KiB
YAML

name: Bazel Build
on: push
jobs:
bazel_build:
name: Bazel Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Mount bazel cache
uses: actions/cache@v1
with:
path: "/home/runner/.cache/bazel"
key: bazel
- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.1.0/bazelisk-linux-amd64"
mkdir -p "${GITHUB_WORKSPACE}/bin/"
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
- name: Test
run: |
"${GITHUB_WORKSPACE}/bin/bazel" test \
--stamp \
--workspace_status_command hack/workspace_status.sh \
//src/...
- name: Docker Login
run: |
echo ${{github.token}} | docker login -u ${{github.actor}} --password-stdin docker.pkg.github.com
- name: Publish Artifacts
run: |
"${GITHUB_WORKSPACE}/bin/bazel" query //src/... |\
grep +publish |\
xargs -l1 "${GITHUB_WORKSPACE}/bin/bazel" run \
--stamp \
--workspace_status_command hack/workspace_status.sh
- name: Publish Dev Container Image
if: github.ref == "refs/heads/main"
run: |
"${GITHUB_WORKSPACE}/bin/bazel" run \
--stamp \
--workspace_status_command hack/workspace_status.sh\
//.devcontainer:publish-dev-container