CI #1440
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: CI | |
| on: | |
| push: | |
| branches: [ master, dev ] | |
| pull_request: | |
| branches: | |
| - '**' | |
| schedule: | |
| - cron: '0 0 * * 0' | |
| workflow_dispatch: | |
| jobs: | |
| # === Test that code is tidy (i.e., follows Empirical standards) === | |
| tidy: | |
| name: Enforce Tidyness using Empecable | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - run: sudo apt-get update -qq | |
| - run: cd demos/Empecable ; make ; cd ../../ | |
| - run: demos/Empecable/Empecable include/emp/*/*.hpp include/emp/web/d3/*.hpp -v | |
| # Test that the code has been formatted with clang format. | |
| format: | |
| name: Check Clang Format | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - run: | | |
| # Fetch and run LLVM's official installer script | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod +x llvm.sh | |
| sudo ./llvm.sh 20 # installs clang-format-20 and friends | |
| sudo apt-get install -y clang-format-20 | |
| - run: clang-format-20 --version | |
| - run: clang-format-20 --dry-run --Werror include/emp/*/*.?pp | |
| # === Run all of the compilation tests on Ubuntu === | |
| test: | |
| name: Tests | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| cxx: [clang++, g++] | |
| test-set: | |
| - test-native-fulldebug | |
| - test-native-opt | |
| - test-examples | |
| - test-demos | |
| # - test-native-regular | |
| # - test-cookiecutter | |
| env: | |
| CXX: ${{ matrix.cxx }} | |
| TEST_SET: ${{ matrix.test-set }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Set up GCC | |
| uses: egor-tensin/setup-gcc@v1 | |
| with: | |
| version: 14 | |
| - name: Set up clang | |
| uses: egor-tensin/setup-clang@v1 | |
| with: | |
| version: 18 | |
| - run: sudo apt-get update -qq | |
| - run: sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test | |
| - run: sudo apt-get update -qq | |
| - run: sudo apt-get install -qq cmake build-essential python3-pip python3-virtualenv nodejs tar gzip libpthread-stubs0-dev libc6-dbg gdb | |
| - run: git fetch origin master:refs/remotes/origin/master | |
| - run: make install-test-dependencies | |
| - run: ${CXX} --version | |
| - run: | | |
| source third-party/emsdk/emsdk_env.sh | |
| make ${TEST_SET} CXX=${CXX} | |
| # === Make sure all of the web-based tests work when compiling with Emscripten === | |
| # test-web: | |
| # name: Web Tests | |
| # runs-on: ubuntu-24.04 | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # with: | |
| # submodules: 'recursive' | |
| # - name: Set up GCC | |
| # uses: egor-tensin/setup-gcc@v1 | |
| # with: | |
| # version: 14 | |
| # - run: sudo apt-get update -qq | |
| # - run: sudo apt-get install -qq cmake build-essential python3-pip python3-virtualenv nodejs tar gzip libpthread-stubs0-dev libc6-dbg gdb | |
| # - run: make install-test-dependencies | |
| # - name: Run headless test | |
| # uses: GabrielBB/xvfb-action@v1 | |
| # with: | |
| # run: make test-web | |
| test-web: | |
| name: Web Tests | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Set up GCC | |
| uses: egor-tensin/setup-gcc@v1 | |
| with: | |
| version: 14 | |
| - name: Set up Dependencies | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -qq cmake build-essential python3-pip python3-virtualenv nodejs tar gzip libpthread-stubs0-dev libc6-dbg gdb | |
| make install-test-dependencies | |
| - name: Set up Emscripten | |
| run: | | |
| cd third-party/emsdk | |
| ./emsdk install 3.1.64 | |
| ./emsdk activate 3.1.64 | |
| source ./emsdk_env.sh | |
| emcc --version | |
| - name: Run headless test | |
| uses: GabrielBB/xvfb-action@v1 | |
| with: | |
| run: bash -c "source third-party/emsdk/emsdk_env.sh && make test-web" | |
| # === Check that our unit tests cover as much code as possible === | |
| test-coverage: | |
| name: Measure Test Coverage | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Set up clang | |
| uses: egor-tensin/setup-clang@v1 | |
| with: | |
| version: 18 | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - run: clang++ --version | |
| - run: sudo apt-get update -qq | |
| - run: sudo apt-get install cmake build-essential python3-virtualenv python3-pip nodejs tar gzip clang llvm-dev libclang-dev | |
| - run: git fetch origin master:refs/remotes/origin/master | |
| - run: make install-test-dependencies | |
| - run: export CXX=clang++ && make install-coverage-dependencies | |
| - run: export CXX=clang++ && make coverage | |
| - run: curl -s https://codecov.io/bash | bash | |
| # adapted from https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#publishing-a-package-using-an-action | |
| build-container: | |
| name: Build Docker Image | |
| runs-on: ubuntu-24.04 | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: type=raw,value=ACTIONS_BUILD_${{ github.run_number }} | |
| - name: Push to GHCR | |
| uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| # === Make sure our documentation can still be auto-built === | |
| test-documentation: | |
| name: Test Documentation Build | |
| runs-on: ubuntu-24.04 | |
| needs: build-container | |
| container: | |
| image: ghcr.io/devosoft/empirical:ACTIONS_BUILD_${{ github.run_number }} | |
| # github actions requires root to access mounted volumes | |
| options: --user root | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - run: doxygen | |
| - run: cd doc && python make_md.py | |
| - run: cd doc && make html | ./headtail.sh | |
| - run: cd doc && make coverage | |
| - run: ls doc/ && ls doc/_build | |
| - run: cd doc && python parse_documentation_coverage.py _build/doc-coverage.json >> doc-coverage.json | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: doc-coverage | |
| path: doc/doc-coverage.json | |
| deploy-documentation-coverage: | |
| name: Deploy Documentation Coverage | |
| runs-on: ubuntu-24.04 | |
| if: github.ref == 'refs/heads/master' | |
| needs: test-documentation | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: doc-coverage | |
| path: data | |
| - uses: sylvanld/action-storage@v1 | |
| with: | |
| src: data/doc-coverage.json | |
| dst: data/doc-coverage.json | |
| paper: | |
| runs-on: ubuntu-latest | |
| name: Paper Draft | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Build draft PDF | |
| uses: openjournals/openjournals-draft-action@master | |
| with: | |
| journal: joss | |
| # This should be the path to the paper within your repo. | |
| paper-path: paper.md | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: paper | |
| # This is the output path where Pandoc will write the compiled | |
| # PDF. Note, this should be the same directory as the input | |
| # paper.md | |
| path: paper.pdf | |
| deploy-container: | |
| name: Deploy to DockerHub | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| packages: write | |
| if: github.ref == 'refs/heads/master' | |
| needs: | |
| - tidy | |
| - format | |
| - test | |
| - test-web | |
| - test-coverage | |
| - test-documentation | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Push to Docker Hub | |
| uses: docker/build-push-action@v1 | |
| with: | |
| push: true | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| repository: devosoft/empirical | |
| tag_with_ref: true |