From 76d101e937ff21e9f0ad6e56e5dc3be46e7d7cb7 Mon Sep 17 00:00:00 2001 From: Donghyun Kim Date: Mon, 25 Nov 2024 08:39:36 -0600 Subject: [PATCH] Add Github workflow for running linter (#25) --- .github/workflows/lint.yaml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..6f83e61 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,35 @@ +name: Build + +on: + push: + branches: + - main + pull_request: + - '**' + +# Only the latest workflow run is allowed to run for each PR / branch +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-24.04 + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v4 + # Cache python dependencies using "requirements.txt" as the cache key + - name: Cache Dependencies 📂 + uses: actions/cache@v3 + with: + path: ./.venv/ + key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-venv- + # Install python dependencies only if cache was not hit + # `--system-site-packages` argument is used to allow access to system site packages (e.g., bcc) + - name: Install Dependencies 📦 + run: python -m venv --system-site-packages ./.venv && . ./.venv/bin/activate && pip install -r requirements.txt + if: steps.cache-venv.outputs.cache-hit != 'true' + - name: Run Ruff Linter 🚨 + run: . ./.venv/bin/activate && make lint