From bfe64629fd8ae61980bf6f08a21dc682b61f9009 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 1 Feb 2021 20:30:32 -0500 Subject: [PATCH] switch to do CodeQL analysis and Unittest on MacOS. currently for PRs and master --- .github/workflows/codeql-analysis.yml | 23 ++++++++------- .github/workflows/documentation.yml | 20 ------------- .github/workflows/style.yml | 42 --------------------------- .github/workflows/unittest-macos.yml | 36 +++++++++++++++++++++++ 4 files changed, 49 insertions(+), 72 deletions(-) delete mode 100644 .github/workflows/documentation.yml delete mode 100644 .github/workflows/style.yml create mode 100644 .github/workflows/unittest-macos.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4bf207b49b..7507db07ef 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -4,6 +4,8 @@ name: "CodeQL Code Analysis" on: push: branches: [master] + pull_request: + branches: [master] jobs: analyze: @@ -14,33 +16,34 @@ jobs: strategy: fail-fast: false matrix: - # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] language: ['cpp', 'python'] steps: - name: Checkout repository uses: actions/checkout@v2 with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. fetch-depth: 2 - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' - # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v1 with: languages: ${{ matrix.language }} + - name: Create Build Environment + run: cmake -E make_directory ${{github.workspace}}/build + - name: Building LAMMPS via CMake if: ${{ matrix.language == 'cpp' }} + shell: bash + working-directory: ${{github.workspace}}/build run: | - cmake -B build -C cmake/presets/most.cmake cmake -DCMAKE_BUILD_TYPE=Debug - make -C build -j2 + cmake -C $GITHUB_WORKSPACE/cmake/presets/most.cmake $GITHUB_WORKSPACE/cmake + cmake --build . --parallel 2 - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml deleted file mode 100644 index 9a85f4897d..0000000000 --- a/.github/workflows/documentation.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: documentation -on: - push: - branches: - - master - paths: - - 'doc/*' - -jobs: - build: - continue-on-error: true - runs-on: ubuntu-latest - container: "lammps/buildenv:fedora32_mingw" - strategy: - matrix: - target: ['html', 'pdf', 'spelling'] - steps: - - uses: actions/checkout@master - - name: Generate ${{ matrix.target }} - run: make -C doc ${{ matrix.target }} diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml deleted file mode 100644 index 8b9d55b22f..0000000000 --- a/.github/workflows/style.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: style -on: - push: - branches: - - master - -jobs: - check_whitespace: - runs-on: ubuntu-latest - steps: - - name: Set up Python 3.6 - uses: actions/setup-python@v2 - with: - python-version: 3.6 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install --upgrade pyyaml - sudo apt install -y ninja-build - - uses: actions/checkout@master - - name: Configure - run: cmake -B build -G Ninja -D Python3_EXECUTABLE=$(which python) -S cmake - - name: Check for whitespace errors - run: cmake --build build --target check-whitespace - - check_permissions: - runs-on: ubuntu-latest - steps: - - name: Set up Python 3.6 - uses: actions/setup-python@v2 - with: - python-version: 3.6 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install --upgrade pyyaml - sudo apt install -y ninja-build - - uses: actions/checkout@master - - name: Configure - run: cmake -B build -G Ninja -D Python3_EXECUTABLE=$(which python) -S cmake - - name: Check file permissions - run: cmake --build build --target check-permissions diff --git a/.github/workflows/unittest-macos.yml b/.github/workflows/unittest-macos.yml new file mode 100644 index 0000000000..ed3b9562a5 --- /dev/null +++ b/.github/workflows/unittest-macos.yml @@ -0,0 +1,36 @@ +# GitHub action to build LAMMPS on MacOS and run unit tests +name: "Unittest for MacOS" + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + name: MacOS Unit Test + if: ${{ github.repository == 'lammps/lammps' }} + runs-on: macos-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 2 + + - name: Create Build Environment + run: cmake -E make_directory ${{github.workspace}}/build + + - name: Building LAMMPS via CMake + shell: bash + working-directory: ${{github.workspace}}/build + run: | + cmake -C $GITHUB_WORKSPACE/cmake/presets/most.cmake $GITHUB_WORKSPACE/cmake \ + -DENABLE_TESTING=ON -DBUILD_SHARED_LIBS=ON -DLAMMPS_EXCEPTIONS=ON + cmake --build . --parallel 2 + + - name: Run Tests + working-directory: ${{github.workspace}}/build + shell: bash + run: ctest -V