forked from facebookresearch/xformers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert circleci workflows to github actions
- Loading branch information
Showing
7 changed files
with
170 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,21 @@ | ||
name: check-torch | ||
description: 'Check PyTorch version' | ||
inputs: | ||
major: | ||
description: 'Major version of PyTorch' | ||
required: true | ||
minor: | ||
description: 'Minor version of PyTorch' | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Check the installed PyTorch version | ||
shell: bash -el {0} | ||
run: | | ||
which python | ||
python -c 'import torch; print("Torch version:", torch.__version__)' | ||
python -c 'import torch; assert torch.__version__ > ( <<parameters.major>>, <<parameters.minor>>), "wrong torch version"' | ||
python -m torch.utils.collect_env | ||
wget -O ~/venv/check_version.py https://raw.githubusercontent.com/min-xu-ai/check_verion/main/check_version.py |
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,16 @@ | ||
name: install-dep | ||
description: 'Install dependencies' | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Install Dependencies with torch nightly | ||
shell: bash -el {0} | ||
run: | | ||
# for faster builds | ||
conda install ninja | ||
echo "Ninja version $(ninja --version)" | ||
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia -q | ||
python -m pip install cmake | ||
python -m pip install -r requirements-benchmark.txt --progress-bar off |
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,14 @@ | ||
name: install-repo | ||
description: 'Install repository' | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Install Repository | ||
shell: bash -el {0} | ||
run: | | ||
python -m pip install -v -e . | ||
# Test import. | ||
python -c 'import sys; sys.path = sys.path[1:]; import xformers' | ||
ls xformers | ||
python -m xformers.info |
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,14 @@ | ||
name: run-doc-build | ||
description: 'Run documentation build' | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Testing doc build | ||
shell: bash -el {0} | ||
run: | | ||
cd docs | ||
# Don't install PyTorch as we already pulled it from conda, and we'd risk having two conflicting versions | ||
python -m pip install $(grep -ivE "^#|^torch" requirements.txt) | ||
make help | ||
make singlehtml | tee make.out | ||
! tail make.out | grep -q warning |
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,9 @@ | ||
name: run-unittests | ||
description: 'Run unit tests' | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Run Unit Tests | ||
shell: bash -el {0} | ||
run: | | ||
python -m pytest --random-order-bucket=global --junitxml=test-results/junit.xml --verbose --maxfail=20 tests |
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,46 @@ | ||
name: setup-miniconda | ||
description: 'Setup Miniconda' | ||
inputs: | ||
python-version: | ||
description: 'Python version to install' | ||
default: '3.8' | ||
auto-update-conda: | ||
description: 'Whether to update conda' | ||
default: 'true' | ||
activate-environment: | ||
description: 'Name of the conda environment to activate' | ||
default: 'xformers' | ||
outputs: | ||
cache-hit: | ||
description: 'Whether the cache was restored' | ||
value: ${{ steps.cache.outputs.cache-hit }} | ||
runs: | ||
using: composite | ||
steps: | ||
# use my fork of the conda-incubator/setup-miniconda@v3 action | ||
# until this PR is merged: https://github.com/conda-incubator/setup-miniconda/pull/350 | ||
- name: Setup miniconda | ||
uses: robandpdx-org/setup-miniconda@fix-conda-env-var | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
auto-update-conda: ${{ inputs.auto-update-conda }} | ||
activate-environment: ${{ inputs.activate-environment }} | ||
- name: Get Date | ||
id: get-date | ||
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT | ||
shell: bash | ||
- name: Cache Conda env | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.CONDA }}/envs | ||
key: | ||
conda-${{ runner.os }}-${{ runner.arch }}-${{steps.get-date.outputs.today }}-${{ env.CACHE_NUMBER }} | ||
env: | ||
CACHE_NUMBER: '0' | ||
id: cache | ||
- name: Conda info | ||
shell: bash -el {0} | ||
run: | | ||
conda config --set always_yes yes | ||
conda install pip | ||
conda info -a |
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,50 @@ | ||
name: Tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
# paths: | ||
# - 'xformers/**' | ||
# - '.github/workflows/test.yml' | ||
# - 'setup.py' | ||
# - 'requirements.*' | ||
# - '.circleci/**' | ||
jobs: | ||
cpu_tests_py38: | ||
runs-on: 4-core-ubuntu-latest | ||
env: | ||
MAX_JOBS: "4" | ||
defaults: | ||
run: | ||
shell: bash -el {0} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Remove internal components, as they require GPU | ||
run: | | ||
mkdir -p .github/sync.fairinternal | ||
touch .github/sync.fairinternal/ossify.sh | ||
chmod +x .github/sync.fairinternal/ossify.sh | ||
.github/sync.fairinternal/ossify.sh | ||
- name: Setup Miniconda | ||
id: setup-miniconda | ||
uses: ./github/actions/setup-miniconda | ||
- name: Install Dependencies | ||
if: steps.setup-miniconda.outputs.cache-hit != 'true' | ||
uses: ./github/actions/install-dep | ||
- name: Check PyTorch version | ||
uses: ./github/actions/check-torch | ||
with: | ||
major: 2 | ||
minor: 1 | ||
- name: Run unit tests | ||
uses: ./github/actions/run-unittests | ||
- name: Run doc build | ||
uses: ./github/actions/run-doc-build | ||
- name: Store test results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: test-results | ||
path: test-results |