-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from ACCESS-NRI/109-Update-to-use-model-confi…
…g-tests Use model-config-tests package and add a CI configuration file for specifying test versions and markers
- Loading branch information
Showing
11 changed files
with
317 additions
and
82 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# parse-ci-config | ||
|
||
This action parses the CI testing configuration file. The caller of the action needs to checkout the branch where the config file is defined before running this action. | ||
|
||
## Inputs | ||
|
||
| Name | Type | Description | Required | Example | | ||
| ---- | ---- | ----------- | -------- | ------- | | ||
| check | `string` | The type of check/test to run | true | `scheduled` | | ||
| branch-or-tag | `string` | The name of git branch or tag | true | `release-1deg_jra55_ryf-2.0` | | ||
| config-filepath | `string` | Path to configuration file | true | `config/ci.json` | | ||
|
||
## Outputs | ||
|
||
| Name | Type | Description | Example | | ||
| ---- | ---- | ----------- | -------- | | ||
| markers | `string` | Markers used for the pytest checks, in the python format | `checksum` | | ||
| model-config-tests-version | `string` | The version of the model-config-tests | `0.0.1` | | ||
| python-version | `string` | The python version used to create test virtual environment | `3.11.0` | | ||
|
||
## Example usage | ||
|
||
```yaml | ||
# --------- | ||
steps: | ||
- name: Checkout main | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
|
||
- name: Read scheduled test config | ||
id: scheduled-config | ||
uses: access-nri/access-om2-configs/.github/actions/parse-ci-config@main | ||
with: | ||
check: scheduled | ||
branch-or-tag: "release-1deg_jra55_ryf-2.0" | ||
config-filepath: "config/ci.json" | ||
``` | ||
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,53 @@ | ||
name: Parse CI Config File | ||
description: Action to parse model-config-tests configurations for CI tests | ||
inputs: | ||
check: | ||
required: true | ||
description: Type of check/test to run (e.g. "reproducibility", "qa" or "scheduled") | ||
branch-or-tag: | ||
required: true | ||
description: Name of Git branch or tag to run CI testing on | ||
config-filepath: | ||
required: true | ||
description: Path to CI configuration file | ||
outputs: | ||
model-config-tests-version: | ||
value: ${{ steps.read-config.outputs.model-config-tests-version }} | ||
description: A version of the model-config-tests package | ||
python-version: | ||
value: ${{ steps.read-config.outputs.python-version }} | ||
description: The python version used to create test virtual environment | ||
markers: | ||
value: ${{ steps.read-config.outputs.markers }} | ||
description: A python expression of markers to pass to model-config-tests pytests | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Read Configuration File | ||
shell: bash | ||
id: read-config | ||
run: | | ||
# Fall back to default config values if not defined for a given branch or tag | ||
output=$(jq --arg branch "${{ inputs.branch-or-tag }}" --arg check "${{ inputs.check }}" ' | ||
{ | ||
"model-config-tests-version": ( | ||
.[$check][$branch]["model-config-tests-version"] // | ||
.[$check].default["model-config-tests-version"] // | ||
.default["model-config-tests-version"] | ||
), | ||
"python-version": ( | ||
.[$check][$branch]["python-version"] // | ||
.[$check].default["python-version"] // | ||
.default["python-version"] | ||
), | ||
"markers": ( | ||
.[$check][$branch].markers // | ||
.[$check].default.markers // | ||
.default.markers | ||
), | ||
} | ||
' "${{ inputs.config-filepath }}") | ||
echo "markers=$(echo "$output" | jq -r '.["markers"]')" >> $GITHUB_OUTPUT | ||
echo "python-version=$(echo "$output" | jq -r '.["python-version"]')" >> $GITHUB_OUTPUT | ||
echo "model-config-tests-version=$(echo "$output" | jq -r '.["model-config-tests-version"]')" >> $GITHUB_OUTPUT |
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
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
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
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
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
Oops, something went wrong.