Containerize developer workflow #976
Workflow file for this run
This file contains hidden or 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: developer | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| pull_request: | |
| branches: | |
| - develop | |
| schedule: | |
| # Run biweekly | |
| - cron: '0 0 1 * *' | |
| - cron: '0 0 15 * *' | |
| workflow_dispatch: | |
| # Cancel in-progress workflows when pushing to a branch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| developer: | |
| runs-on: ubuntu-24.04 | |
| container: | |
| image: ghcr.io/noaa-emc/ci-common-build-cache/nceplibs-develop-ubuntu-24.04-gcc-14-mpich-x:latest | |
| volumes: | |
| - /home/runner:/root | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: ["asan", "code coverage", "memcheck", "docs", "format", "warning"] | |
| steps: | |
| - name: install-dependencies | |
| run: | | |
| apt-get update | |
| apt-get install -y gcc g++ | |
| apt-get install -y clang-format doxygen gcovr | |
| - name: load-env | |
| shell: bash | |
| run: | | |
| set -a | |
| source /entrypoint.sh | |
| set +a | |
| env >> $GITHUB_ENV | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| path: g2c | |
| - name: cache-data | |
| id: cache-data | |
| uses: actions/cache@v4 | |
| with: | |
| path: /root/data | |
| key: data-3 | |
| - name: asan | |
| if: matrix.config == 'asan' | |
| run: | | |
| set -x | |
| export CC=gcc | |
| cmake -S g2c -B g2c/build \ | |
| -DUSE_AEC=ON \ | |
| -DBUILD_G2C=ON \ | |
| -DLOGGING=On \ | |
| -DPTHREADS=ON \ | |
| -DFTP_TEST_FILES=ON \ | |
| -DFTP_LARGE_TEST_FILES=OFF \ | |
| -DTEST_FILE_DIR=/root/data \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_C_FLAGS="-g" | |
| cmake --build g2c/build --parallel 2 --verbose | |
| ctest --test-dir g2c/build --verbose --output-on-failure --rerun-failed | |
| - name: warning | |
| if: matrix.config == 'warning' | |
| run: | | |
| set -x | |
| export CC=gcc | |
| cmake -S g2c -B g2c/build \ | |
| -DUSE_AEC=ON \ | |
| -DBUILD_G2C=ON \ | |
| -DLOGGING=On \ | |
| -DPTHREADS=ON \ | |
| -DFTP_TEST_FILES=ON \ | |
| -DFTP_LARGE_TEST_FILES=OFF \ | |
| -DTEST_FILE_DIR=/root/data \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_C_FLAGS="-g" | |
| cmake --build g2c/build --verbose | |
| - name: code_coverage | |
| if: matrix.config == 'code coverage' | |
| run: | | |
| set -x | |
| export CC=gcc | |
| cmake -S g2c -B g2c/build \ | |
| -DUSE_AEC=ON \ | |
| -DBUILD_G2C=ON \ | |
| -DLOGGING=On \ | |
| -DPTHREADS=ON \ | |
| -DFTP_TEST_FILES=ON \ | |
| -DFTP_LARGE_TEST_FILES=OFF \ | |
| -DTEST_FILE_DIR=/root/data \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_C_FLAGS="-g" | |
| pwd | |
| cd g2c/build | |
| make VERBOSE=1 | |
| ctest --verbose --output-on-failure --rerun-failed | |
| gcovr --root .. -v --html-details --exclude tests --exclude CMakeFiles --print-summary -o test-coverage.html | |
| pwd | |
| ls -l | |
| ls -l src | |
| - name: memcheck | |
| if: matrix.config == 'memcheck' | |
| run: | | |
| set -x | |
| cmake -S g2c -B g2c/build \ | |
| -DUSE_AEC=ON \ | |
| -DBUILD_G2C=ON \ | |
| -DLOGGING=On \ | |
| -DPTHREADS=ON \ | |
| -DFTP_TEST_FILES=ON \ | |
| -DTEST_FILE_DIR=/root/data \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_C_FLAGS="-g" | |
| cmake --build g2c/build --parallel 2 --verbose | |
| ctest --test-dir g2c/build | |
| ls -l g2c/build | |
| - name: docs | |
| if: matrix.config == 'docs' | |
| run: | | |
| set -x | |
| cmake -S g2c -B g2c/build \ | |
| -DUSE_AEC=ON \ | |
| -DBUILD_G2C=ON \ | |
| -DENABLE_DOCS=On \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_C_FLAGS="-g" | |
| cmake --build g2c/build --parallel 2 --verbose | |
| ls -l g2c/build/docs/html | |
| - name: format | |
| if: matrix.config == 'format' | |
| run: | | |
| set -x | |
| cd g2c | |
| clang-format --version | |
| find . -name '*.[ch]'|xargs clang-format -Werror --verbose --dry-run | |
| - name: populate-data | |
| if: steps.cache-data.outputs.cache-hit != 'true' | |
| run: | | |
| mkdir /root/data | |
| if [ -d "$GITHUB_WORKSPACE/g2c/build/tests/data" ]; then | |
| cp -r $GITHUB_WORKSPACE/g2c/build/tests/data/* /root/data | |
| elif [ -d "$GITHUB_WORKSPACE/g2c/tests/data/" ]; then | |
| cp -r $GITHUB_WORKSPACE/g2c/tests/data/* /root/data | |
| else | |
| echo "Warning: no test data directory found at either $GITHUB_WORKSPACE/g2c/tests/data or $GITHUB_WORKSPACE/g2c/build/tests/data" | |
| fi | |
| - name: upload-test-coverage | |
| if: matrix.config == 'code coverage' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: g2c-test-coverage | |
| path: | | |
| *.html | |
| *.css | |
| - uses: actions/upload-artifact@v4 | |
| if: matrix.config == 'docs' | |
| with: | |
| name: docs | |
| path: | | |
| g2c/build/docs/html |