-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1 from uclahs-cds/nwiltsie-bootstrap
Bootstrap repository, prep for v1.0.0
- Loading branch information
Showing
5 changed files
with
108 additions
and
44 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
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,20 +1,50 @@ | ||
# Project/Repo Title | ||
# Static Code Analysis for the Boutros Lab | ||
|
||
Template Repository for the Boutros Lab general project repos. Describe a simple overview of use/purpose here. | ||
Run static analyses for code style, linting, and repository configuration. | ||
|
||
## Description | ||
## Usage | ||
```yaml | ||
--- | ||
name: Static analysis | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
analysis: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: uclahs-cds/tool-static-analysis@v1 | ||
# The below is optional and shows the default value | ||
with: | ||
docker-tag: latest | ||
``` | ||
## Versioning | ||
Per [GitHub's advice](https://docs.github.com/en/actions/creating-actions/about-custom-actions#using-tags-for-release-management) for release management, this repository uses semantic version tags. The key details are: | ||
* Full semantic version tags, such as `v1.0.2`, are immutable and will always refer to the same commit hash. | ||
* Major version tags, such as `v1` or `v2`, are kept up-to-date with the latest matching semantic version tag. | ||
|
||
Callers should use the latest major version tag (currently `v1`), as that will refer to the most recent stable and backwards-compatible version. Specifying semantic version tags is discouraged unless there is a specific need for absolute reproducibility. | ||
|
||
An in-depth paragraph about your project and overview of use. | ||
|
||
## License | ||
|
||
Author: Name1([email protected]), Name2(username2@mednet.ucla.edu) | ||
Author: Nicholas Wiltsie (nwiltsie@mednet.ucla.edu) | ||
|
||
[This project] is licensed under the GNU General Public License version 2. See the file LICENSE.md for the terms of the GNU GPL license. | ||
tool-static-analysis is licensed under the GNU General Public License version 2. See the file LICENSE.md for the terms of the GNU GPL license. | ||
|
||
<one line to give the project/program's name and a brief idea of what it does.> | ||
GitHub automations common to the Boutros Lab repositories. | ||
|
||
Copyright (C) 2023 University of California Los Angeles ("Boutros Lab") All rights reserved. | ||
Copyright (C) 2024 University of California Los Angeles ("Boutros Lab") All rights reserved. | ||
|
||
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. | ||
|
||
|
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,50 @@ | ||
--- | ||
name: Perform static analyses | ||
|
||
description: Run static analysis checks on code for pull requests | ||
|
||
inputs: | ||
docker-tag: | ||
description: Docker image tag to use for running checks | ||
default: latest | ||
required: false | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# https://github.com/orgs/community/discussions/9049#discussioncomment-4239509 | ||
# Due to limitations on composite Actions, we can't do something like: | ||
# - uses: docker://ghcr.io/uclahs-cds/cicd-base:${{ inputs.docker-tag }} | ||
# Instead, we need to write another action.yml on-the-fly and then use that. | ||
# There absolutely should not be an 'action.yml' file underneath the .git | ||
# folder of the calling repository already, so we can use that. | ||
- name: Configure workflow | ||
shell: python | ||
env: | ||
DOCKER_IMAGE_TAG: ${{ inputs.docker-tag }} | ||
run: | | ||
import os | ||
import re | ||
from pathlib import Path | ||
# Bail out if there are any illegal characters in the tag | ||
tag = os.environ.get("DOCKER_IMAGE_TAG") | ||
if re.search(r"[^a-zA-Z0-9_.\-]", tag): | ||
raise ValueError(f"Problem with the tag `{tag}`!") | ||
template = Path( | ||
os.environ.get("GITHUB_ACTION_PATH"), "template", "action.yml" | ||
) | ||
Path(".git/action.yml").write_text( | ||
template.read_text(encoding="utf-8").replace( | ||
"DOCKER_IMAGE_TAG", tag | ||
), | ||
encoding="utf-8" | ||
) | ||
- name: Run checks | ||
uses: ./.git |
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,8 +1,9 @@ | ||
--- | ||
Category: '' # shoule be one of docker/pipeline/project/template/tool/training/users | ||
Description: '' # Description of why the repository exists | ||
Maintainers: ['[email protected]', '[email protected]'] # email address of maintainers | ||
Contributors: 'Xavier Hernandez' # Full names of contributors | ||
Languages: ['R', 'perl', 'nextflow'] # programming languages used | ||
Dependencies: 'BPG' # packages, tools that repo needs to run | ||
References: '' # is the tool/dependencies published, is there a confluence page | ||
Category: 'tool' | ||
Description: 'GitHub composite Action to perform static code analysis' | ||
Maintainers: ['[email protected]'] | ||
Contributors: 'Nicholas Wiltsie' | ||
Languages: ['python'] | ||
Version: ['1.0.0'] # Tool version number | ||
Dependencies: '' | ||
References: '' |
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,9 @@ | ||
--- | ||
name: Static analysis implementation | ||
|
||
description: Run static analysis checks on code for pull requests | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Run static checks | ||
uses: docker://ghcr.io/uclahs-cds/cicd-base:DOCKER_IMAGE_TAG |