mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 19:39:11 +00:00
59 lines
2.2 KiB
YAML
59 lines
2.2 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@v2.1.1
|
|
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: Write Artifact Manifest
|
|
run: |
|
|
artifacts=$(${GITHUB_WORKSPACE}/bin/bazel query //src/... | grep +publish)
|
|
publishedServices=${artifacts//$'//src/'/}
|
|
publishedServices=${publishedServices//$':+publish'/}
|
|
manifestJSON='{"services": {}}'
|
|
for svc in $publishedServices; do
|
|
manifestJSON=$(echo $manifestJSON | jq ".services+={\"$svc\":\"$(cat bazel-bin/src/$svc/+publish.digest)\"}")
|
|
done
|
|
echo $manifestJSON > manifest.json
|
|
|
|
- name: Upload Artifact Manifest
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: manifest.json
|
|
path: manifest.json
|