Skip to content

Merge branch 'main' of github.com:UAlbertaALTLab/morphodict #793

Merge branch 'main' of github.com:UAlbertaALTLab/morphodict

Merge branch 'main' of github.com:UAlbertaALTLab/morphodict #793

Workflow file for this run

name: Reformats source files
# write [skip reformat] to skip this workflow!
on:
push:
branches: [ main ]
env:
ACTIONS_PYTHON_VERSION: '3.10'
jobs:
# NOTE: Do all jobs SEQUENTIALLY to avoid merges
reformat-altlabel:
if: "! contains(toJSON(github.event.commits.*.message), '[skip reformat]')"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Set up Python ${{ env.ACTIONS_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.ACTIONS_PYTHON_VERSION }}
- name: Reformat
run: ./scripts/reformat-altlabels
- name: Git Auto Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "🤖🧹 reformat crk.altlabel [skip ci]"
reformat-python:
runs-on: ubuntu-22.04
# Ensure this is run **sequentially**
needs: reformat-altlabel
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Set up Python ${{ env.ACTIONS_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.ACTIONS_PYTHON_VERSION }}
- name: Install dependencies
run: "pip install black"
- name: Reformat Python
run: |
black .
- name: Git Auto Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "🤖🧹 reformat Python files [skip ci]"
reformat-javascript:
runs-on: ubuntu-22.04
# Ensure this is run **sequentially**
needs: reformat-python
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Reformat JavaScript
run: npm run reformat
- name: Git Auto Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "🤖🧹 reformat JavaScript files [skip ci]"
reformat-importjson:
if: "! contains(toJSON(github.event.commits.*.message), '[skip reformat]')"
needs: reformat-javascript
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
# For prettier
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Set up Python ${{ env.ACTIONS_PYTHON_VERSION }}
# actions/cache below uses this id to get the exact python version
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ env.ACTIONS_PYTHON_VERSION }}
- uses: actions/cache@v4
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('Pipfile.lock') }}
# sortimportjsondict is currently a django management command. If
# installing all the morphodict dependencies becomes too cumbersome,
# the command could be ported to a script without dependencies instead.
- name: 🖥 Install system dependencies
run: sudo apt-get install -y libfoma0
- name: ☤ Install pipenv
run: python3 -m pip install pipenv
- name: 📥 Install dependencies
run: pipenv install --dev
- name: Reformat files
run: "pipenv run ./crkeng-manage sortimportjson --git-files"
- name: Git Auto Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "🤖🧹 reformat importjson files [skip ci]"