nightly #912
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: nightly | |
on: | |
schedule: | |
- cron: '00 18 * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
nightly-hash: ${{ steps.lsh-remote.outputs.nightly-hash }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1 | |
- name: Get commit hash | |
id: lsh-remote | |
run: | | |
H=$(git ls-remote -h https://github.com/tensorflow/tensorflow nightly) | |
echo "nightly-hash=$(echo ${H} | awk '{ print $1 }')" >> $GITHUB_OUTPUT | |
- name: Log Bazel version | |
run: bazelisk version | |
- name: Build Go bindings | |
run: CC=clang bazelisk build --config=ci -- //tools/graft_package:go_bindings | |
- name: Archive Go bindings | |
uses: actions/upload-artifact@v3 | |
with: | |
name: go_bindings | |
path: bazel-bin/tools/graft_package/go_bindings.tar | |
retention-days: 3 | |
test: | |
needs: build | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1 | |
- name: Download go_bindings | |
uses: actions/download-artifact@v3 | |
with: | |
name: go_bindings | |
- name: Update bindings | |
run: | | |
rm -rf tensorflow | |
tar x --strip-components=5 \ | |
-f go_bindings.tar \ | |
./src/github.com/wamuir/graft/tensorflow | |
rm go_bindings.tar | |
- name: Run gazelle | |
run: | | |
CC=clang bazelisk run //:gazelle | |
- name: Test bindings | |
run: CC=clang bazelisk test --config=ci -- //tensorflow/... | |
commit: | |
needs: [build, test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download go_bindings | |
uses: actions/download-artifact@v3 | |
with: | |
name: go_bindings | |
- name: Update bindings | |
run: | | |
rm -rf tensorflow | |
tar x --strip-components=5 \ | |
-f go_bindings.tar \ | |
./src/github.com/wamuir/graft/tensorflow | |
rm go_bindings.tar | |
- name: Run gazelle | |
run: | | |
CC=clang bazelisk run //:gazelle | |
- name: Check working tree for changes | |
id: git-status | |
run: | | |
M=$([ -n "$(git status --porcelain tensorflow)" ] && echo true || echo false) | |
echo "repo-changes=${M}" >> $GITHUB_OUTPUT | |
- name: Commit changes | |
if: ${{ steps.git-status.outputs.repo-changes == 'true' }} | |
run: | | |
git config --global user.name 'William Muir' | |
git config --global user.email '[email protected]' | |
git add tensorflow/ | |
git commit -m "[automated] Integrate changes from nightly build" \ | |
-m "tensorflow/tensorflow@${{ needs.build.outputs.nightly-hash }}" | |
git push |