Skip to content

Commit da7f6c9

Browse files
authored
docs: add GitLab CI/CD snippet to usage docs and README
1 parent a34a5b9 commit da7f6c9

2 files changed

Lines changed: 69 additions & 2 deletions

File tree

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,33 @@ pip install git+https://github.com/SoftwareUnderstanding/RsMetaCheck.git
7474

7575
### GitHub Action
7676

77-
RsMetaCheck can be easily integrated into your CI/CD pipelines as a GitHub Action. We have set it up in GitHub Action in the following repository: [rs-metacheck-action](https://github.com/SoftwareUnderstanding/rs-metacheck-action) and is up in GitHub MarketPlace at [rsmetacheck actions](https://github.com/marketplace/actions/rsmetacheck).
77+
RSMetaCheck can be easily integrated into your CI/CD pipelines as a GitHub Action. We have set it up in GitHub Action in the following repository: [rs-metacheck-action](https://github.com/SoftwareUnderstanding/rs-metacheck-action) and is up in GitHub MarketPlace at [rsmetacheck actions](https://github.com/marketplace/actions/rsmetacheck).
7878

7979
The action will generate `all_pitfalls_results.json`, along with the `pitfalls/` and `somef_outputs/` directories directly in your workflow workspace.
8080

81+
### GitLab CI/CD
82+
83+
Add the following snippet to your `.gitlab-ci.yml` to run RSMetaCheck on your GitLab repository:
84+
85+
```yaml
86+
rsmetacheck:
87+
image: python:3.11
88+
stage: test
89+
script:
90+
- pip install rsmetacheck
91+
- somef configure -a
92+
- rsmetacheck --input $CI_PROJECT_URL
93+
artifacts:
94+
paths:
95+
- pitfalls_outputs/
96+
- somef_outputs/
97+
- analysis_results.json
98+
when: always
99+
expire_in: 1 week
100+
```
101+
102+
`$CI_PROJECT_URL` is a built-in GitLab CI/CD variable that automatically resolves to your repository's URL. To avoid GitHub API rate limits when SoMEF fetches metadata, store your GitHub personal access token as a GitLab CI/CD variable named `GITHUB_TOKEN` and pass it via `somef configure -a -t $GITHUB_TOKEN`.
103+
81104
### Run the Detection Tool locally
82105

83106
#### Analyze a Single Repository

docs/usage.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Usage
22

3-
RSMetaCheck can be used as a local command-line tool or integrated into your CI/CD pipeline as a GitHub Action.
3+
RSMetaCheck can be used as a local command-line tool or integrated into your CI/CD pipeline as a GitHub Action or a GitLab CI/CD job.
44

55
## Command Line Interface
66

@@ -85,3 +85,47 @@ jobs:
8585
env:
8686
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8787
```
88+
89+
## GitLab CI/CD
90+
91+
You can integrate RSMetaCheck into your GitLab pipelines by adding the following snippet to your `.gitlab-ci.yml` file:
92+
93+
```yaml
94+
rsmetacheck:
95+
image: python:3.11
96+
stage: test
97+
script:
98+
- pip install rsmetacheck
99+
- somef configure -a
100+
- rsmetacheck --input $CI_PROJECT_URL
101+
artifacts:
102+
paths:
103+
- pitfalls_outputs/
104+
- somef_outputs/
105+
- analysis_results.json
106+
when: always
107+
expire_in: 1 week
108+
```
109+
110+
`$CI_PROJECT_URL` is a [built-in GitLab CI/CD variable](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html) that automatically resolves to your repository's URL.
111+
112+
### Providing a GitHub Token (recommended)
113+
114+
SoMEF fetches repository metadata from GitHub's API. Without a token, anonymous requests are subject to low rate limits. To avoid this, store your GitHub personal access token as a [GitLab CI/CD variable](https://docs.gitlab.com/ee/ci/variables/) named `GITHUB_TOKEN` and pass it to `somef configure`:
115+
116+
```yaml
117+
rsmetacheck:
118+
image: python:3.11
119+
stage: test
120+
script:
121+
- pip install rsmetacheck
122+
- somef configure -a -t $GITHUB_TOKEN
123+
- rsmetacheck --input $CI_PROJECT_URL
124+
artifacts:
125+
paths:
126+
- pitfalls_outputs/
127+
- somef_outputs/
128+
- analysis_results.json
129+
when: always
130+
expire_in: 1 week
131+
```

0 commit comments

Comments
 (0)