CI Build workflow (alibaba/EasyRec)
The CI Build workflow from alibaba/EasyRec, explained and optimized by Latchkey.
C
CI health: C - fair
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the CI Build workflow from the alibaba/EasyRec repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
workflow (.yml)
name: CI Build
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
ci-test:
runs-on: EasyRec-unit-test
defaults:
run:
shell: bash {0}
steps:
- name: FetchCommit ${{ github.event.pull_request.head.sha }}
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: RunCiTest
id: run_ci_test
env:
TEST_DEVICES: ""
PULL_REQUEST_NUM: ${{ github.event.pull_request.number }}
run: |
source activate /home/admin/tf12_py2/
python git-lfs/git_lfs.py pull
source scripts/ci_test.sh
- name: SignalFail
env:
CI_TEST_PASSED: ${{steps.run_ci_test.outputs.ci_test_passed}}
run: |
echo "CI_TEST_PASSED=${CI_TEST_PASSED}"
if [ $CI_TEST_PASSED -ne 1 ]
then
echo "ci_test_failed, will exit"
exit 1
fi
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: CI Build on: pull_request: types: [opened, reopened, synchronize] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: ci-test: timeout-minutes: 30 runs-on: EasyRec-unit-test defaults: run: shell: bash {0} steps: - name: FetchCommit ${{ github.event.pull_request.head.sha }} uses: actions/checkout@v2 with: ref: ${{ github.event.pull_request.head.sha }} submodules: recursive - name: RunCiTest id: run_ci_test env: TEST_DEVICES: "" PULL_REQUEST_NUM: ${{ github.event.pull_request.number }} run: | source activate /home/admin/tf12_py2/ python git-lfs/git_lfs.py pull source scripts/ci_test.sh - name: SignalFail env: CI_TEST_PASSED: ${{steps.run_ci_test.outputs.ci_test_passed}} run: | echo "CI_TEST_PASSED=${CI_TEST_PASSED}" if [ $CI_TEST_PASSED -ne 1 ] then echo "ci_test_failed, will exit" exit 1 fi
What changed
- Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.