kbase / sample_service_validator_config

Stores the sample service metadata validation configuration file.
MIT License
0 stars 9 forks source link

SAM-196 Create config distribution, GHA Workflow to automate it #46

Closed eapearson closed 2 years ago

eapearson commented 2 years ago

Purpose

This set of changes has two major thrusts.

First, it adds support for placing the generated spec files into a distribution folder.

Secondly, it adds GitHub Action Workflow support to automate the creation of spec distributions.

Spec Distributions

A spec distribution is simply a copy of the source or generated spec files which are currently utilized by the Sample Service and Sample Uploader.

A new make task copies these files into the dist folder. The dist folder is excluded from git commits.

GHA Workflow

Two GHA Workflows support the automated generation of specs, packaging into the dist, and publication of special dist branches.

build-push.yml

The primary workflow build-push.yml is responsible for:

The dist branch is simply a branch created with a name as described below, and containing the contents of the dist directory. This creates a very small branch which an be readily fetched by code which requires it.

This workflow is triggered by pull request activity, merges to main, and releases.

All dist branches are prefixed with dist-

For a pull request trigger, the branch is named dist-pull_request-# where # is the pull request number.

For a merge to master, the branch is named dist-master.

For a release, the branch is named dist-release which is also tagged with the tag dist-release-v#.#.#, where v#.#.# is the tag and should have the form of a semantic version prefixed with the letter "v".

delete-closed-pr-dist-branch.yml

A small workflow takes care of removing a the dist branch associated with a pull request when that pull request is merged.

The end result, after some usage, is that there are permanent, evergreen distribution branches dist-master and dist-release, and a growing set of version tags dist-release-v#.#.#.

Miscellaneous Changes

lgtm-com[bot] commented 2 years ago

This pull request fixes 1 alert when merging 5890b98df1424f106a6df765b8eb9c7754e79a1e into a3644ef41313596476b8cb33b3135b43b8e5001f - view on LGTM.com

fixed alerts:

dauglyon commented 2 years ago

The build script and documentation look good. But, as I've said previously, I'm still not sure about the method used herein of publishing dist files. It either requires pulling the whole repo to get the files of interest (and checking out the appropriate dist branch), or cutting a github release, download the resulting archive, un-archiving it, and then using the files therein. I would suggest changing the GHA such that, when a (pre)release is cut, the build script is run, and the built files are attached to the release, that way we can directly download only the file(s) of interest, without needing Git, or an un-archiving library. And, we wont have any sort of branch bloat in the repo. @scanon @eapearson thoughts?

eapearson commented 2 years ago

@dauglyon there are a couple of ways to get a branch or tag from GitHub w/o downloading the entire repo and history.

You can clone with --depth 1. This will just download the branch w/o history. It is small (about 20K compressed). This does include the .git directory.

You can also download an archive like curl -L --output dist-release.zip https://github.com/eapearson/sample_service_validator_config/archive/refs/tags/dist-release-v1.0.1.zip (or .tar.gz). A pro is that .git directory does not need to be removed or omitted when copied, the con is that you need to unpack it. Otherwise It is about the same size as a depth 1 clone, a bit smaller since it doesn't have the .git.

The advantage of this approach is that one does not need to release or pre-release. E.g. a PR can be evaluated directly instead of merging and creating a pre-release, or main can be used e.g. in CI between releases.

lgtm-com[bot] commented 2 years ago

This pull request fixes 1 alert when merging 6f02c80f6129b828883daba1e7a150d5b992857e into a3644ef41313596476b8cb33b3135b43b8e5001f - view on LGTM.com

fixed alerts:

lgtm-com[bot] commented 2 years ago

This pull request fixes 1 alert when merging 041e8c5f9c6a337d55e2b3740835046cc21b363f into a3644ef41313596476b8cb33b3135b43b8e5001f - view on LGTM.com

fixed alerts:

lgtm-com[bot] commented 2 years ago

This pull request fixes 1 alert when merging fb214f46c2e02feac8743f668400142b60bb063a into a3644ef41313596476b8cb33b3135b43b8e5001f - view on LGTM.com

fixed alerts:

lgtm-com[bot] commented 2 years ago

This pull request fixes 1 alert when merging 921b1d8856dcf3253935de599d18d32e2a7430bf into a3644ef41313596476b8cb33b3135b43b8e5001f - view on LGTM.com

fixed alerts:

lgtm-com[bot] commented 2 years ago

This pull request fixes 1 alert when merging 413c6a3711c9d4ca92298d1212cc727c54bddb43 into a3644ef41313596476b8cb33b3135b43b8e5001f - view on LGTM.com

fixed alerts:

lgtm-com[bot] commented 2 years ago

This pull request fixes 1 alert when merging 043fd606445bc306ef156bfc11ed5e7471618ce6 into a3644ef41313596476b8cb33b3135b43b8e5001f - view on LGTM.com

fixed alerts: