-
Notifications
You must be signed in to change notification settings - Fork 48
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 #626 from CleverCloud/ci/from_jenkins_to_ga
ci: from jenkins to github action
- Loading branch information
Showing
43 changed files
with
4,006 additions
and
1,146 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": ["@commitlint/config-conventional"] | ||
} |
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,3 @@ | ||
#!/usr/bin/env sh | ||
|
||
npx --no -- commitlint --edit |
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,46 @@ | ||
name: 'Build' | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
build: | ||
name: 'Build' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: '[Prepare] Checkout' | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: '[Prepare] Setup Node.js' | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: 'package.json' | ||
cache: 'npm' | ||
- name: '[Prepare] Install dependencies' | ||
run: npm ci | ||
|
||
- name: '[Code quality] Check commit message' | ||
if: github.event_name == 'pull_request' | ||
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose | ||
|
||
# - name: '[Code quality] Check ESLint' | ||
# run: npm run lint | ||
|
||
- name: '[Build] [Prepare] Setup ruby' | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '2.7' | ||
bundler-cache: true | ||
- name: '[Build] [Prepare] Install fpm' | ||
run: gem install fpm | ||
- name: '[Build] [Run] Build' | ||
run: node scripts/job-build.js 0.0.0 --latest --bundle | ||
env: | ||
RPM_GPG_PRIVATE_KEY: ${{ secrets.RPM_GPG_PRIVATE_KEY }} | ||
RPM_GPG_NAME: 'Clever Cloud Nexus (rpm)' | ||
RPM_GPG_PASS: ${{ secrets.RPM_GPG_PASSPHRASE }} |
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,110 @@ | ||
name: 'Preview' | ||
on: | ||
pull_request: | ||
types: | ||
- synchronize | ||
- opened | ||
- closed | ||
|
||
env: | ||
BRANCH: ${{ github.event.pull_request.head.ref }} | ||
CC_CLEVER_TOOLS_PREVIEWS_CELLAR_KEY_ID: ${{ secrets.CC_CLEVER_TOOLS_PREVIEWS_CELLAR_KEY_ID }} | ||
CC_CLEVER_TOOLS_PREVIEWS_CELLAR_SECRET_KEY: ${{ secrets.CC_CLEVER_TOOLS_PREVIEWS_CELLAR_SECRET_KEY }} | ||
|
||
jobs: | ||
wait_for_build: | ||
name: 'Wait for build to succeed' | ||
if: | | ||
(github.event.action == 'synchronize' || github.event.action == 'opened') | ||
&& github.event.repository.fork == false | ||
&& !startsWith(github.event.pull_request.head.ref, 'release-please--') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Wait for build to succeed' | ||
uses: lewagon/[email protected] | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
check-name: Build | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
allowed-conclusions: success | ||
publish: | ||
name: 'Publish Preview' | ||
needs: wait_for_build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: '[Prepare] Checkout' | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: '[Prepare] Setup Node.js' | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: 'package.json' | ||
cache: 'npm' | ||
- name: '[Prepare] Install dependencies' | ||
run: npm ci | ||
- name: '[Prepare] Check if a preview already exists' | ||
id: check_preview | ||
run: | | ||
if node scripts/job-preview.js get ${BRANCH} > /dev/null 2>&1; then | ||
echo "exists=yes" >> $GITHUB_OUTPUT | ||
else | ||
echo "exists=no" >> $GITHUB_OUTPUT | ||
fi | ||
- name: '[Run] Build preview' | ||
run: node scripts/job-preview.js build ${BRANCH} | ||
- name: '[Run] Publish preview' | ||
run: node scripts/job-preview.js publish ${BRANCH} | ||
|
||
- name: '[Finalize] Get preview links' | ||
if: steps.check_preview.outputs.exists == 'no' | ||
id: get_preview_links | ||
run: | | ||
PREVIEW_LINKS=$(node scripts/job-preview.js links $BRANCH | sed -z 's/\n/\\n/g'; echo) | ||
echo "PREVIEW_LINKS=${PREVIEW_LINKS::-2}" >> $GITHUB_ENV | ||
- name: '[Finalize] Add comment' | ||
if: steps.check_preview.outputs.exists == 'no' | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const links = "${{ env.PREVIEW_LINKS }}"; | ||
await github.rest.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.issue.number, | ||
body: `🔎 A preview has been automatically published:\n\n${links}\n\n\n_This preview will be deleted once this PR is closed._` | ||
}); | ||
delete: | ||
if: | | ||
github.event.action == 'closed' | ||
&& github.event.repository.fork == false | ||
&& !startsWith(github.event.pull_request.head.ref, 'release-please--') | ||
name: 'Delete Preview' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: '[Prepare] Checkout' | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: '[Prepare] Setup Node.js' | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: 'package.json' | ||
cache: 'npm' | ||
- name: '[Prepare] Install dependencies' | ||
run: npm ci | ||
|
||
- name: '[Run] Delete preview' | ||
run: node scripts/job-preview.js delete ${BRANCH} | ||
|
||
- name: '[Finalize] Add comment' | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
await github.rest.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.issue.number, | ||
body: `🔎 The preview has been automatically deleted.` | ||
}); |
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,59 @@ | ||
name: 'Publish' | ||
on: | ||
push: | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
|
||
env: | ||
VERSION: ${{ github.ref_name }} | ||
CC_CLEVER_TOOLS_RELEASES_CELLAR_KEY_ID: ${{ secrets.CC_CLEVER_TOOLS_RELEASES_CELLAR_KEY_ID }} | ||
CC_CLEVER_TOOLS_RELEASES_CELLAR_SECRET_KEY: ${{ secrets.CC_CLEVER_TOOLS_RELEASES_CELLAR_SECRET_KEY }} | ||
RPM_GPG_PRIVATE_KEY: ${{ secrets.RPM_GPG_PRIVATE_KEY }} | ||
RPM_GPG_NAME: 'Clever Cloud Nexus (rpm)' | ||
RPM_GPG_PASS: ${{ secrets.RPM_GPG_PASSPHRASE }} | ||
NEXUS_USER: ${{ secrets.NEXUS_USER }} | ||
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | ||
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
jobs: | ||
publish_cellar: | ||
name: 'Publish' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: '[Prepare] Checkout' | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: '[Prepare] Setup Node.js' | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: 'package.json' | ||
cache: 'npm' | ||
- name: '[Prepare] Install dependencies' | ||
run: npm ci | ||
- name: '[Prepare] Setup ruby' | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '2.7' | ||
bundler-cache: true | ||
- name: '[Prepare] Install fpm' | ||
run: gem install fpm | ||
- name: '[Prepare] Setup ssh-agent' | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
|
||
- name: '[Build] version ${{ env.VERSION }}' | ||
run: node scripts/job-build.js "${VERSION}" --latest --bundle | ||
|
||
- name: '[Publish] version ${{ env.VERSION }}' | ||
run: node scripts/job-publish.js "${VERSION}" | ||
|
||
- name: '[Publish] Upload artifacts to GitHub Release' | ||
shell: bash | ||
run: | | ||
gh release upload "${VERSION}" $(find build/${{ github.ref_name }}/archive -maxdepth 1 -type f -name "*$VERSION*" -print) | ||
gh release upload "${VERSION}" $(find build/${{ github.ref_name }}/bundle -maxdepth 1 -type f -print) | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,17 @@ | ||
name: 'release-please' | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- 'hotfix/**' | ||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
with: | ||
token: ${{ secrets.CI_TOKEN }} | ||
release-type: node | ||
include-v-in-tag: false | ||
default-branch: ${{ github.ref_name }} | ||
changelog-types: '[{"type": "feat", "section": "🚀 Features"}, {"type": "fix", "section": "🐛 Bug Fixes"}, {"type": "perf", "section": "💪 Performance Improvements"}, {"type": "deps", "section": "🗃️ Dependencies", "hidden": true}, {"type": "revert", "section": "↩ Reverts"}, {"type": "docs", "section": "📖 Documentation", "hidden": true}, {"type": "style", "section": "🎨 Styles", "hidden": true}, {"type": "chore", "section": "🧹 Miscellaneous Chores", "hidden": true}, {"type": "refactor", "section": "🛠 Code Refactoring", "hidden": true}, {"type": "test", "section": "🔬 Tests", "hidden": true}, {"type": "build", "section": "🏗️ Build System", "hidden": true}, {"type": "ci", "section": "🤖 Continuous Integration", "hidden": true}]' |
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,3 +1,2 @@ | ||
tag-version-prefix = "" | ||
message = "Upgrade to %s" | ||
preid = "beta" |
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,40 @@ | ||
# How to contribute? | ||
|
||
## We use ESLint | ||
|
||
We use [ESLint](https://eslint.org/) to enforce JS coding style and spot linting errors ASAP. | ||
Our configuration is based on [standardJS](https://standardjs.com/) + some small tweaks (see `.eslintrc.js`). | ||
|
||
You can run the lint check with: | ||
|
||
```shell | ||
npm run lint | ||
``` | ||
|
||
You can run the lint check (with autofix) with: | ||
|
||
```shell | ||
npm run lint:fix | ||
``` | ||
|
||
## We have precise rules for commit message format | ||
|
||
Commit messages must respect [conventional commit](https://www.conventionalcommits.org). | ||
|
||
Possible types are `fix:`, `feat:`, `build:`, `chore:`, `ci:`, `docs:`, `style:`, `refactor:`, `perf:`, `test:`. | ||
|
||
The scope should be the name of the command affected. | ||
If many commands are affected, consider the following options: | ||
* split into multiple commits | ||
* avoid specifying any scope and add some details instead. However, you must understand that details won't be dumped into the CHANGELOG. | ||
|
||
If none of these options suits your need, you can follow [this how-to](https://github.com/googleapis/release-please#what-if-my-pr-contains-multiple-fixes-or-features) that will let you generate multiple CHANGELOG entries with one single commit. | ||
|
||
To help you respect the rules, you should install a commit linter with the following command: | ||
|
||
```shell | ||
cd ${PATH_TO_THE_REPOSITORY_ROOT} | ||
git config core.hooksPath '.githooks' | ||
``` | ||
|
||
You must understand that nothing will be dumped into the CHANGELOG if you don't respect these rules. |
Oops, something went wrong.