From 7eccb76625141761a3b3e9bac6e8b2fbee2d1c3f Mon Sep 17 00:00:00 2001 From: Scott Todd Date: Tue, 3 Dec 2024 14:20:48 -0800 Subject: [PATCH] Workflow cleanup: move checkout to start, prune unused steps+vars. (#639) Cutting down on boilerplate and standardizing some workflow syntax before deeper refactoring work. * Move `users: actions/checkout` to the start of each job (for consistency, since all workflows use the source code but not all workflows need dependencies or python setup, etc.) * Per https://github.com/actions/checkout, `submodules: false` is the default * Step names can be omitted with `uses` (docs: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_iduses) . Our [`pre-commit.yml`](https://github.com/nod-ai/shark-ai/blob/main/.github/workflows/pre-commit.yaml) workflow does this already: https://github.com/nod-ai/shark-ai/blob/c0ca2e2788ea09a890ffe347dfbffe57606670b8/.github/workflows/pre-commit.yaml#L11-L14 ![image](https://github.com/user-attachments/assets/dddfe91b-06f2-4a67-a320-fb2c9f612323) * Remove copy/pasted `Get Current Date` step from some workflows * Remove unused `SHARK_PLATFORM_REPO_ROOT` env var from some workflows (unused since https://github.com/nod-ai/shark-ai/pull/305, copy/pasted into a few places) --- .github/workflows/build_packages.yml | 5 +---- .github/workflows/ci-libshortfin.yml | 7 ++----- .github/workflows/ci-llama-large-tests.yaml | 5 ++--- .github/workflows/ci-llama-quick-tests.yaml | 5 ++--- .github/workflows/ci-sdxl.yaml | 7 ++----- .github/workflows/ci-sglang-benchmark.yml | 8 ++------ .github/workflows/ci-sglang-integration-tests.yml | 8 ++------ .github/workflows/ci-shark-ai.yml | 6 +++--- .github/workflows/ci-sharktank.yml | 5 ++--- .github/workflows/ci-tuner.yml | 3 +-- .github/workflows/ci_eval.yaml | 6 ++---- .github/workflows/ci_eval_short.yaml | 6 ++---- .github/workflows/ci_linux_x64_asan-libshortfin.yml | 7 ++----- .github/workflows/ci_linux_x64_nogil-libshortfin.yml | 7 ++----- 14 files changed, 27 insertions(+), 58 deletions(-) diff --git a/.github/workflows/build_packages.yml b/.github/workflows/build_packages.yml index 3a660dec9..869b11d24 100644 --- a/.github/workflows/build_packages.yml +++ b/.github/workflows/build_packages.yml @@ -25,10 +25,7 @@ jobs: outputs: shark_package_version: ${{ steps.version.outputs.shark_package_version }} steps: - - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - submodules: false + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Python uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: diff --git a/.github/workflows/ci-libshortfin.yml b/.github/workflows/ci-libshortfin.yml index 1c1ec682d..3e066e812 100644 --- a/.github/workflows/ci-libshortfin.yml +++ b/.github/workflows/ci-libshortfin.yml @@ -76,6 +76,8 @@ jobs: python-version: "3.11" steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: (Linux) Install dependencies if: "runner.os == 'Linux'" run: | @@ -86,11 +88,6 @@ jobs: if: "runner.os == 'Windows'" uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 - - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - submodules: false - - name: Checkout IREE repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.github/workflows/ci-llama-large-tests.yaml b/.github/workflows/ci-llama-large-tests.yaml index c2e96141c..5766d8ca6 100644 --- a/.github/workflows/ci-llama-large-tests.yaml +++ b/.github/workflows/ci-llama-large-tests.yaml @@ -36,6 +36,8 @@ jobs: PIP_CACHE_DIR: "${{ github.workspace }}/.pip-cache" VENV_DIR: ${{ github.workspace }}/.venv steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Get Current Date id: date run: echo "::set-output name=date::$(date +'%Y-%m-%d')" @@ -46,9 +48,6 @@ jobs: with: python-version: ${{matrix.version}} - - name: "Checkout Code" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Cache Pip Packages uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 id: cache-pip diff --git a/.github/workflows/ci-llama-quick-tests.yaml b/.github/workflows/ci-llama-quick-tests.yaml index 20aa5995d..697c47928 100644 --- a/.github/workflows/ci-llama-quick-tests.yaml +++ b/.github/workflows/ci-llama-quick-tests.yaml @@ -36,6 +36,8 @@ jobs: PIP_CACHE_DIR: "${{ github.workspace }}/.pip-cache" VENV_DIR: ${{ github.workspace }}/.venv steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Get Current Date id: date run: echo "::set-output name=date::$(date +'%Y-%m-%d')" @@ -46,9 +48,6 @@ jobs: with: python-version: ${{matrix.version}} - - name: "Checkout Code" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Cache Pip Packages uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 id: cache-pip diff --git a/.github/workflows/ci-sdxl.yaml b/.github/workflows/ci-sdxl.yaml index 355ffcf8b..fe7d6e0b4 100644 --- a/.github/workflows/ci-sdxl.yaml +++ b/.github/workflows/ci-sdxl.yaml @@ -40,6 +40,8 @@ jobs: runs-on: mi300-sdxl-kernel steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Install dependencies run: | if dpkg -s cmake &>/dev/null; then @@ -53,11 +55,6 @@ jobs: sudo apt install ninja -y fi - - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - submodules: false - - name: Checkout IREE repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.github/workflows/ci-sglang-benchmark.yml b/.github/workflows/ci-sglang-benchmark.yml index f44e2772b..b1e037446 100644 --- a/.github/workflows/ci-sglang-benchmark.yml +++ b/.github/workflows/ci-sglang-benchmark.yml @@ -35,9 +35,8 @@ jobs: env: PIP_CACHE_DIR: "${{ github.workspace }}/.pip-cache" steps: - - name: Get Current Date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + - name: "Checkout Code" + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: "Setting up Python" id: setup_python @@ -45,9 +44,6 @@ jobs: with: python-version: ${{matrix.version}} - - name: "Checkout Code" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Cache Pip Packages uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 id: cache-pip diff --git a/.github/workflows/ci-sglang-integration-tests.yml b/.github/workflows/ci-sglang-integration-tests.yml index c61756d78..59ebac4c9 100644 --- a/.github/workflows/ci-sglang-integration-tests.yml +++ b/.github/workflows/ci-sglang-integration-tests.yml @@ -36,9 +36,8 @@ jobs: env: PIP_CACHE_DIR: "${{ github.workspace }}/.pip-cache" steps: - - name: Get Current Date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + - name: "Checkout Code" + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: "Setting up Python" id: setup_python @@ -46,9 +45,6 @@ jobs: with: python-version: ${{matrix.version}} - - name: "Checkout Code" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Cache Pip Packages uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 id: cache-pip diff --git a/.github/workflows/ci-shark-ai.yml b/.github/workflows/ci-shark-ai.yml index fc85a76a7..b206945d7 100644 --- a/.github/workflows/ci-shark-ai.yml +++ b/.github/workflows/ci-shark-ai.yml @@ -35,15 +35,15 @@ jobs: env: PIP_CACHE_DIR: "${{ github.workspace }}/.pip-cache" steps: + - name: "Checkout Code" + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: "Setting up Python" id: setup_python uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: ${{matrix.version}} - - name: "Checkout Code" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Cache Pip Packages uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 id: cache-pip diff --git a/.github/workflows/ci-sharktank.yml b/.github/workflows/ci-sharktank.yml index 38de6eb22..1a179322a 100644 --- a/.github/workflows/ci-sharktank.yml +++ b/.github/workflows/ci-sharktank.yml @@ -36,15 +36,14 @@ jobs: env: PIP_CACHE_DIR: "${{ github.workspace }}/.pip-cache" steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: "Setting up Python" id: setup_python uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: ${{matrix.version}} - - name: "Checkout Code" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Cache Pip Packages uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 id: cache-pip diff --git a/.github/workflows/ci-tuner.yml b/.github/workflows/ci-tuner.yml index 81b920e31..82c5f3514 100644 --- a/.github/workflows/ci-tuner.yml +++ b/.github/workflows/ci-tuner.yml @@ -31,8 +31,7 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Set up Python uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 diff --git a/.github/workflows/ci_eval.yaml b/.github/workflows/ci_eval.yaml index 0164b6cdc..5e4a9bf77 100644 --- a/.github/workflows/ci_eval.yaml +++ b/.github/workflows/ci_eval.yaml @@ -36,17 +36,15 @@ jobs: shell: bash env: PIP_CACHE_DIR: "${{ github.workspace }}/.pip-cache" - SHARK_PLATFORM_REPO_ROOT: ${{ github.workspace }} steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: "Setting up Python" id: setup_python uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: ${{matrix.version}} - - name: "Checkout Code" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Cache Pip Packages uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 id: cache-pip diff --git a/.github/workflows/ci_eval_short.yaml b/.github/workflows/ci_eval_short.yaml index 4622f5c57..64043c2ec 100644 --- a/.github/workflows/ci_eval_short.yaml +++ b/.github/workflows/ci_eval_short.yaml @@ -35,17 +35,15 @@ jobs: shell: bash env: PIP_CACHE_DIR: "${{ github.workspace }}/.pip-cache" - SHARK_PLATFORM_REPO_ROOT: ${{ github.workspace }} steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: "Setting up Python" id: setup_python uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: ${{matrix.version}} - - name: "Checkout Code" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Cache Pip Packages uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 id: cache-pip diff --git a/.github/workflows/ci_linux_x64_asan-libshortfin.yml b/.github/workflows/ci_linux_x64_asan-libshortfin.yml index 42de8f0f6..30943e2f6 100644 --- a/.github/workflows/ci_linux_x64_asan-libshortfin.yml +++ b/.github/workflows/ci_linux_x64_asan-libshortfin.yml @@ -93,16 +93,13 @@ jobs: ASAN_OPTIONS: detect_leaks=0,detect_odr_violation=0 LSAN_OPTIONS: suppressions=${{ github.workspace }}/shortfin/build_tools/python_lsan_suppressions.txt steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Install dependencies run: | sudo apt update sudo apt install clang lld cmake ninja-build - - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - submodules: false - - name: Checkout IREE repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.github/workflows/ci_linux_x64_nogil-libshortfin.yml b/.github/workflows/ci_linux_x64_nogil-libshortfin.yml index 550366e1b..543cdaaf9 100644 --- a/.github/workflows/ci_linux_x64_nogil-libshortfin.yml +++ b/.github/workflows/ci_linux_x64_nogil-libshortfin.yml @@ -41,16 +41,13 @@ jobs: runs-on: ubuntu-24.04 steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Install dependencies run: | sudo apt update sudo apt install clang lld cmake ninja-build - - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - submodules: false - - name: Checkout IREE repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: