From c2bc5b6e496861caa4177d3b4abb2456a5f27724 Mon Sep 17 00:00:00 2001 From: "Mauricio A. Rovira Galvez" <8482308+marovira@users.noreply.github.com> Date: Sat, 23 Mar 2024 17:41:28 -0700 Subject: [PATCH] [brief] Adds CI actions. [detailed] --- .github/workflows/pytest.yml | 60 +++++++++++++++++++++++++++++++++++ .github/workflows/ruff.yml | 61 ++++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 .github/workflows/pytest.yml create mode 100644 .github/workflows/ruff.yml diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..3f35740 --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,60 @@ +name: PyTest + +on: + push: + branches: [ master ] + paths-ignore: + - 'README.md' + - '.pre-commit-config.yaml' + - 'data/**' + - "LICENSE" + pull_request: + branches: [ master ] + paths-ignore: + - 'README.md' + - 'LICENSE' + workflow_dispatch: + +jobs: + build: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + stategy: + fail-fast: false + matrix: + config: + - { + name: "Linux", + os: ubunut-latest, + } + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + id: setup_python + with: + python-version: "3.11" + + - name: Cache virtualenv + uses: actions/cache@v3 + with: + key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('requirements/ci.txt') }} + path: venv + + - name: Install dependencies + run: | + python -m venv venv + source venv/bin/activate + python -m pip install -r requirements/ci.txt + echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH + echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV + + - name: Install Pyro + shell: bash + run: | + pip install . + ruff check src/pyro + + - name: Test + run: | + pytest diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..f9b38ee --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,61 @@ +name: Ruff + +on: + push: + branches: [ master ] + paths-ignore: + - 'README.md' + - '.pre-commit-config.yaml' + - 'data/**' + - "LICENSE" + pull_request: + branches: [ master ] + paths-ignore: + - 'README.md' + - 'LICENSE' + workflow_dispatch: + +jobs: + build: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + stategy: + fail-fast: false + matrix: + config: + - { + name: "Linux", + os: ubunut-latest, + } + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + id: setup_python + with: + python-version: "3.11" + + - name: Cache virtualenv + uses: actions/cache@v3 + with: + key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('requirements/ci.txt') }} + path: venv + + - name: Install dependencies + run: | + python -m venv venv + source venv/bin/activate + python -m pip install -r requirements/ci.txt + echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH + echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV + + - name: Install Pyro + shell: bash + run: | + pip install . + ruff check src/pyro + + - name: Lint + run: | + ruff check src/pyro + ruff check test