-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lionel Untereiner
committed
Aug 1, 2024
1 parent
c2fe0d3
commit 6e34005
Showing
2 changed files
with
204 additions
and
146 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
name: GEOS CI | ||
name: Builds | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
branches: | ||
- develop | ||
pull_request: | ||
types: [opened, synchronize, reopened, edited] | ||
workflow_dispatch: | ||
|
||
# Cancels in-progress workflows for a PR when updated | ||
|
@@ -16,125 +15,11 @@ concurrency: | |
# Please define `build.args.GEOS_TPL_TAG` in `.devcontainer/devcontainer.json` | ||
|
||
jobs: | ||
# Checks if PR title follows conventional semantics | ||
semantic_pull_request: | ||
permissions: | ||
pull-requests: write # for amannn/action-semantic-pull-request to analyze PRs and | ||
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR | ||
contents: read | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check if the PR name has conventional semantics | ||
if: github.event_name == 'pull_request' | ||
uses: amannn/[email protected] | ||
id: lint_pr_title | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
wip: true | ||
# Configure that a scope doesn't need to be provided. | ||
requireScope: false | ||
|
||
- name: Skip the check on develop branch | ||
if: github.ref_name == 'develop' | ||
run: | | ||
echo "This in't a Pull-Request, skipping" | ||
# Jobs will be cancelled if PR is a draft. | ||
# PR status must be "Open" to run CI. | ||
is_not_draft_pull_request: | ||
# if: ${{ always() }} | ||
needs: [semantic_pull_request] | ||
# Everywhere in this workflow, we use the most recent ubuntu distribution available in Github Actions | ||
# to ensure maximum support of google cloud's sdk. | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
DOCKER_IMAGE_TAG: ${{ steps.extract_docker_image_tag.outputs.DOCKER_IMAGE_TAG }} | ||
steps: | ||
- name: Check that the PR is not a draft (cancel rest of jobs otherwise) | ||
id: extract_pr_info | ||
run: | | ||
if [[ ${{github.event_name}} == 'pull_request' ]]; then | ||
# We do not rely on the `github.event.pull_request.labels` information since it's cached at the job. | ||
# Changing labels or assignee in the PR would not allow to simply re-run the job with a different outcome. | ||
pr_json=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }}) | ||
# We stop the workflow if the pr is draft | ||
draft_status=$(echo ${pr_json} | jq '.draft') | ||
echo "Draft status of PR is ${draft_status}." | ||
if [[ $draft_status == true ]]; then exit 1 ; fi | ||
fi | ||
# The TPL tag is contained in the codespaces configuration to avoid duplications. | ||
- name: Checkout .devcontainer/devcontainer.json | ||
uses: actions/[email protected] | ||
with: | ||
sparse-checkout: | | ||
.devcontainer/devcontainer.json | ||
sparse-checkout-cone-mode: false | ||
submodules: false | ||
lfs: false | ||
fetch-depth: 1 | ||
- name: Extract docker image tag | ||
id: extract_docker_image_tag | ||
run: | | ||
echo "DOCKER_IMAGE_TAG=$(jq '.build.args.GEOS_TPL_TAG' -r .devcontainer/devcontainer.json)" >> "$GITHUB_OUTPUT" | ||
# PR must be assigned to be merged. | ||
# This job will fail if this is not the case. | ||
if_not_unassigned_pull_request: | ||
needs: [is_not_draft_pull_request] | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: If this is a PR, Check that it is assigned | ||
run: | | ||
if [[ ${{github.event_name}} != 'pull_request' ]]; then exit 0 ; fi | ||
pr_json=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }}) | ||
NUM_ASSIGNEES=$(echo ${pr_json} | jq '.assignees | length') | ||
echo "There are ${NUM_ASSIGNEES} assignees on this PR." | ||
if [[ $NUM_ASSIGNEES == 0 ]]; then exit 1 ; fi | ||
# Validates that the PR is still pointing to the HEAD of the main branch of the submodules repositories. | ||
# (There are exceptions, read the script about those). | ||
are_submodules_in_sync: | ||
needs: [is_not_draft_pull_request] | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
# The integrated test submodule repository contains large data (using git lfs). | ||
# To save time (and money) we do not let Github Actions automatically clone all our (lfs) subrepositories and do it by hand. | ||
- name: Checkout Repository | ||
uses: actions/[email protected] | ||
with: | ||
# Let script update submodules; Github Actions submodule history causes error | ||
submodules: false | ||
lfs: false | ||
fetch-depth: 1 | ||
- name: Check that submodules are up to date | ||
run: "scripts/test_submodule_updated.sh" | ||
|
||
check_code_style_and_documentation: | ||
name: ${{ matrix.name }} | ||
needs: [is_not_draft_pull_request] | ||
strategy: | ||
fail-fast : false | ||
matrix: | ||
include: | ||
# Validates the code-style using uncrustify | ||
- name: Check code style | ||
BUILD_AND_TEST_ARGS: --test-code-style | ||
# Validates that the documentation generated using doxygen has no hole. | ||
- name: Check documentation | ||
BUILD_AND_TEST_ARGS: --test-documentation | ||
compliance_checks: | ||
name: compliance | ||
uses: ./.github/workflows/build_and_test.yml | ||
with: | ||
BUILD_AND_TEST_CLI_ARGS: ${{ matrix.BUILD_AND_TEST_ARGS }} | ||
CMAKE_BUILD_TYPE: Release | ||
DOCKER_IMAGE_TAG: ${{ needs.is_not_draft_pull_request.outputs.DOCKER_IMAGE_TAG }} | ||
DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc9 | ||
RUNS_ON: ubuntu-22.04 | ||
USE_SCCACHE: false | ||
secrets: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Matrix containing all the CPU build. | ||
# Those are quite fast and can efficiently benefit from the `sccache' tool to make them even faster. | ||
|
@@ -237,30 +122,6 @@ jobs: | |
- name: Check that the baseline logs are modified if rebaselines are detected | ||
run: "scripts/check_baseline_log.sh" | ||
|
||
code_coverage: | ||
needs: | ||
- is_not_draft_pull_request | ||
uses: ./.github/workflows/build_and_test.yml | ||
secrets: inherit | ||
with: | ||
BUILD_AND_TEST_CLI_ARGS: "--no-run-unit-tests" | ||
CMAKE_BUILD_TYPE: Debug | ||
CODE_COVERAGE: true | ||
DOCKER_IMAGE_TAG: ${{ needs.is_not_draft_pull_request.outputs.DOCKER_IMAGE_TAG }} | ||
DOCKER_REPOSITORY: geosx/ubuntu22.04-gcc11 | ||
ENABLE_HYPRE: ON | ||
ENABLE_TRILINOS: OFF | ||
GCP_BUCKET: geosx/ubuntu22.04-gcc11 | ||
RUNS_ON: Runner_4core_16GB | ||
|
||
# mac_builds: | ||
# needs: | ||
# - is_not_draft_pull_request | ||
# runs-on: macos-14-xlarge | ||
# steps: | ||
# - run: sysctl -n hw.physicalcpu | ||
# - run: sysctl -h hw.memsize | ||
# - run: sysctl -n machdep.cpu.brand_string | ||
|
||
|
||
# If the 'ci: run CUDA builds' PR label is found, the cuda jobs run immediately along side linux jobs. | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
name: Compliance Checks | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, edited] | ||
workflow_dispatch: | ||
|
||
# Cancels in-progress workflows for a PR when updated | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
# workflow_call: | ||
# inputs: | ||
# config-path: | ||
# required: true | ||
# type: string | ||
# # Map the workflow outputs to job outputs | ||
# outputs: | ||
# valid: | ||
# description: "Returns true if all compliance tests are validated, false otherwise" | ||
# value: ${{ jobs.example_job.outputs.output1 }} | ||
# secrets: | ||
# GITHUB_TOKEN: | ||
# required: true | ||
|
||
jobs: | ||
# Checks if PR title follows conventional semantics | ||
semantic_pull_request: | ||
permissions: | ||
pull-requests: write # for amannn/action-semantic-pull-request to analyze PRs and | ||
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR | ||
contents: read | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check if the PR name has conventional semantics | ||
if: github.event_name == 'pull_request' | ||
uses: amannn/[email protected] | ||
id: lint_pr_title | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
wip: true | ||
# Configure that a scope doesn't need to be provided. | ||
requireScope: false | ||
|
||
- name: Skip the check on develop branch | ||
if: github.ref_name == 'develop' | ||
run: | | ||
echo "This in't a Pull-Request, skipping" | ||
# Jobs will be cancelled if PR is a draft. | ||
# PR status must be "Open" to run CI. | ||
is_not_draft_pull_request: | ||
# if: ${{ always() }} | ||
needs: [semantic_pull_request] | ||
# Everywhere in this workflow, we use the most recent ubuntu distribution available in Github Actions | ||
# to ensure maximum support of google cloud's sdk. | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
DOCKER_IMAGE_TAG: ${{ steps.extract_docker_image_tag.outputs.DOCKER_IMAGE_TAG }} | ||
steps: | ||
- name: Check that the PR is not a draft (cancel rest of jobs otherwise) | ||
id: extract_pr_info | ||
run: | | ||
if [[ ${{github.event_name}} == 'pull_request' ]]; then | ||
# We do not rely on the `github.event.pull_request.labels` information since it's cached at the job. | ||
# Changing labels or assignee in the PR would not allow to simply re-run the job with a different outcome. | ||
pr_json=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }}) | ||
# We stop the workflow if the pr is draft | ||
draft_status=$(echo ${pr_json} | jq '.draft') | ||
echo "Draft status of PR is ${draft_status}." | ||
if [[ $draft_status == true ]]; then exit 1 ; fi | ||
fi | ||
# The TPL tag is contained in the codespaces configuration to avoid duplications. | ||
- name: Checkout .devcontainer/devcontainer.json | ||
uses: actions/[email protected] | ||
with: | ||
sparse-checkout: | | ||
.devcontainer/devcontainer.json | ||
sparse-checkout-cone-mode: false | ||
submodules: false | ||
lfs: false | ||
fetch-depth: 1 | ||
- name: Extract docker image tag | ||
id: extract_docker_image_tag | ||
run: | | ||
echo "DOCKER_IMAGE_TAG=$(jq '.build.args.GEOS_TPL_TAG' -r .devcontainer/devcontainer.json)" >> "$GITHUB_OUTPUT" | ||
# PR must be assigned to be merged. | ||
# This job will fail if this is not the case. | ||
if_not_unassigned_pull_request: | ||
needs: [is_not_draft_pull_request] | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: If this is a PR, Check that it is assigned | ||
run: | | ||
if [[ ${{github.event_name}} != 'pull_request' ]]; then exit 0 ; fi | ||
pr_json=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }}) | ||
NUM_ASSIGNEES=$(echo ${pr_json} | jq '.assignees | length') | ||
echo "There are ${NUM_ASSIGNEES} assignees on this PR." | ||
if [[ $NUM_ASSIGNEES == 0 ]]; then exit 1 ; fi | ||
# Validates that the PR is still pointing to the HEAD of the main branch of the submodules repositories. | ||
# (There are exceptions, read the script about those). | ||
are_submodules_in_sync: | ||
needs: [is_not_draft_pull_request] | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
# The integrated test submodule repository contains large data (using git lfs). | ||
# To save time (and money) we do not let Github Actions automatically clone all our (lfs) subrepositories and do it by hand. | ||
- name: Checkout Repository | ||
uses: actions/[email protected] | ||
with: | ||
# Let script update submodules; Github Actions submodule history causes error | ||
submodules: false | ||
lfs: false | ||
fetch-depth: 1 | ||
- name: Check that submodules are up to date | ||
run: "scripts/test_submodule_updated.sh" | ||
|
||
check_code_style_and_documentation: | ||
name: ${{ matrix.name }} | ||
needs: [is_not_draft_pull_request] | ||
strategy: | ||
fail-fast : false | ||
matrix: | ||
include: | ||
# Validates the code-style using uncrustify | ||
- name: Check code style | ||
BUILD_AND_TEST_ARGS: --test-code-style | ||
# Validates that the documentation generated using doxygen has no hole. | ||
- name: Check documentation | ||
BUILD_AND_TEST_ARGS: --test-documentation | ||
uses: ./.github/workflows/build_and_test.yml | ||
with: | ||
BUILD_AND_TEST_CLI_ARGS: ${{ matrix.BUILD_AND_TEST_ARGS }} | ||
CMAKE_BUILD_TYPE: Release | ||
DOCKER_IMAGE_TAG: ${{ needs.is_not_draft_pull_request.outputs.DOCKER_IMAGE_TAG }} | ||
DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc9 | ||
RUNS_ON: ubuntu-22.04 | ||
USE_SCCACHE: false | ||
|
||
code_coverage: | ||
needs: | ||
- is_not_draft_pull_request | ||
uses: ./.github/workflows/build_and_test.yml | ||
secrets: inherit | ||
with: | ||
BUILD_AND_TEST_CLI_ARGS: "--no-run-unit-tests" | ||
CMAKE_BUILD_TYPE: Debug | ||
CODE_COVERAGE: true | ||
DOCKER_IMAGE_TAG: ${{ needs.is_not_draft_pull_request.outputs.DOCKER_IMAGE_TAG }} | ||
DOCKER_REPOSITORY: geosx/ubuntu22.04-gcc11 | ||
ENABLE_HYPRE: ON | ||
ENABLE_TRILINOS: OFF | ||
GCP_BUCKET: geosx/ubuntu22.04-gcc11 | ||
RUNS_ON: Runner_4core_16GB | ||
|
||
# Convenience job - passes when all other jobs have passed (must pass the CUDA jobs). | ||
check_that_all_jobs_succeeded: | ||
name: Generate output | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- if_not_unassigned_pull_request | ||
- are_submodules_in_sync | ||
- check_code_style_and_documentation | ||
- cpu_builds | ||
- cuda_builds | ||
- run_integrated_tests | ||
# Map the job outputs to step outputs | ||
outputs: | ||
output1: ${{ steps.step2.outputs.firstword }} | ||
steps: | ||
- id: step1 | ||
run: | | ||
echo "if_not_unassigned_pull_request: ${{needs.if_not_unassigned_pull_request.result}}" | ||
echo "are_submodules_in_sync: ${{needs.are_submodules_in_sync.result}}" | ||
echo "check_code_style_and_documentation: ${{needs.check_code_style_and_documentation.result}}" | ||
echo "cpu_builds: ${{needs.cpu_builds.result}}" | ||
echo "cuda_builds: ${{needs.cuda_builds.result}}" | ||
echo "run_integrated_tests: ${{needs.run_integrated_tests.result}} " | ||
- id: step2 | ||
run: | | ||
${{ | ||
needs.if_not_unassigned_pull_request.result == 'success' && | ||
needs.are_submodules_in_sync.result == 'success' && | ||
needs.check_code_style_and_documentation.result == 'success' && | ||
needs.cpu_builds.result == 'success' && | ||
needs.cuda_builds.result == 'success' && | ||
needs.run_integrated_tests.result == 'success' | ||
}} | ||
echo "firstword=hello" >> $GITHUB_OUTPUT |