Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

added formatting workflows for JSON and python #16

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/music-box-interactive-folder/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Auto format javascript code with prettier

on:
push:
branches:
- main

jobs:
prettier:
runs-on: ubuntu-latest
steps:

- name: Check out code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install packages
run: npm install

- name: Format code
run: npm run format

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: prettier action fixes
title: Fixes by prettier action
body: This is an auto-generated PR with fixes by prettier.
branch: prettier-patches
27 changes: 27 additions & 0 deletions .github/workflows/music-box-interactive-folder/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Run Tests

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 21

- name: Install dependencies
run: npm install

- name: Run tests
run: npm run test
54 changes: 54 additions & 0 deletions .github/workflows/musica/clang_format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Clang-Format

on:
push:
branches:
- main
workflow_dispatch:

jobs:
format:
name: Run Clang-Format
runs-on: ubuntu-latest

steps:
- name: Install Clang-Format
run: sudo apt-get update && sudo apt-get install clang-format && clang-format --version

- name: Check out code, run clang format, push changes
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run clang-format
run: |
find include -type f \( -name '*.hpp' -or -name '*.h' \) -exec clang-format -i --style=file --verbose {} +
find src -type f \( -name '*.cpp' -or -name '*.c' \) -exec clang-format -i --style=file --verbose {} +

- name: Check for changes
id: check-changes
run: git diff --exit-code
continue-on-error: true

- name: Commit and push changes
# a failue of this step means changes were detected
if: steps.check-changes.outcome != 'success'
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git commit -am "Auto-format code using Clang-Format" || echo "No changes to commit"

- name: Push changes to main-formatting branch
if: steps.check-changes.outcome != 'success'
run: git push origin HEAD:main-formatting

- name: Create Pull Request
if: steps.check-changes.outcome != 'success'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Auto-format code using Clang-Format"
title: "Auto-format code changes"
body: "This is an automated pull request to apply code formatting using Clang-Format."
branch: main-formatting
59 changes: 59 additions & 0 deletions .github/workflows/musica/clang_tidy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Clang-Tidy

on:
push:
branches:
- main
workflow_dispatch:

jobs:
format:
name: Run clang-tidy
runs-on: ubuntu-latest

steps:
- name: Install clang-tidy
run: sudo apt-get update && sudo apt-get install clang-tidy && clang-tidy --version

- name: Check out code, run clang-tidy, push changes
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run clang-tidy
# Currently disabled
if: false
run: |
find include -type f \( -name '*.hpp' -or -name '*.h' \) -exec clang-tidy --config-file="./.clang-tidy" --fix-errors {} +
find src -type f \( -name '*.cpp' -or -name '*.c' \) ! -path 'src/test/*' -exec clang-tidy --config-file="./.clang-tidy" --fix-errors {} +
find python -type f \( -name '*.cpp' -or -name '*.c' \) -exec clang-tidy --config-file="./.clang-tidy" --fix-errors {} +

continue-on-error: true

- name: Check for changes
id: check-changes
run: git diff --exit-code
continue-on-error: true

- name: Commit and push changes
# a failue of this step means changes were detected
if: steps.check-changes.outcome != 'success'
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git commit -am "Auto-format code using clang-tidy" || echo "No changes to commit"

- name: Push changes to clang-tidy-format branch
if: steps.check-changes.outcome != 'success'
run: git push origin HEAD:clang-tidy-format

- name: Create Pull Request
if: steps.check-changes.outcome != 'success'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Auto-format code using clang-tidy"
title: "Auto-format code changes"
body: "This is an automated pull request to apply code formatting using clang-tidy."
branch: clang-tidy-format
61 changes: 61 additions & 0 deletions .github/workflows/musica/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Docker

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
docker-build-and-test:
name: Build and Test - ${{ matrix.dockerfile }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
dockerfile:
- Dockerfile
- Dockerfile.memcheck
- Dockerfile.fortran-gcc
- Dockerfile.openmp
- Dockerfile.mpi
- Dockerfile.mpi_openmp
- Dockerfile.python
- Dockerfile.pip
build_type: [Release, Debug]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache

- name: Build Docker image
run: docker build -t musica -f docker/${{ matrix.dockerfile }} . --build-arg MUSICA_GIT_TAG=${{ github.sha }} --build-arg BUILD_TYPE=${{ matrix.build_type }}

- name: Run tests in container
if: matrix.dockerfile != 'Dockerfile.coverage' && matrix.dockerfile != 'Dockerfile.pip'
run: docker run --name test-container -t musica bash -c 'make test ARGS="--rerun-failed --output-on-failure -j8"'

- name: Run coverage tests in container
if: matrix.dockerfile == 'Dockerfile.coverage'
run: docker run --name test-container -t musica bash -c 'make coverage ARGS="--rerun-failed --output-on-failure -j8"'

- name: Copy coverage from container
if: matrix.dockerfile == 'Dockerfile.coverage'
run: docker cp test-container:build/coverage.info .

- name: Upload coverage report
if: matrix.dockerfile == 'Dockerfile.coverage'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.info
44 changes: 44 additions & 0 deletions .github/workflows/musica/fetch_content_integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: FetchContentIntegration

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
docker-build-and-test:
name: Build and Test - ${{ matrix.dockerfile }}
runs-on: ubuntu-latest
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
dockerfile:
- Dockerfile.fortran-intel
- Dockerfile.fortran-gcc.integration
- Dockerfile.fortran-nvhpc
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Print branch name
run: echo "Branch name is $BRANCH_NAME"

- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache

- name: Build Docker image
run: docker build -t musica --build-arg MUSICA_GIT_TAG=${BRANCH_NAME} -f docker/${{ matrix.dockerfile }} .

- name: Run tests in container
run: docker run --name test-container -t musica bash -c 'make test ARGS="--rerun-failed --output-on-failure -j8"'
Loading
Loading