-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add CI * Add Java version * Add install go for lint and test * Lint only generated files * Check Go version * Lint and test only generated files * Change branch for testing * Fix typo * Trigger pipeline * Readd .git folder * Remove multiple file generation * Readd multiple file generation * Remove check-sync-tidy * Rename variables * Remove unused variable * Rename SDK repo clone path * Change description * Rename variable * Remove .git from clone before push * Remove test echo * Rename action * Move SDK generation to separate action * Add shell * Fix SDK folder path * Remove test branch * Fix using old SDK path * Change name of SDK repo folder * Remove lint --------- Co-authored-by: Henrique Santos <[email protected]>
- Loading branch information
Showing
7 changed files
with
101 additions
and
42 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Generate SDK | ||
description: "Generates the SDK" | ||
inputs: | ||
go-version: | ||
description: "Go version to install" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Download OAS | ||
shell: bash | ||
run: make download-oas | ||
- name: Generate SDK | ||
shell: bash | ||
run: make generate-sdk |
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: CI Workflow | ||
|
||
on: [pull_request, workflow_dispatch] | ||
|
||
env: | ||
GO_VERSION_BUILD: '1.20' | ||
JAVA_VERSION: '11' | ||
|
||
jobs: | ||
main: | ||
name: CI | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
go-version: ['1.18', '1.19', '1.20'] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Install SSH Key | ||
uses: shimataro/ssh-key-action@v2 | ||
with: | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
known_hosts: ${{ vars.SSH_KNOWN_HOSTS }} | ||
- name: Install Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: ${{ env.JAVA_VERSION }} | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Build | ||
uses: ./.github/actions/build | ||
with: | ||
go-version: ${{ env.GO_VERSION_BUILD }} | ||
- name: Generate SDK | ||
uses: ./.github/actions/generate-sdk | ||
- name: Install Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Lint | ||
if: ${{ matrix.go-version == '1.19' || matrix.go-version == '1.20' }} | ||
working-directory: ./sdk-repo-updated | ||
run: make lint skip-non-generated-files=true | ||
- name: Test | ||
working-directory: ./sdk-repo-updated | ||
run: make test skip-non-generated-files=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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
bin/ | ||
|
||
# Folders to support generation | ||
sdk/ | ||
sdk-repo-updated/ | ||
oas/ | ||
|
||
# Generated files | ||
|
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ set -eo pipefail | |
ROOT_DIR=$(git rev-parse --show-toplevel) | ||
COMMIT_NAME="SDK Generator Bot" | ||
COMMIT_EMAIL="[email protected]" | ||
FOLDER_TO_PUSH_PATH="${ROOT_DIR}/sdk" # Comes from generate-sdk.sh | ||
SDK_REPO_LOCAL_PATH="${ROOT_DIR}/sdk-repo-updated" # Comes from generate-sdk.sh | ||
REPO_URL_SSH="[email protected]:stackitcloud/stackit-sdk-go.git" | ||
REPO_BRANCH="main" | ||
|
||
|
@@ -14,7 +14,7 @@ if [ $# -ne 4 ]; then | |
exit 1 | ||
fi | ||
|
||
if [ ! -d ${FOLDER_TO_PUSH_PATH} ]; then | ||
if [ ! -d ${SDK_REPO_LOCAL_PATH} ]; then | ||
echo "sdk to commit not found in root. Please run make generate-sdk" | ||
exit 1 | ||
fi | ||
|
@@ -29,8 +29,12 @@ fi | |
# Delete temp directory on exit | ||
trap "rm -rf ${work_dir}" EXIT | ||
|
||
# Where the git repo will be created | ||
mkdir ${work_dir}/git_repo | ||
mkdir ${work_dir}/git_repo # Where the git repo will be created | ||
mkdir ${work_dir}/sdk_to_push # Copy of SDK to push | ||
|
||
# Prepare SDK to push | ||
cp -a ${SDK_REPO_LOCAL_PATH}/. ${work_dir}/sdk_to_push | ||
rm -rf ${work_dir}/sdk_to_push/.git | ||
|
||
# Initialize git repo | ||
cd ${work_dir}/git_repo | ||
|
@@ -42,7 +46,7 @@ git config user.email "${COMMIT_EMAIL}" | |
# Removal of pulled data is necessary because the old version may have files | ||
# that were deleted in the new version | ||
rm -rf ./* | ||
cp -a ${FOLDER_TO_PUSH_PATH}/. ./ | ||
cp -a ${work_dir}/sdk_to_push/. ./ | ||
|
||
# Create PR with new SDK if there are changes | ||
git switch -c "$1" | ||
|