From 01ef25679a6a24a8563d2c376e9f7a8221673f47 Mon Sep 17 00:00:00 2001 From: Axel Bocciarelli Date: Tue, 18 Jul 2023 14:42:40 +0200 Subject: [PATCH] Format and lint on CI --- .github/workflows/format_and_lint_ui.yml | 66 ++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/format_and_lint_ui.yml diff --git a/.github/workflows/format_and_lint_ui.yml b/.github/workflows/format_and_lint_ui.yml new file mode 100644 index 000000000..b4b7111da --- /dev/null +++ b/.github/workflows/format_and_lint_ui.yml @@ -0,0 +1,66 @@ +name: Format UI + +on: [push, pull_request] + +jobs: + format: + runs-on: ubuntu-latest + + # Skip `pull_request` runs on local PRs for which `push` runs are already triggered + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + + steps: + - name: Checkout 🏷️ + uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + 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: Install Conda dependencies + run: | + conda env update --file conda-environment.yml --name base + pip install -e . + + - name: Install NPM dependencies + run: npm install --prefix ./ui + + - name: Check formatting + run: npm run --prefix ./ui prettier + + lint: + runs-on: ubuntu-latest + + # Skip `pull_request` runs on local PRs for which `push` runs are already triggered + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + + steps: + - name: Checkout 🏷️ + uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + 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: Install Conda dependencies + run: | + conda env update --file conda-environment.yml --name base + pip install -e . + + - name: Install NPM dependencies + run: npm install --prefix ./ui + + - name: Lint + run: npm run --prefix ./ui eslint