Skip to content
Latchkey

CI Build PY3 workflow (alibaba/EasyRec)

The CI Build PY3 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 →
Source: alibaba/EasyRec.github/workflows/ci_py3.ymlLicense Apache-2.0View source

What it does

This is the CI Build PY3 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 PY3
on:
  pull_request:
    types: [opened, reopened, synchronize]

jobs:
  ci-test:
    runs-on: EasyRec-py3-15
    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 tf15_py3
           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_py3_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 PY3
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-py3-15
    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 tf15_py3
           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_py3_test_failed, will exit"
            exit 1
          fi
 

What changed

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow