Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👔 Restructure automated integration and regression testing flow #2

Open
wants to merge 203 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
28528b5
Initial commit
ReinderVosDeWael Jun 22, 2023
a9306f1
does this successfully turn off the exclude? (#19)
gkiar Jul 20, 2023
b559a92
Add Ruff linter/formatter (#45)
ReinderVosDeWael Oct 25, 2023
f3665ef
[pre-commit.ci] pre-commit autoupdate (#53)
pre-commit-ci[bot] Oct 30, 2023
70ecfae
[pre-commit.ci] pre-commit autoupdate (#55)
pre-commit-ci[bot] Nov 6, 2023
8a7e5d9
[pre-commit.ci] pre-commit autoupdate (#58)
pre-commit-ci[bot] Nov 14, 2023
c53dba9
[pre-commit.ci] pre-commit autoupdate (#63)
pre-commit-ci[bot] Nov 20, 2023
028a75a
Add YAML and TOML formatting pre-commit hooks (#65)
nx10 Nov 22, 2023
9a4f8a0
[pre-commit.ci] pre-commit autoupdate (#66)
pre-commit-ci[bot] Nov 27, 2023
3d70bcd
Rename docs.yml to docs.yaml Fix #68 (#70)
ReinderVosDeWael Dec 5, 2023
ac726f1
Stricter yaml file extension check (#72)
nx10 Dec 5, 2023
bef5543
:necktie: Allow testing owner to be different from repo owner
shnizzedy Dec 7, 2023
e653f10
[pre-commit.ci] pre-commit autoupdate (#81)
pre-commit-ci[bot] Dec 12, 2023
bb7c289
[pre-commit.ci] pre-commit autoupdate (#88)
pre-commit-ci[bot] Dec 18, 2023
43d8a4d
Add poetry-check hook. (#89)
ReinderVosDeWael Dec 22, 2023
7137e0b
[pre-commit.ci] pre-commit autoupdate (#90)
pre-commit-ci[bot] Dec 26, 2023
3fffe1e
:necktie: Set comparison path and create correlati
shnizzedy Dec 29, 2023
8b6384f
:necktie: Connect correlation scripts
shnizzedy Jan 6, 2024
9c18e69
:loud_sound: Set xtrace on launch script
shnizzedy Jan 8, 2024
e864c82
:truck: Move `slurm_testing` to `C-PAC_slurm_testing`
shnizzedy Jan 8, 2024
8b0abe4
:loud_sound: Set xtrace on build script
shnizzedy Jan 9, 2024
53eba4b
:necktie: Clear Singularity cache before building new image
shnizzedy Jan 9, 2024
f4ca942
:recycle: Use `sbatch --parsable`
shnizzedy Jan 10, 2024
b0abc97
:truck: Move logs into job-specific files
shnizzedy Jan 10, 2024
3451a38
:technologist: Add pre-commit config
shnizzedy Jan 10, 2024
cf8dac8
:necktie: Consolidate GitHub check into single status, succeed if >50%
shnizzedy Jan 12, 2024
4dca790
:recycle: Use SHA for image name
shnizzedy Jan 12, 2024
204d77e
:closed_lock_with_key: Source $TOKEN_FILE`
shnizzedy Jan 12, 2024
e07f959
:fire: Remove CL inputs
shnizzedy Jan 12, 2024
2e1df88
:alien: Singularity → Apptainer
shnizzedy Jan 17, 2024
856e4c7
:recylce: DRY
shnizzedy Jan 17, 2024
931a355
:loud_sound: Set xtrace on build script
shnizzedy Jan 17, 2024
aefddf5
:bug: Local options before positional args for Apptainer
shnizzedy Jan 17, 2024
e207fad
:loud_sound: Increase logging verbosity for correlation step
shnizzedy Jan 18, 2024
c98a113
:recycle: Switch status script for build failure
shnizzedy Jan 22, 2024
672bb9b
:bug: Abspath to `status.py`
shnizzedy Jan 24, 2024
bba85a2
:necktie: Use environment variables instead of commandline args for s…
shnizzedy Jan 24, 2024
2d141dc
:pencil2: Fix quotes
shnizzedy Jan 25, 2024
4299e27
:recycle: `export` ← single-command variable assignments
shnizzedy Jan 26, 2024
063907f
:mute: Remove no-longer-necessary build log
shnizzedy Jan 26, 2024
92201f9
:bug: Fix usage conditional
shnizzedy Jan 29, 2024
d56491c
:pencil2: Remove hyphens from BASH variable names
shnizzedy Jan 30, 2024
87bb40e
:loud_sound: Log commands
shnizzedy Apr 2, 2024
ed861ac
:loud_sound: Set up logging in status.py
shnizzedy Apr 5, 2024
d54d335
:sparkles: Add load and write methods to TotalStatus
shnizzedy Apr 5, 2024
37979de
:sparkles: Add load and write methods to TotalStatus
shnizzedy Apr 5, 2024
d637fc2
:recycle: Update GitHub Actions logic
shnizzedy Apr 8, 2024
d26e1b6
:recycle: Generate run command from status script + template string
shnizzedy Apr 8, 2024
fb1ac56
:bug: Ensure `Singularity().options` is a list
shnizzedy Apr 9, 2024
11c60ae
:sparkles: Add `launch` method to `RunStatus`
shnizzedy Apr 9, 2024
0d2fa0c
:sparkles: Add class to parse and store SLURM job statuses
shnizzedy Apr 10, 2024
8c8055c
:sparkles: Add ability to get real or dry-run status from SLURM
shnizzedy Apr 11, 2024
9e19eea
:art: ssort `status.py`
shnizzedy Apr 11, 2024
35c2eff
:loud_sound: Log total status on update
shnizzedy Apr 11, 2024
7738827
:necktie: Log and launch run command
shnizzedy Apr 11, 2024
c6aabb8
:sparkles: Add command to check single run
shnizzedy Apr 12, 2024
5ed6126
:package: Package main script
shnizzedy Apr 12, 2024
dd76211
:sparkles: Add `check-all` command
shnizzedy Apr 12, 2024
af5e35b
:recycle: Prep to correlate
shnizzedy Apr 12, 2024
09055b0
:recycle: Move scheduling from BASH to Python
shnizzedy Apr 12, 2024
5052f54
:recycle: Improve logging
shnizzedy Apr 15, 2024
c662723
:sparkles: Add "check-later" functionality
shnizzedy Apr 15, 2024
a6c5d6d
:sparkles: Generate correlation YAML
shnizzedy Apr 17, 2024
a93e60f
:recycle: Store image info in total status instead of individual runs
shnizzedy Apr 17, 2024
6913e5c
:recycle: Use package instead of source install
shnizzedy Apr 17, 2024
a0a91d2
:construction: WIP :recycle: Launch from python CLI
shnizzedy Apr 18, 2024
8c0c7bf
:necktie: Add version flag to CLI
shnizzedy Apr 18, 2024
ba1b5b8
:art: Use git describe for dev versions
shnizzedy Apr 18, 2024
0eb721c
:truck: Move regression run script s into package
shnizzedy Apr 19, 2024
e2f3f99
:recycle: Functionalize git versioning
shnizzedy Apr 23, 2024
67db529
:alembic: `--export` without '"'s
shnizzedy Apr 25, 2024
a5a6c81
:art: Strip git version components
shnizzedy Apr 26, 2024
738a3ab
:package: Don't try to memoize version before installing
shnizzedy Apr 26, 2024
0b9c8dd
:truck: Replace `launch_regtest_lite.SLURM` with `cpac_slurm_status l…
shnizzedy Apr 26, 2024
d42cf89
:wrench: Add slurm_testing_repo to launch params
shnizzedy Apr 26, 2024
0784a55
:wrench: Add `slurm_testing_branch` to launch params
shnizzedy Apr 26, 2024
81a808d
:necktie: Include image info when intitializing launch status
shnizzedy May 1, 2024
2ae9a29
:necktie: Write status to disk right after initializing
shnizzedy May 1, 2024
a8211b2
:necktie: Remove `image` from update command
shnizzedy May 10, 2024
6c4b0d0
:recycle: Refactor update logic
shnizzedy May 10, 2024
0ffefdf
:alembic: Launch live runs
shnizzedy May 10, 2024
f264eb0
:necktie: Launch when adding
shnizzedy May 13, 2024
8bf8562
:bug: Persist image when recreating TotalStatus
shnizzedy May 14, 2024
9524a26
:recycle: Refactor image info
shnizzedy May 14, 2024
0c93333
:necktie: Create wd if not exists
shnizzedy May 14, 2024
650c5f1
:goal_net: Ensure we have image info
shnizzedy May 14, 2024
7293963
:necktie: Fallback on SHA if no image name given
shnizzedy May 14, 2024
edf4405
fixup! :recycle: Refactor image info
shnizzedy May 15, 2024
a016d4e
:bug: Fix default path
shnizzedy May 16, 2024
db8cae2
:necktie: Build before launch
shnizzedy May 16, 2024
10522a9
:recycle: Simplify image tracking
shnizzedy May 17, 2024
76697fe
:truck: Move log
shnizzedy May 17, 2024
ad7b85d
:necktie: Remove autoupdate
shnizzedy May 17, 2024
cc8dc7e
:passport_control: Make build_image script executable
shnizzedy May 17, 2024
dc2beb1
:pencil2: Replace `=`s with ` `s
shnizzedy May 17, 2024
75b9919
:recycle: Move build back to SLURM
shnizzedy May 17, 2024
e24db00
:necktie: Include env vars in build call
shnizzedy May 20, 2024
1db9ba4
:necktie: Use abspath when navigating to logdir
shnizzedy May 20, 2024
f224556
:truck: Allocate on shared OR small
shnizzedy May 20, 2024
8de0001
:pencil2: Remove extra quotes
shnizzedy May 20, 2024
58033fd
Revert ":truck: Allocate on shared OR small"
shnizzedy May 20, 2024
8b6f28d
:necktie: Use abspath for status pickle
shnizzedy May 30, 2024
3174b77
:truck: Specify build log path
shnizzedy May 30, 2024
d15613c
:bug: Pass image_name to runscript
shnizzedy Jun 3, 2024
fa40c58
:bug: Remove extraneous write op
shnizzedy Jun 3, 2024
cadcf19
:truck: Move build logs
shnizzedy Jun 4, 2024
1754df8
:recycle: Refactor working and log directory management
shnizzedy Jun 6, 2024
6664491
:bug: Default not dry-run
shnizzedy Jun 10, 2024
a0d69d0
:goal_net: Enforce `TestingPaths` type
shnizzedy Jun 12, 2024
4fa4c1c
:bug: Include TestingPaths onUpdate
shnizzedy Jun 24, 2024
5674cb8
:pencil2: Remove duplicate logdir
shnizzedy Jun 26, 2024
7a1afac
:necktie: Don't assume working directory isn't log directory
shnizzedy Jun 26, 2024
06408b1
:children_crossing: Add access dunders to TestingPaths
shnizzedy Jul 1, 2024
556261d
:necktie: Don't use environment variable $HOME_DIR
shnizzedy Jul 2, 2024
9b06d7d
:bug: Persist home_dir from on-disk status
shnizzedy Jul 3, 2024
356a086
:pencil2: Fix a couple paths and a repr )
shnizzedy Jul 3, 2024
fc93c46
:pencil2: Fix .y**a**ml extension
shnizzedy Jul 3, 2024
41f88b0
:bug: Bind reg-data
shnizzedy Jul 3, 2024
5324e2b
:alien: Update link
shnizzedy Jul 30, 2024
f585802
:necktie: Auto-add RunStatus to TotalStatus
shnizzedy Jul 30, 2024
e96082d
:bug: Fix a few parameters
shnizzedy Jul 31, 2024
502f58e
:memo: Add attribute docstrings
shnizzedy Jul 31, 2024
1e9365d
:memo: Update variable table in README
shnizzedy Jul 31, 2024
ac82ba9
:bug: Fix regdatapath
shnizzedy Jul 31, 2024
6f6b91f
:necktie: Keep outputs separated by datasource
shnizzedy Aug 1, 2024
b532633
:necktie: Datasource ≠ tuple
shnizzedy Aug 2, 2024
968c2d1
:memo: Update description
shnizzedy Aug 2, 2024
da8699a
:construction: WIP :sparkles: Work on building correlation config YAML
shnizzedy Aug 2, 2024
70c488c
:recycle: Refactor regression correlation YAML config generation
shnizzedy Aug 5, 2024
d5db76b
:recycle: Refactor regression correlation YAML config generation
shnizzedy Aug 5, 2024
076eaf3
:technologist: Fill in some typehints
shnizzedy Aug 5, 2024
4bc1c9a
:necktie: Run cpac_correlations
shnizzedy Aug 5, 2024
4e31960
:bug: Update on disk with +=
ChildMindInstituteCNL Aug 7, 2024
f2c478a
:technologist: Clarify some logging methods
ChildMindInstituteCNL Aug 12, 2024
6bd875b
:bug: Remove `dry_run` from `RunStatus` init calls
ChildMindInstituteCNL Aug 13, 2024
338b03a
:bug: Multiply fraction by denominator for description
shnizzedy Aug 16, 2024
4174971
:alembic: Strip `"'` from paths
shnizzedy Aug 16, 2024
a22b6f5
:necktie: :closed_lock_with_key: Move :octocat: token from env variab…
shnizzedy Aug 23, 2024
7590d42
:truck: Specify specific-run launch log location
shnizzedy Aug 26, 2024
89e6efa
:necktie: Clean up launch before correlating
shnizzedy Aug 26, 2024
0bbb52f
:necktie: Push correlations to runlogs repo
shnizzedy Aug 28, 2024
fe5d243
:necktie: Push correlation outputs to GitHub
shnizzedy Aug 28, 2024
f1943ea
:necktie: Create correlation JSON
shnizzedy Aug 28, 2024
8014877
:recycle: Move remote git info from env to dataclass
shnizzedy Aug 30, 2024
16cecc5
:technologist: Update SBATCH params
shnizzedy Aug 30, 2024
157a3bd
:pencil2: 🤦 Insert missing commas
shnizzedy Sep 3, 2024
da09772
:necktie: Just store token, not whole export line
shnizzedy Sep 4, 2024
9de28a5
:necktie: Ignore `FileNotFoundError` when cleaning up
shnizzedy Sep 4, 2024
7ffd04b
:necktie: Give wd string for `--export`
shnizzedy Sep 6, 2024
2303eed
:alembic: Keep pickle when cleaning up
shnizzedy Sep 13, 2024
c0f6774
:goal_net: Handle unknown and 'OUT_OF_MEMORY' job states
shnizzedy Sep 16, 2024
e34b256
:nectkie: Create correlations dir if not exist
shnizzedy Sep 18, 2024
2005bd0
:loud_sound: Print pipeline paths
shnizzedy Sep 18, 2024
a3d76de
:goal_net: Don't die on missing outputs
shnizzedy Sep 21, 2024
84dc7c9
:truck: Put correlations within SHA directory
shnizzedy Sep 24, 2024
e0259e9
:recycle: Refactor logging
shnizzedy Sep 24, 2024
c9fba02
:zap: Set partition for correlation steps
shnizzedy Sep 25, 2024
3098a3d
:zap: Adjust SLURM allocations
shnizzedy Sep 25, 2024
62325a8
:necktie: Specify matching branch name on remote
shnizzedy Sep 25, 2024
c05ab1e
:truck: Specify `$PLAYWRIGHT_BROWSERS_PATH`
shnizzedy Sep 27, 2024
81c5667
:memo: Add project-specific dependencies graph
shnizzedy Sep 27, 2024
54d7b10
:memo: Update mermaid graph to reflect pickle-handled task management
shnizzedy Oct 2, 2024
2d44049
:memo: Add some SLURM connections to mermaid graph
shnizzedy Oct 2, 2024
904d566
:children_crossing: Simplify mermaid graph
shnizzedy Oct 2, 2024
45f5d0d
:zap: Unlock pickle after finishing or failing writing
shnizzedy Oct 14, 2024
e27e5a9
:memo: Update details in README
shnizzedy Oct 16, 2024
4134fbb
:recycle: Move status methods from CLI functions
shnizzedy Oct 16, 2024
66bf625
:necktie: Move SLURMing from launch to correlate
shnizzedy Oct 16, 2024
b6acc22
:necktie: Use SLURM to schedule correlation jobs
shnizzedy Oct 16, 2024
8260545
:zap: Check again 30 minutes * number of pending runs
shnizzedy Oct 17, 2024
74431f1
:necktie: Copy plots to commit
shnizzedy Oct 17, 2024
7a7046f
:necktie: Checkout created branch
shnizzedy Oct 21, 2024
13eca53
:twisted_rightwards_arrows: Merge 'main' into 'correlation'
shnizzedy Oct 21, 2024
5911874
:bug: Push with full branch name
shnizzedy Oct 22, 2024
6ea564d
:construction_worker: Configure comment-posting job
shnizzedy Oct 22, 2024
7f28ad6
:necktie: Launch comments from GitHub Actions
shnizzedy Oct 23, 2024
82d08b6
:construction_worker: Provide env variables for dashboard to generate…
shnizzedy Oct 23, 2024
c5e7dc3
:construction_worker: Expose `PLAYWRIGHT_BROWSERS_PATH` for convertin…
shnizzedy Oct 23, 2024
7640bcc
:construction_worker: Use `GIT_ASKPASS`
shnizzedy Oct 25, 2024
be6691c
:necktie: Pass `GITHUB_TOKEN` env for push
shnizzedy Nov 4, 2024
b76af68
:bug: Correct repo for pushing comment workflow
shnizzedy Nov 4, 2024
60a1410
:heavy_minus_sign: Remove `dulwich` dependency \& add `await_git_lock`
shnizzedy Nov 5, 2024
0da49ae
:necktie: Don't rely on editable install to get Git repo
shnizzedy Nov 5, 2024
4e2f5e8
:technologist: Autoupdate repo URL for forks / PRs
shnizzedy Nov 5, 2024
b05cd87
:closed_lock_with_key: Use `secrets.GITHUB_TOKEN`
shnizzedy Nov 6, 2024
46c31e7
:closed_lock_with_key: Use :cat: :robot: Theodore as committer
shnizzedy Nov 7, 2024
02e1d76
:closed_lock_with_key: Give match-target-repo write permission
shnizzedy Nov 7, 2024
d8adc6e
:construction_worker: `repository` → `event.pull_request.head.repo.fu…
shnizzedy Nov 7, 2024
ca7892f
:closed_lock_with_key: Use repo secret `GH_PAT`
shnizzedy Nov 7, 2024
b4c5b2b
:construction_worker: Rename secret
shnizzedy Nov 7, 2024
e8f9cbd
:construction_worker: Use `pull_request_target` trigger for updating …
shnizzedy Nov 7, 2024
19cec68
:construction_worker: Commit PR_target workflow from 'correlation' br…
shnizzedy Nov 7, 2024
f0065fe
:twisted_rightwards_arrows: Merge branch 'main' into 'correlation'
shnizzedy Nov 7, 2024
885ac89
fixup! :construction_worker: Commit PR_target workflow from 'correlat…
shnizzedy Nov 7, 2024
df718ca
:twisted_rightwards_arrows: Update repository URL to PR target.
ChildMindInstituteCNL Nov 7, 2024
afe3a51
:lock: Check for pwn request attacks
shnizzedy Nov 7, 2024
a4f0efe
:lock: Check for pwn request attacks
shnizzedy Nov 7, 2024
dde5dbc
:construction_worker: Succeed if nothing changes
shnizzedy Nov 7, 2024
fe6e4d7
Merge remote-tracking branch 'childmindresearch/main' into correlation
shnizzedy Nov 7, 2024
162fa89
Merge branch 'main' into correlation
shnizzedy Nov 7, 2024
0fcf2f1
:construction_worker: Simplify 🚫👤💰 check
shnizzedy Nov 7, 2024
9770611
:twisted_rightwards_arrows: Merge branch 'main' into correlation
shnizzedy Nov 7, 2024
7bce766
:memo: Document `repository` URL automation
shnizzedy Nov 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Contributing to "Regression Testing C-PAC on SLURM Clusters"

## Forking this repository

If you're making any changes to secrets or environment variables, please test in a fork of this repository. [`pre-commit`](https://github.com/FCP-INDI/C-PAC/blob/main/CONTRIBUTING.md#pre-commit) is [configured in this repository](https://github.com/childmindresearch/slurm_testing/blob/977061120765151334a2e9d3257102d4a368d791/.pre-commit-config.yaml#L81-L87) to update the [`repository` URL in `pyproject.toml`](https://github.com/childmindresearch/slurm_testing/blob/977061120765151334a2e9d3257102d4a368d791/pyproject.toml#L9) to match the URL for the local `git remote` named `origin`, and [a GitHub Actions workflow is configured](https://github.com/childmindresearch/slurm_testing/blob/977061120765151334a2e9d3257102d4a368d791/.github/workflows/match_target_repository.yaml) to match that URL to the target repository when a pull request is opened, reopened, or synced.

```mermaid
flowchart TD

fork[fork repository] --> clone[<code>git clone</code>]
clone --> changes["{make changes in fork}"]
changes --> commit

subgraph commit[<code>git commit</code>]
subgraph pre-commit
update_fork[change <code>repository</code> URL in <code>pyproject.toml</code> to <code>git remote origin</code> URL]
end
end

commit --> push[<code>git push</code>]
push --> PR

subgraph PR[pull request]
subgraph workflow["'Update Repository URL' workflow"]
update_PR[change <code>repository</code> URL in <code>pyproject.toml</code> to target repository URL]
end
end
```

To skip the local update, you can run `SKIP=local-fork-repo-url git commit` where you would normally run `git commit`.

## See Also

Please see [the C-PAC Contributing Guide](https://github.com/FCP-INDI/C-PAC/blob/main/CONTRIBUTING.md), the FCP-INDI [Contributing Guide](https://github.com/FCP-INDI/.github/blob/main/CONTRIBUTING.md) and [Contributor Covenant Code of Conduct](https://github.com/FCP-INDI/.github/blob/main/CODE_OF_CONDUCT.md) for more general contributing guidelines.
32 changes: 22 additions & 10 deletions .github/scripts/correlate_regtest_lite.SLURM
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,39 @@
#SBATCH -N 1
#SBATCH -p RM-shared
#SBATCH -t 00:05:00
#SBATCH --ntasks-per-node=1
#SBATCH --ntasks=1

# Required environment variables: $COMPARISON_PATH, $DATA, $HOME_DIR, $OWNER, $PATH, $PIPELINE, $PUSH_LOGS, $REPO, $SHA
# Required environment variables: $COMPARISON_PATH, $DATA, $HOME_DIR, $OWNER, $PATH, $PIPELINE, $PUSH_LOGS, $REPO, $SHA, $TOKEN_FILE

if [[ $PUSH_LOGS==true ]]
set -x

# shellcheck disable=SC1090
source "${TOKEN_FILE}"

set -x

if [[ $PUSH_LOGS == true ]]
then
export _WD=$PWD
export GIT_REPO_DIR="${HOME_DIR}/logs/${SHA}"
cd "${GIT_REPO_DIR}"
source "${HOME_DIR}/slurm_testing/.github/scripts/wait_for_git_lock.sh"
cd "${GIT_REPO_DIR}" || exit 1
# shellcheck disable=SC1090
source "${HOME_DIR}/C-PAC_slurm_testing/.github/scripts/wait_for_git_lock.sh"
wait_for_git_lock
git add slurm-${PIPELINE}-${DATA}
git add "slurm-${PIPELINE}-${DATA}"
wait_for_git_lock
git commit -m "Add logs for ${PIPELINE} ${DATA} ${SHA}"
cd $_WD
cd "$_WD" || exit 1
fi

export _CPAC_STATUS_DATA_SOURCE="${DATA}"
export _CPAC_STATUS_PRECONFIG="${PIPELINE}"
export _CPAC_STATUS_SUBJECT="${SUBJECT}"
export _CPAC_STATUS_STATE="${STATE}"
# "${HOME_DIR}/C-PAC_slurm_testing/.github/scripts/status.py"
# gh workflow run 'Correlate Regression Test' -F ref="$SHA" -F pipeline1='one' -F pipeline2='two' -F repo="$REPO" -F owner="$OWNER" -F preconfig="$PIPELINE" -F data_source="$DATA"

gh workflow run "Initiate check" -F task="correlate" -F ref="$SHA" -F repo="$REPO" -F owner="$OWNER" -F job="${PIPELINE}-${DATA}-${IMAGE_NAME}" -F preconfig="$PIPELINE" -F data_source="$DATA" || echo "Correlate ${PIPELINE}-${DATA}-${IMAGE_NAME} initiated"
# gh workflow run "Initiate check" -F task="correlate" -F ref="$SHA" -F repo="$REPO" -F owner="$OWNER" -F job="${PIPELINE}-${DATA}-${IMAGE_NAME}" -F preconfig="$PIPELINE" -F data_source="$DATA" || echo "Correlate ${PIPELINE}-${DATA}-${IMAGE_NAME} initiated"

export GITHUB_WORKSPACE="${HOME_DIR}/${IMAGE_NAME}"

cpac_regsuite_create_yaml --pipeline1 "${COMPARISON_PATH}/${PIPELINE}/${DATA}" --pipeline2 "${GITHUB_WORKSPACE}/lite/${PIPELINE}/${DATA}" --workspace $GITHUB_WORKSPACE --data_source "${DATA}"
cpac_regsuite_create_yaml --pipeline1 "${COMPARISON_PATH}/${PIPELINE}/${DATA}" --pipeline2 "${GITHUB_WORKSPACE}/lite/${PIPELINE}/${DATA}" --workspace "${GITHUB_WORKSPACE}" --data_source "${DATA}" --branch="${SHA}"
22 changes: 14 additions & 8 deletions .github/scripts/failed_regtest_lite.SLURM
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,27 @@
#SBATCH -N 1
#SBATCH -p RM-shared
#SBATCH -t 00:05:00
#SBATCH --ntasks-per-node=1
#SBATCH --ntasks=1

# Required environment variables: $DATA, $HOME_DIR, $OWNER, $PATH, $PIPELINE, $PUSH_LOGS, $REPO, $SHA

if [[ $PUSH_LOGS==true ]]
if [[ $PUSH_LOGS == true ]]
then
# shellcheck disable=SC1090
source "${TOKEN_FILE}"
export _WD=$PWD
export GIT_REPO_DIR="${HOME_DIR}/logs/${SHA}"
cd "${GIT_REPO_DIR}"
source "${HOME_DIR}/slurm_testing/.github/scripts/wait_for_git_lock.sh"
cd "${GIT_REPO_DIR}" || exit 1
# shellcheck disable=SC1090
source "${HOME_DIR}/C-PAC_slurm_testing/.github/scripts/wait_for_git_lock.sh"
wait_for_git_lock
git add slurm-${PIPELINE}-${DATA}
git add "slurm-${PIPELINE}-${DATA}"
wait_for_git_lock
git commit -m "Add logs for ${PIPELINE} ${DATA} ${SHA}"
cd $_WD
cd "$_WD" || exit 1
fi

gh workflow run "Test run failed" -F ref="$SHA" -F owner="$OWNER" -F repo="$REPO" -F preconfig="$PIPELINE" -F data_source="$DATA"
export _CPAC_STATUS_DATA_SOURCE="${DATA}"
export _CPAC_STATUS_PRECONFIG="${PIPELINE}"
export _CPAC_STATUS_SUBJECT="${SUBJECT}"
export _CPAC_STATUS_STATE=failed
# "${HOME_DIR}/C-PAC_slurm_testing/.github/scripts/status.py"
40 changes: 0 additions & 40 deletions .github/scripts/launch_regtest_lite.SLURM

This file was deleted.

51 changes: 51 additions & 0 deletions .github/scripts/local_fork_repo_url.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env python3
"""Update local fork's ``repository`` URL."""
from pathlib import Path
import re

from git import Repo
from git.exc import GitCommandError


def get_git_remote_origin(repo_dir: Path) -> str:
"""Get Git remote origin."""
try:
configured_url = Repo(repo_dir).remotes.origin.url
_prefix, suffix = configured_url.split("github.com")
return f"https://github.com/{suffix[1:-4]}"
except AttributeError as e:
if "origin" in str(e):
raise GitCommandError(["git", "remote", "get-url", "origin"]) from e
raise e


def get_repo_dir() -> Path:
"""Get path to repository directory."""
return Path(__file__).parents[2]


def main() -> None:
"""Replace ``repository`` in ``pyproject.toml`` with forked repo."""
repo_dir = get_repo_dir()
forked_repo_url = get_git_remote_origin(repo_dir)
pyproject = repo_dir / "pyproject.toml"
repo_pattern = re.compile(r'^repository = ".*"$')

lines: list[str] = []
changed = False
with pyproject.open("r", encoding="utf-8") as _pyproject:
for line in _pyproject.readlines():
if repo_pattern.match(line):
newline = f'repository = "{forked_repo_url}"\n'
if newline != line:
changed = True
lines.append(newline)
else:
lines.append(line)
if changed:
with pyproject.open("w", encoding="utf-8") as _pyproject:
_pyproject.write("".join(lines))


if __name__ == "__main__":
main()
5 changes: 3 additions & 2 deletions .github/scripts/push_to_github.SLURM
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
#SBATCH -N 1
#SBATCH -p RM-shared
#SBATCH -t 00:05:00
#SBATCH --ntasks-per-node=1
#SBATCH --ntasks=1

export GIT_REPO_DIR="${HOME_DIR}/logs/${SHA}"
cd "${GIT_REPO_DIR}"
source "${HOME_DIR}/slurm_testing/.github/scripts/wait_for_git_lock.sh"
# shellcheck disable=SC1090
source "${HOME_DIR}/C-PAC_slurm_testing/.github/scripts/wait_for_git_lock.sh"
wait_for_git_lock
git push origin ${REPO}_${SHA} -f
cd $_WD
Expand Down
15 changes: 8 additions & 7 deletions .github/scripts/status_regtest_lite.SLURM
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
#SBATCH -N 1
#SBATCH -p RM-shared
#SBATCH -t 00:05:00
#SBATCH --ntasks-per-node=1
#SBATCH --ntasks=1

if [[ $PUSH_LOGS==true ]]
if [[ $PUSH_LOGS == true ]]
then
export _WD=$PWD
export _WD="$PWD"
export GIT_REPO_DIR="${HOME_DIR}/logs/${SHA}"
cd "${GIT_REPO_DIR}"
source "${HOME_DIR}/slurm_testing/.github/scripts/wait_for_git_lock.sh"
cd "${GIT_REPO_DIR}" || exit 1
# shellcheck disable=SC1090
source "${HOME_DIR}/C-PAC_slurm_testing/.github/scripts/wait_for_git_lock.sh"
wait_for_git_lock
git add launch/error.log launch/out.log
git add launch/*.err.log launch/*.out.log
wait_for_git_lock
git commit -m "Add logs for ${PIPELINE} ${DATA} ${SHA}"
cd $_WD
cd "$_WD" || exit 1
fi

gh workflow run 'Run launch status update' -F ref="$SHA" -F repo="$REPO" -F owner="$OWNER" -F status="${STATUS}"
87 changes: 0 additions & 87 deletions .github/workflows/correlate.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
name: Running ${{ inputs.job }} on ${{ inputs.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v3.5.3
uses: actions/checkout@v4.2.2
- name: Initiate check
uses: guibranco/github-status-action-v2@v1.1.7
with:
Expand Down
Loading