switch to pre-commit #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- main | |
- develop | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13" | |
- name: Install dependencies | |
run: | | |
pip install pip --upgrade | |
if grep version pyproject.toml | grep -q "dev"; | |
then pip install https://github.com/fiduswriter/fiduswriter/archive/develop.zip; | |
else pip install https://github.com/fiduswriter/fiduswriter/archive/main.zip; | |
fi | |
- uses: pre-commit/action@v3.0.1 | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- uses: actions/checkout@v3 | |
- uses: nanasess/setup-chromedriver@master | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install libjpeg-dev python3-dev python3-pip gettext zlib1g-dev git nodejs build-essential | |
cd fiduswriter | |
mv ../ci/configuration.py ./ | |
mv ../ci/.coveragerc ./ | |
pip install requests[security] | |
pip install coverage | |
pip install coveralls | |
pip install selenium | |
pip install packaging | |
pip install webdriver-manager | |
pip install wheel | |
pip install pip --upgrade | |
if grep version pyproject.toml | grep -q "dev"; | |
then pip install https://github.com/fiduswriter/fiduswriter/archive/develop.zip; | |
else pip install https://github.com/fiduswriter/fiduswriter/archive/main.zip; | |
fi | |
if grep version pyproject.toml | grep -q "dev"; | |
then pip install https://github.com/fiduswriter/fiduswriter-books/archive/develop.zip; | |
else pip install https://github.com/fiduswriter/fiduswriter-books/archive/main.zip; | |
fi | |
coverage run $(which fiduswriter) setup --no-static | |
- name: Run test citation_api_import | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 8 | |
max_attempts: 3 | |
retry_on: error | |
command: | | |
cd fiduswriter | |
coverage run $(which fiduswriter) test citation_api_import | |
- name: Coveralls | |
run: | | |
cd fiduswriter | |
coveralls --service=github | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
finish: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
run: curl "https://coveralls.io/webhook?repo_token=${{ secrets.GITHUB_TOKEN }}&repo_name=${{ github.repository }}" -d "payload[build_num]=${{ github.run_id }}&payload[status]=done" |