From d7a6859c40de342b94bbbff7b84c33c021cce4c9 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Thu, 17 Aug 2023 08:34:35 -0400 Subject: [PATCH] chore(gh): use setup-bentoml-action (#230) --- .github/actions/setup-repo/action.yml | 40 --------------------------- .github/workflows/binary-releases.yml | 5 ++-- .github/workflows/ci.yml | 12 ++++---- .github/workflows/compile-pypi.yml | 16 ++++++----- .github/workflows/create-releases.yml | 12 ++++---- .github/workflows/release-notes.yml | 6 ++-- tools/lock-actions.sh | 1 - 7 files changed, 27 insertions(+), 65 deletions(-) delete mode 100644 .github/actions/setup-repo/action.yml diff --git a/.github/actions/setup-repo/action.yml b/.github/actions/setup-repo/action.yml deleted file mode 100644 index 6483eb7b..00000000 --- a/.github/actions/setup-repo/action.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: setup-repo -description: Setup repo with all features on CI -inputs: - python-version: - description: 'Python version' - required: true - default: '3.8' - architecture: - description: 'Which architecture to run on' - required: false - default: x64 -runs: - using: composite - steps: - - name: Setup python - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # ratchet:actions/setup-python@v4 - with: - python-version: ${{ inputs.python-version }} - architecture: ${{ inputs.architecture }} - - name: Get cache key prefix - id: get-cache-key-prefix - shell: bash - run: echo "prefix=${{ runner.os }}-${{ inputs.python-version }}" >> $GITHUB_OUTPUT - - name: Get pip cache dir - id: pip-cache-dir - shell: bash - run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT - - name: Cache pip dependencies - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # ratchet:actions/cache@v3 - id: cache-pip - with: - path: ${{ steps.pip-cache-dir.outputs.dir }} - key: ${{ steps.get-cache-key-prefix.outputs.prefix }}-pypi - restore-keys: | - ${{ steps.get-cache-key-prefix.outputs.prefix }}-pypi- - - name: Install dependencies - shell: bash - run: pip install hatch towncrier - - name: Inject slug/short variables - uses: rlespinasse/github-slug-action@102b1a064a9b145e56556e22b18b19c624538d94 # ratchet:rlespinasse/github-slug-action@v4.4.1 diff --git a/.github/workflows/binary-releases.yml b/.github/workflows/binary-releases.yml index 7625355d..d95e8145 100644 --- a/.github/workflows/binary-releases.yml +++ b/.github/workflows/binary-releases.yml @@ -34,8 +34,9 @@ jobs: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3 with: fetch-depth: 0 - - name: Setup CI - uses: ./.github/actions/setup-repo + - uses: bentoml/setup-bentoml-action@59beefe94e2e8f8ebbedf555fc86bd5d1ae0a708 # ratchet:bentoml/setup-bentoml-action@v1 + with: + bentoml-version: 'main' - name: Pull latest change if: ${{ github.event_name != 'pull_request' }} run: git pull --autostash --no-edit --gpg-sign --ff origin main diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af6e1054..3d8f8381 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,9 +46,9 @@ jobs: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3 with: fetch-depth: 0 - - name: Setup CI - uses: ./.github/actions/setup-repo + - uses: bentoml/setup-bentoml-action@59beefe94e2e8f8ebbedf555fc86bd5d1ae0a708 # ratchet:bentoml/setup-bentoml-action@v1 with: + bentoml-version: 'main' python-version: ${{ matrix.python-version }} - name: Run tests run: hatch run tests:python @@ -69,9 +69,9 @@ jobs: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3 with: fetch-depth: 0 - - name: Setup CI - uses: ./.github/actions/setup-repo + - uses: bentoml/setup-bentoml-action@59beefe94e2e8f8ebbedf555fc86bd5d1ae0a708 # ratchet:bentoml/setup-bentoml-action@v1 with: + bentoml-version: 'main' python-version-file: .python-version-default - name: Download coverage data uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3 @@ -111,9 +111,9 @@ jobs: run: | wget https://github.com/sharkdp/hyperfine/releases/download/v${HYPERFINE_VERSION}/hyperfine_${HYPERFINE_VERSION}_amd64.deb sudo dpkg -i hyperfine_${HYPERFINE_VERSION}_amd64.deb - - name: Setup CI - uses: ./.github/actions/setup-repo + - uses: bentoml/setup-bentoml-action@59beefe94e2e8f8ebbedf555fc86bd5d1ae0a708 # ratchet:bentoml/setup-bentoml-action@v1 with: + bentoml-version: 'main' python-version-file: .python-version-default - name: Install self run: pip install ./openllm-python diff --git a/.github/workflows/compile-pypi.yml b/.github/workflows/compile-pypi.yml index 1528c9a2..c26253db 100644 --- a/.github/workflows/compile-pypi.yml +++ b/.github/workflows/compile-pypi.yml @@ -41,8 +41,8 @@ env: HATCH_VERBOSE: 2 CIBW_BUILD_FRONTEND: build CIBW_ENVIRONMENT_PASS_LINUX: > - HATCH_BUILD_HOOKS_ENABLE - MYPYPATH + HATCH_BUILD_HOOKS_ENABLE MYPYPATH + concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true @@ -55,8 +55,10 @@ jobs: with: fetch-depth: 0 ref: '${{ inputs.tags }}' - - name: Setup CI - uses: ./.github/actions/setup-repo + - uses: bentoml/setup-bentoml-action@59beefe94e2e8f8ebbedf555fc86bd5d1ae0a708 # ratchet:bentoml/setup-bentoml-action@v1 + with: + bentoml-version: 'main' + python-version-file: .python-version-default - name: Build run: hatch build working-directory: openllm-python @@ -95,10 +97,10 @@ jobs: with: fetch-depth: 0 ref: '${{ inputs.tags }}' - - name: Setup CI - uses: ./.github/actions/setup-repo + - uses: bentoml/setup-bentoml-action@59beefe94e2e8f8ebbedf555fc86bd5d1ae0a708 # ratchet:bentoml/setup-bentoml-action@v1 with: - python-version: 3.8 + bentoml-version: 'main' + python-version: '3.8' - name: Build wheels via cibuildwheel uses: pypa/cibuildwheel@39a63b5912f086dd459cf6fcb13dcdd3fe3bc24d # ratchet:pypa/cibuildwheel@v2.15.0 with: diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml index 4641e367..333ce9e9 100644 --- a/.github/workflows/create-releases.yml +++ b/.github/workflows/create-releases.yml @@ -34,10 +34,10 @@ jobs: with: fetch-depth: 0 token: ${{ secrets.OPENLLM_PAT }} - - name: Setup CI - uses: ./.github/actions/setup-repo + - uses: bentoml/setup-bentoml-action@59beefe94e2e8f8ebbedf555fc86bd5d1ae0a708 # ratchet:bentoml/setup-bentoml-action@v1 with: - python-version: '3.11' + bentoml-version: 'main' + python-version-file: .python-version-default - name: Import bot's GPG key for signing commits id: import-gpg uses: crazy-max/ghaction-import-gpg@72b6676b71ab476b77e676928516f6982eef7a41 # ratchet:crazy-max/ghaction-import-gpg@v5 @@ -202,10 +202,10 @@ jobs: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3 with: fetch-depth: 0 - - name: Setup CI - uses: ./.github/actions/setup-repo + - uses: bentoml/setup-bentoml-action@59beefe94e2e8f8ebbedf555fc86bd5d1ae0a708 # ratchet:bentoml/setup-bentoml-action@v1 with: - python-version: '3.11' + bentoml-version: 'main' + python-version-file: .python-version-default - name: Install jq and curl run: sudo apt-get install -y jq curl - name: Import bot's GPG key for signing commits diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index dc4a68d1..c951dd78 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -28,10 +28,10 @@ jobs: with: fetch-depth: 0 ref: '${{ inputs.tags }}' - - name: Setup CI - uses: ./.github/actions/setup-repo + - uses: bentoml/setup-bentoml-action@59beefe94e2e8f8ebbedf555fc86bd5d1ae0a708 # ratchet:bentoml/setup-bentoml-action@v1 with: - python-version: '3.11' + bentoml-version: 'main' + python-version-file: .python-version-default - name: Create release notes run: ./.github/actions/create_release_and_archive.sh ${{ inputs.tags }} - name: Download Python artifacts diff --git a/tools/lock-actions.sh b/tools/lock-actions.sh index c4bfe052..6460d108 100755 --- a/tools/lock-actions.sh +++ b/tools/lock-actions.sh @@ -12,4 +12,3 @@ cd "$GIT_ROOT" || exit 1 ) find "${GIT_ROOT}/.github/workflows" -type f -iname '*.yml' -exec docker run -it --rm -v "${PWD}":"${PWD}" -w "${PWD}" -e RATCHET_EXP_KEEP_NEWLINES=true ghcr.io/sethvargo/ratchet:0.4.0 pin {} \; -docker run -it --rm -v "${PWD}":"${PWD}" -w "${PWD}" -e RATCHET_EXP_KEEP_NEWLINES=true ghcr.io/sethvargo/ratchet:0.4.0 pin .github/actions/setup-repo/action.yml