update badge update fix #27
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: Build | |
on: | |
push: | |
branches: main | |
jobs: | |
build-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 5 | |
env: | |
Elsevier_API: ${{ secrets.SCOPUS_API_KEY }} | |
ncbi_api_key: ${{ secrets.NCBI_API_KEY }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.11.6 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11.6' | |
cache: pip | |
- name: Add conda to system path | |
run: | | |
echo $CONDA/bin >> $GITHUB_PATH | |
- name: Install dependencies | |
run: | | |
conda env update --file environment.yml --name base | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=dev,notebooks | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=dev,notebooks | |
- name: Test with pytest | |
run: | | |
cd ./docs | |
mkdir -p ./tmp | |
pytest --doctest-modules --maxfail=6 -s --ignore=dev,notebooks ../mass_spectrometry/ms_functions.py ../utils.py ../spectrophotometry/spec_functions.py ../database_analysis/dban_functions.py | |
rm -rf ./tmp | |
- name: Update badges | |
if: github.event_name == 'push' | |
run: | | |
rm -rf ./docs/statics/lastupdate.svg | |
anybadge -l 'Last Updated' -c '#49eaaf' -f ./docs/static/lastupdate.svg -v "$(date +'%B %Y')" -o | |
git config --global user.name 'eduardotlc' | |
git config --global user.email 'eduardotcampos@usp.br' | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | |
git add . | |
git commit -a -m "build workflow automatic badges generation" | |
git push |