From 4125a6ddd4de80ea7025b28ce96f79df7d2a7798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Rozet?= Date: Mon, 29 Jan 2024 16:34:46 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Add=20linting=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dummy.yml | 11 +++++++++++ .github/workflows/lint.yml | 19 +++++++++++++++++++ .github/workflows/test.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/tests.yml | 31 ------------------------------- 4 files changed, 59 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/dummy.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/dummy.yml b/.github/workflows/dummy.yml new file mode 100644 index 0000000..5d12273 --- /dev/null +++ b/.github/workflows/dummy.yml @@ -0,0 +1,11 @@ +name: Dummy workflow + +on: + workflow_dispatch: + +jobs: + dummy: + runs-on: ubuntu-latest + steps: + - run: env | grep ^GITHUB + - run: echo $GITHUB_REF diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..12843ed --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,19 @@ +name: Linter & formatter + +on: + workflow_dispatch: + pull_request: + +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run linter + uses: chartboost/ruff-action@v1 + with: + args: check + - name: Run formatter + uses: chartboost/ruff-action@v1 + with: + args: format --check diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7acc7a5 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,29 @@ +name: Package tests + +on: + workflow_dispatch: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.10"] + torch-version: ["1.12", "2.0"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + pip install pytest + pip install torch==${{ matrix.torch-version }} --extra-index-url https://download.pytorch.org/whl/cpu + pip install . + - name: Test with pytest + run: pytest tests diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 928ef10..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Package tests - -on: - workflow_dispatch: - pull_request: - branches: - - master - -jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.8", "3.10"] - torch-version: ["1.12", "2.0"] - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools - pip install pytest - pip install torch==${{ matrix.torch-version }} --extra-index-url https://download.pytorch.org/whl/cpu - pip install . - - name: Test with pytest - run: pytest tests