-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Russell Bryant <[email protected]>
- Loading branch information
Showing
2 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: 'Free Disk Space' | ||
description: 'Frees disk space on the runner' | ||
runs: | ||
using: "composite" | ||
steps: | ||
- run: | | ||
df -h | ||
sudo docker rmi "$(docker image ls -aq)" >/dev/null 2>&1 || true | ||
sudo rm -rf \ | ||
/usr/share/dotnet /usr/local/lib/android /opt/ghc \ | ||
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \ | ||
/usr/lib/jvm || true | ||
sudo apt install aptitude -y >/dev/null 2>&1 | ||
sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1 | ||
sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1 | ||
sudo apt-get autoremove -y >/dev/null 2>&1 | ||
sudo apt-get autoclean -y >/dev/null 2>&1 | ||
df -h | ||
shell: bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Test | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- "main" | ||
- "release-**" | ||
paths: | ||
- '**.py' | ||
- 'pyproject.toml' | ||
- 'requirements*.txt' | ||
- 'tox.ini' | ||
- '.github/workflows/test.yml' # This workflow | ||
pull_request: | ||
branches: | ||
- "main" | ||
- "release-**" | ||
paths: | ||
- '**.py' | ||
- 'pyproject.toml' | ||
- 'requirements*.txt' | ||
- 'tox.ini' | ||
- '.github/workflows/test.yml' # This workflow | ||
|
||
env: | ||
LC_ALL: en_US.UTF-8 | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
name: "${{ matrix.python }} on ${{ matrix.platform }}" | ||
runs-on: "${{ matrix.platform }}" | ||
strategy: | ||
matrix: | ||
python: | ||
- "3.10" | ||
- "3.11" | ||
platform: | ||
- "ubuntu-latest" | ||
include: | ||
- python: "3.11" | ||
platform: "macos-latest" | ||
steps: | ||
- name: "Harden Runner" | ||
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 | ||
with: | ||
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | ||
|
||
- name: Checkout | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
# https://github.com/actions/checkout/issues/249 | ||
fetch-depth: 0 | ||
|
||
- name: Free disk space | ||
if: matrix.platform != 'macos-latest' | ||
uses: ./.github/actions/free-disk-space | ||
|
||
- name: Install the expect package | ||
if: startsWith(matrix.platform, 'ubuntu') | ||
run: | | ||
sudo apt-get install -y expect | ||
- name: Install tools on MacOS | ||
if: startsWith(matrix.platform, 'macos') | ||
run: | | ||
brew install expect coreutils bash | ||
- name: Setup Python ${{ matrix.python }} | ||
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
cache: pip | ||
cache-dependency-path: | | ||
**/pyproject.toml | ||
**/requirements*.txt | ||
- name: Remove llama-cpp-python from cache | ||
run: | | ||
pip cache remove llama_cpp_python | ||
- name: Cache huggingface | ||
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | ||
with: | ||
path: ~/.cache/huggingface | ||
# config contains DEFAULT_MODEL | ||
key: huggingface-${{ hashFiles('src/instructlab/configuration.py') }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install tox tox-gh>=1.2 | ||
- name: Run unit tests with tox | ||
run: | | ||
tox | ||
- name: Remove llama-cpp-python from cache | ||
if: always() | ||
run: | | ||
pip cache remove llama_cpp_python | ||
test-workflow-complete: | ||
needs: ["test"] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Test Workflow Complete | ||
run: echo "Test Workflow Complete" |