From 61d3eb6b83276abe4e82608f5b2f42663b49c99f Mon Sep 17 00:00:00 2001 From: bxdd Date: Mon, 30 Oct 2023 20:35:49 +0800 Subject: [PATCH] [MNT] add test with source --- .../workflow/test_learnware_with_source.yaml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflow/test_learnware_with_source.yaml diff --git a/.github/workflow/test_learnware_with_source.yaml b/.github/workflow/test_learnware_with_source.yaml new file mode 100644 index 0000000..55bd585 --- /dev/null +++ b/.github/workflow/test_learnware_with_source.yaml @@ -0,0 +1,53 @@ +name: Test leanrnware from pip + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + timeout-minutes: 120 + + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-20.04, ubuntu-22.04, macos-11, macos-latest] + python-version: [3.8, 3.9, 3.10] + + steps: + - name: Test learnware from pip + uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Add conda to system path + run: | + # $CONDA is an environment variable pointing to the root of the miniconda directory + echo $CONDA/bin >> $GITHUB_PATH + + - name: Create conda env for macos + run: | + conda create -n learnware python=${{ matrix.python-version }} + + - name: Update pip to the latest version + run: | + conda run -n learnware python -m pip install --upgrade pip + + - name: Install learnware + run: | + conda run -n learnware python -m pip install . + + - name: Install faiss for MacOS + if: ${{ matrix.os == 'macos-11' || matrix.os == 'macos-latest' }} + run: | + conda install -c pytorch faiss + + - name: Test workflow + run: | + conda install pytest + pytest tests/test_workflow/test_workflow.py \ No newline at end of file