CI #5609
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: CI | |
on: | |
schedule: | |
- cron: "40 2 * * *" | |
push: | |
branches: | |
- "main" | |
tags: | |
- version-* | |
paths-ignore: | |
- "**/memilio-epidata/**" | |
pull_request: | |
types: [opened, reopened, synchronize, ready_for_review] | |
paths-ignore: | |
- "**/memilio-epidata/**" | |
workflow_dispatch: | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- uses: pre-commit/[email protected] | |
build-cpp-gcc_clang: | |
if: github.event.pull_request.draft == false | |
strategy: | |
matrix: | |
compiler: ["gcc", "clang"] | |
config: ["Debug", "Release"] | |
version: ["latest", "min"] | |
include: | |
- version: "latest" | |
os: "ubuntu-latest" | |
- version: "min" | |
os: "ubuntu-20.04" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/linux-build | |
with: | |
compiler: ${{ matrix.compiler }} | |
config: ${{ matrix.config }} | |
version: ${{ matrix.version }} | |
coverage: ${{ (matrix.compiler == 'gcc' && matrix.config == 'Debug' && matrix.version == 'latest') && 'ON' || 'OFF' }} # `c && t || f` is (usually) equivalent to `c ? t : f` | |
sanitizers: ${{ (matrix.compiler == 'gcc' && matrix.config == 'Debug' && matrix.version == 'latest') && 'ON' || 'OFF' }} | |
build-cpp-gcc-no-optional-deps: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/linux-build | |
with: | |
compiler: gcc | |
version: latest | |
config: Release | |
optional-dependencies: OFF | |
build-cpp-gcc-openmp: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/linux-build | |
with: | |
compiler: gcc | |
version: latest | |
config: Release | |
openmp: ON | |
build-cpp-msvc: | |
if: github.event.pull_request.draft == false | |
strategy: | |
matrix: | |
config: ["Debug", "Release"] | |
version: ["latest", "min"] | |
include: | |
- version: "latest" | |
os: "windows-2022" | |
- version: "min" | |
os: "windows-2019" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/windows-build | |
with: | |
config: ${{ matrix.config }} | |
version: ${{ matrix.version }} | |
build-cpp-msvc-no-optional-deps: | |
if: github.event.pull_request.draft == false | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/windows-build | |
with: | |
config: Release | |
version: latest | |
optional-dependencies: OFF | |
test-cpp-gcc_clang: | |
if: github.event.pull_request.draft == false | |
needs: build-cpp-gcc_clang | |
strategy: | |
matrix: | |
compiler: ["gcc", "clang"] | |
config: ["Debug", "Release"] | |
version: ["latest", "min"] | |
include: | |
- version: "latest" | |
os: "ubuntu-latest" | |
- version: "min" | |
os: "ubuntu-20.04" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/linux-test | |
with: | |
artifact-pattern: ${{ matrix.compiler }}-${{ matrix.version }}-${{ matrix.config }} | |
coverage: ${{ (matrix.compiler == 'gcc' && matrix.version == 'latest' && matrix.config == 'Debug') && 'ON' || 'OFF' }} | |
merge-test-artifacts: | |
needs: [test-cpp-gcc_clang, test-cpp-msvc, test-py-surrogatemodel] | |
runs-on: ubuntu-latest | |
steps: | |
- name: merge-coverage-artifacts | |
uses: actions/upload-artifact/merge@v4 | |
with: | |
name: test-cpp-coverage-reports | |
pattern: test-cpp-coverage-reports-* | |
- name: merge-linux-artifacts | |
uses: actions/upload-artifact/merge@v4 | |
with: | |
name: test-cpp-linux-report | |
pattern: test-cpp-linux-report-* | |
- name: merge-windows-artifacts | |
uses: actions/upload-artifact/merge@v4 | |
with: | |
name: test-cpp-win-report | |
pattern: test-cpp-win-report-* | |
- name: merge python reports | |
uses: actions/upload-artifact/merge@v4 | |
with: | |
name: test-py-coverage-reports-surrogatemodel | |
pattern: test-py-coverage-reports-surrogatemodel-* | |
test-cpp-gcc-no-optional-deps: | |
if: github.event.pull_request.draft == false | |
needs: build-cpp-gcc-no-optional-deps | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/linux-test | |
with: | |
artifact-pattern: gcc-latest-Release | |
optional-deps: OFF | |
test-cpp-gcc-openmp: | |
if: github.event.pull_request.draft == false | |
needs: build-cpp-gcc-openmp | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
env: | |
OMP_NUM_THREADS: 4 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/linux-test | |
with: | |
artifact-pattern: gcc-latest-Release | |
num-repeat: 10 | |
openmp: ON | |
test-cpp-msvc: | |
if: github.event.pull_request.draft == false | |
needs: build-cpp-msvc | |
strategy: | |
matrix: | |
config: ["Debug", "Release"] | |
version: ["latest", "min"] | |
include: | |
- version: "latest" | |
os: "windows-2022" | |
- version: "min" | |
os: "windows-2019" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/windows-test | |
with: | |
artifact-pattern: msvc-${{ matrix.version }}-${{ matrix.config }} | |
test-cpp-msvc-no-optional-deps: | |
if: github.event.pull_request.draft == false | |
needs: build-cpp-msvc-no-optional-deps | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/windows-test | |
with: | |
artifact-pattern: msvc-latest-Release | |
optional-deps: OFF | |
run_examples-cpp-gcc_clang: | |
if: github.event.pull_request.draft == false | |
needs: build-cpp-gcc_clang | |
strategy: | |
matrix: | |
compiler: ["gcc", "clang"] | |
config: ["Debug", "Release"] | |
version: ["latest", "min"] | |
include: | |
- version: "latest" | |
os: "ubuntu-latest" | |
- version: "min" | |
os: "ubuntu-20.04" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/linux-run_examples | |
with: | |
build-artifact: build-cpp-linux-${{ matrix.compiler }}-${{ matrix.version }}-${{ matrix.config }} | |
run_examples-cpp-msvc: | |
if: github.event.pull_request.draft == false | |
needs: build-cpp-msvc | |
strategy: | |
matrix: | |
config: ["Debug", "Release"] | |
version: ["latest", "min"] | |
include: | |
- version: "latest" | |
os: "windows-2022" | |
- version: "min" | |
os: "windows-2019" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/windows-run_examples | |
with: | |
build-artifact: build-cpp-windows-msvc-${{ matrix.version }}-${{ matrix.config }} | |
build-py-generation: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
container: quay.io/pypa/manylinux_2_28_x86_64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/build-py | |
with: | |
package: generation | |
build-py-simulation: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
container: quay.io/pypa/manylinux_2_28_x86_64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/build-py | |
with: | |
package: simulation | |
build-py-surrogatemodel: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
container: quay.io/pypa/manylinux_2_28_x86_64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/build-py | |
with: | |
package: surrogatemodel | |
test-py-generation: | |
if: github.event.pull_request.draft == false | |
strategy: | |
matrix: | |
version: ["3.8", "3.11"] | |
needs: build-py-generation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/test-py | |
with: | |
package: generation | |
test-py-simulation: | |
if: github.event.pull_request.draft == false | |
needs: build-py-simulation | |
strategy: | |
matrix: | |
version: ["3.8", "3.11"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/test-py | |
with: | |
package: simulation | |
test-py-surrogatemodel: | |
if: github.event.pull_request.draft == false | |
needs: [build-py-surrogatemodel, build-py-simulation] | |
strategy: | |
matrix: | |
version: ["3.8", "3.11"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/test-py | |
with: | |
version: ${{ matrix.version }} | |
package: surrogatemodel | |
coverage: ON | |
test-docs: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/test-docs | |
codecov: | |
if: github.event.pull_request.draft == false | |
needs: merge-test-artifacts | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get -qq update | |
sudo apt-get -qq -y install git curl | |
- name: Download python coverage report | |
uses: actions/download-artifact@v4 | |
with: | |
name: test-py-coverage-reports-surrogatemodel | |
- name: Download cpp coverage report | |
uses: actions/download-artifact@v4 | |
with: | |
name: test-cpp-coverage-reports | |
- name: Deploy to codecov.io | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: ./coverage_python | |
files: ./coverage_python/**,./coverage.info | |
verbose: true | |
pages: | |
if: github.event.pull_request.draft == false | |
permissions: | |
contents: write | |
needs: [test-docs, merge-test-artifacts] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get -qq update | |
sudo apt-get -qq -y install git | |
- name: Download python coverage report | |
uses: actions/download-artifact@v4 | |
with: | |
name: test-py-coverage-reports-surrogatemodel | |
- name: Download cpp coverage report | |
uses: actions/download-artifact@v4 | |
with: | |
name: test-cpp-coverage-reports | |
- name: Download pylint report | |
#if an error occurs here, the pylint report was not built, probably manually trigger epidata-ci | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
github_token: ${{secrets.GITHUB_TOKEN}} | |
workflow: epidata_main.yml | |
name: pylint-report-epidata | |
path: pycode/build_pylint | |
- name: Download documentation | |
uses: actions/download-artifact@v4 | |
with: | |
name: documentation | |
path: docs/html | |
- name: Prepare basic Pages sites | |
run: | | |
mkdir -p public | |
cp docs/style.css public/style.css | |
cp docs/index.html public/index.html | |
- name: Prepare pylint reports | |
run: | | |
mkdir -p public/pylint | |
cp pycode/build_pylint/pylint.html public/pylint/index.html | |
- name: Prepare documentation | |
run: | | |
mkdir -p public/documentation | |
cp -r docs/html/* public/documentation | |
- name: Prepare coverage reports | |
run: | | |
mkdir -p public/coverage | |
mkdir -p public/coverage/cpp | |
mkdir -p public/coverage/python | |
cp -r coverage_python/* public/coverage/python/ | |
cp -r coverage/* public/coverage/cpp/ | |
- name: Upload pages as artifact | |
uses: actions/upload-artifact@v4 | |
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/main' | |
with: | |
name: pages | |
path: public | |
if-no-files-found: error | |
retention-days: 1 | |
- name: Deploy to gh-pages branch | |
uses: peaceiris/actions-gh-pages@v3 | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public |