Use ruff for code style checks. #353
Workflow file for this run
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: Test | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
# Trigger on pull requests. | |
pull_request: | |
# Trigger on pushes to the mainline branches. This prevents building commits twice when the pull | |
# request source branch is in the same repository. | |
push: | |
branches: | |
- "trunk" | |
- "trunk-major" | |
# Trigger on request. | |
workflow_dispatch: | |
# Weekly builds on the trunk branch to check that the examples continue to work with the latest | |
# development version of HOOMD. | |
schedule: | |
- cron: '0 18 * * 1' | |
jobs: | |
start_action_runners: | |
name: Start action runners | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Use jetstream2-admin/start" | |
uses: glotzerlab/jetstream2-admin/[email protected] | |
with: | |
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }} | |
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }} | |
number: 1 | |
execute_notebooks: | |
name: Execute notebooks | |
runs-on: [self-hosted,jetstream2,CPU] | |
container: | |
image: glotzerlab/software:nompi | |
options: -u 0 | |
steps: | |
- name: Clean workspace | |
run: ( shopt -s dotglob nullglob; rm -rf ./* ) | |
shell: bash | |
# build the HOOMD trunk-minor branch to test the tutorials on the latest version | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
path: hoomd | |
ref: trunk-major | |
repository: glotzerlab/hoomd-blue | |
submodules: true | |
- name: Make build directory | |
run: mkdir build | |
working-directory: hoomd | |
- name: Configure | |
run: >- | |
cmake | |
-DCMAKE_BUILD_TYPE=Release | |
-DENABLE_GPU=off | |
-DENABLE_MPI=off | |
-DENABLE_TBB=off | |
-DBUILD_TESTING=off | |
-DENABLE_LLVM=on | |
../ | |
working-directory: hoomd/build | |
- name: Compile | |
run: make -j $(($(getconf _NPROCESSORS_ONLN) + 2)) | |
working-directory: hoomd/build | |
- name: Display hoomd version | |
run: python3 -c "import hoomd; print(hoomd.version.version, hoomd.version.git_sha1)" | |
env: | |
PYTHONPATH: ${{ github.workspace }}/hoomd/build | |
# clone the tutorials and run them | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
path: notebooks | |
- name: List notebooks | |
run: ls **/*.ipynb | |
working-directory: notebooks | |
- name: Execute notebooks | |
run: 'for i in */; do echo "Running notebooks in: $i" && jupyter nbconvert --execute --inplace $i/*.ipynb || exit 1; done' | |
working-directory: notebooks | |
env: | |
PYTHONPATH: ${{ github.workspace }}/hoomd/build | |
# This check is very basic, but we don't want to use `python -W error` as it will also catch any | |
# warnings generated inside nbconvert and its dependencies. | |
- name: Check for warnings | |
run: | | |
has_warnings=0 | |
for file in **/*.ipynb | |
do | |
grep Warning $file && echo "::error file=${file}::Has deprecation warnings" && has_warnings=1 | |
done | |
exit ${has_warnings} | |
working-directory: notebooks | |
# notify developers if the scheduled check fails | |
- name: Slack notification | |
if: ${{ github.event_name == 'schedule' && (failure() || cancelled()) }} | |
uses: 8398a7/[email protected] | |
with: | |
status: ${{ job.status }} | |
fields: workflow,job,message,commit | |
mention: channel | |
if_mention: failure,cancelled | |
channel: '#dev-hoomd-notifications' | |
username: Github Action | |
author_name: '' | |
job_name: Execute notebooks | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
- name: Clean workspace | |
run: ( shopt -s dotglob nullglob; rm -rf ./* ) | |
shell: bash | |
- name: Clean HOME | |
run: ( shopt -s dotglob nullglob; rm -rf $HOME/* ) | |
shell: bash |