Skip to content

Commit 3823d8d

Browse files
authored
Add new required input - a list of pytest markers for initial generation of checksums (#147)
* Add new required input - a list of pytest markers for initial generation of checksums * Moved config, log-inputs jobs from caller, updated committed-checksum-tag input to committed-checksum-tag-version (and updated references), added committed-checksum-create-release input * Add committed-checksum-create-release to logging * Update logging
1 parent 1fb41ef commit 3823d8d

1 file changed

Lines changed: 72 additions & 27 deletions

File tree

.github/workflows/generate-checksums.yml

Lines changed: 72 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,24 @@ on:
1313
description: Whether to commit the checksums to the config branch once generated.
1414
committed-checksum-location:
1515
type: string
16-
required: false
17-
default: ./testing/checksum
16+
required: true
1817
description: "If checksums are committed: Where in the repository the generated checksums should be committed to."
19-
committed-checksum-tag:
18+
committed-checksum-tag-version:
2019
type: string
21-
required: false
22-
description: "If checksums are committed: An optional tag to attach to the committed checksums."
20+
required: true
21+
description: "If checksums are committed: An optional tag version to attach to the committed checksums."
22+
committed-checksum-create-release:
23+
type: boolean
24+
required: true
25+
description: "If checksums are being committed and a tag is being created: Whether to create a GitHub Release for the committed checksums."
2326
environment-name:
2427
type: string
2528
required: true
2629
description: The name of a GitHub Environment that is inherited from the caller.
27-
model-config-tests-version:
28-
type: string
29-
required: true
30-
description: A version of the model-config-tests package
31-
payu-version:
30+
test-markers:
3231
type: string
3332
required: true
34-
description: The payu module version used to create test virtual environment
33+
description: A pytest-style string of pytest markers to run
3534
outputs:
3635
artifact-name:
3736
value: ${{ jobs.repro-ci.outputs.artifact-name }}
@@ -43,15 +42,62 @@ on:
4342
value: ${{ jobs.repro-ci.outputs.experiment-location }}
4443
description: Location of the experiment on the target environment
4544
jobs:
45+
config:
46+
name: Read Testing Configuration
47+
runs-on: ubuntu-latest
48+
outputs:
49+
payu-version: ${{ steps.repro-config.outputs.payu-version }}
50+
model-config-tests-version: ${{ steps.repro-config.outputs.model-config-tests-version }}
51+
checksum-tag: ${{ steps.checksum-tag.outputs.checksum-tag }}
52+
steps:
53+
- name: Checkout main
54+
uses: actions/checkout@v4
55+
with:
56+
ref: main
57+
58+
- name: Validate
59+
uses: access-nri/schema/.github/actions/validate-with-schema@main
60+
with:
61+
schema-version: ${{ vars.CI_JSON_SCHEMA_VERSION }}
62+
meta-schema-version: draft-2020-12
63+
schema-location: au.org.access-nri/model/configuration/ci
64+
data-location: config/ci.json
65+
66+
- name: Read reproducibility tests config
67+
id: repro-config
68+
uses: access-nri/model-config-tests/.github/actions/parse-ci-config@main
69+
with:
70+
check: reproducibility
71+
branch-or-tag: ${{ inputs.config-branch-name }}
72+
config-filepath: "config/ci.json"
73+
74+
- name: Set committed checksum tag
75+
if: inputs.commit-checksums
76+
id: checksum-tag
77+
run: echo "checksum-tag=${{ inputs.config-branch-name }}-${{ inputs.committed-checksum-tag-version }}" >> $GITHUB_OUTPUT
78+
79+
log-inputs:
80+
name: Log Inputs
81+
needs:
82+
- config
83+
runs-on: ubuntu-latest
84+
steps:
85+
- run: |
86+
echo '::notice::This deployment is using the following inputs: `config-branch-name`=`${{ inputs.config-branch-name }}`, `commit-checksums`=`${{ inputs.commit-checksums }}`, `committed-checksum-location`=`${{ inputs.committed-checksum-location }}`,`committed-checksum-tag-version`=`${{ inputs.committed-checksum-tag-version }}`, `committed-checksum-create-release`=`${{ inputs.committed-checksum-create-release }}`, `test-markers`=`${{ inputs.test-markers }}`.'
87+
echo '::notice::This deployment is using Payu Version ${{ needs.config.outputs.payu-version }} and Model Config Tests Version ${{ needs.config.outputs.model-config-tests-version }}'
88+
4689
repro-ci:
4790
name: Repro CI
91+
needs:
92+
- config
93+
- log-inputs
4894
uses: access-nri/model-config-tests/.github/workflows/test-repro.yml@main
4995
with:
5096
config-ref: ${{ inputs.config-branch-name }}
5197
environment-name: ${{ inputs.environment-name }}
52-
test-markers: checksum
53-
model-config-tests-version: ${{ inputs.model-config-tests-version }}
54-
payu-version: ${{ inputs.payu-version }}
98+
test-markers: ${{ inputs.test-markers }}
99+
model-config-tests-version: ${{ needs.config.outputs.model-config-tests-version }}
100+
payu-version: ${{ needs.config.outputs.payu-version }}
55101
secrets: inherit
56102
permissions:
57103
contents: write
@@ -60,11 +106,13 @@ jobs:
60106
commit-checksum-to-branch:
61107
name: Commit Checksum To ${{ inputs.config-branch-name }}
62108
needs:
109+
- config
63110
- repro-ci
64111
if: inputs.commit-checksums
65112
runs-on: ubuntu-latest
66113
env:
67114
ARTIFACT_LOCAL_LOCATION: /opt/artifact
115+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
68116
steps:
69117
- uses: actions/checkout@v4
70118
with:
@@ -84,11 +132,8 @@ jobs:
84132
cp --recursive --verbose ${{ env.ARTIFACT_LOCAL_LOCATION }}/*/* ${{ inputs.committed-checksum-location }}
85133
86134
- name: Update version in metadata.yaml
87-
if: inputs.committed-checksum-tag != ''
88-
run: |
89-
full_tag=${{ inputs.committed-checksum-tag }}
90-
version=${full_tag/*-}
91-
yq -i ".version = \"${version}\"" metadata.yaml
135+
if: inputs.committed-checksum-tag-version != ''
136+
run: yq -i ".version = \"${{ inputs.committed-checksum-tag-version }}\"" metadata.yaml
92137

93138
- name: Import Commit-Signing Key
94139
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
@@ -105,24 +150,24 @@ jobs:
105150
- name: Commit Checksums to Repo
106151
run: |
107152
git add .
108-
git commit -m "Added initial checksums generated from ${{ inputs.config-branch-name }}"
153+
git commit -m "Added initial checksums generated from ${{ inputs.config-branch-name }} at ${{ env.RUN_URL }}"
109154
git push
110155
echo "::notice::Committed and pushed checksums generated from ${{ inputs.config-branch-name }}"
111156
112157
- name: Tag Checksums in Repo
113-
if: inputs.committed-checksum-tag != ''
158+
if: inputs.committed-checksum-tag-version != ''
114159
env:
115-
STATUS: ${{ endsWith(inputs.committed-checksum-tag, '.0') && 'breaking' || 'preserving' }}
160+
STATUS: ${{ endsWith(inputs.committed-checksum-tag-version, '.0') && 'breaking' || 'preserving' }}
116161
run: |
117-
git tag ${{ inputs.committed-checksum-tag }} -m "Repro-${{ env.STATUS }} update to ${{ inputs.config-branch-name }} via model-config-tests 'generate-checksums.yml' workflow."
162+
git tag ${{ needs.config.outputs.checksum-tag }} -m "Repro-${{ env.STATUS }} update to ${{ inputs.config-branch-name }} at ${{ env.RUN_URL }}."
118163
git push --tags
119-
echo "::notice::Pushed new tag ${{ inputs.committed-checksum-tag }}"
164+
echo "::notice::Pushed new tag ${{ needs.config.outputs.checksum-tag }} to ${{ inputs.config-branch-name }}"
120165
121166
- name: Create Release
122-
if: inputs.committed-checksum-tag != ''
167+
if: inputs.committed-checksum-tag-version != '' && inputs.committed-checksum-create-release
123168
env:
124-
TAG: ${{ inputs.committed-checksum-tag }}
125-
IS_REPRO_BREAK: ${{ endsWith(inputs.committed-checksum-tag, '.0') && 'DOES' || 'does not' }}
169+
TAG: ${{ needs.config.outputs.checksum-tag }}
170+
IS_REPRO_BREAK: ${{ endsWith(inputs.committed-checksum-tag-version, '.0') && 'DOES' || 'does not' }}
126171
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 #v0.1.15
127172
with:
128173
tag_name: ${{ env.TAG }}

0 commit comments

Comments
 (0)