-
Notifications
You must be signed in to change notification settings - Fork 1
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 miguelaferreira/import-gitlab-clone
Import codebase from gitlab-clone project
- Loading branch information
Showing
57 changed files
with
4,982 additions
and
1 deletion.
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,2 @@ | ||
gitlab.com,172.65.251.78 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= | ||
github.com,140.82.121.4 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== |
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,65 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
say() { | ||
what="$@" | ||
echo "==> ${what}" | ||
} | ||
|
||
cmd() { | ||
config_output_dir="${1}" | ||
args="${*:2}" | ||
java -agentlib:native-image-agent=config-output-dir="${config_output_dir}" -jar build/libs/devex-*-all.jar gitlab clone ${args} | ||
} | ||
|
||
test_clones_dir="test-clones" | ||
native_image_config_dir="native-image-config" | ||
|
||
rm -rf "${native_image_config_dir}" | ||
mkdir "${native_image_config_dir}" | ||
|
||
say "Asking for tool version" | ||
cmd "${native_image_config_dir}/no-clone/version" -V | ||
|
||
say "Asking for tool help" | ||
cmd "${native_image_config_dir}/no-clone/help" -h | ||
|
||
local_path="${test_clones_dir}/public-without-token-ssh-no-submodules-trace" | ||
say "Asking to clone a public group without using a token, via ssh, without submodules" | ||
GITLAB_TOKEN="" cmd "${native_image_config_dir}/${local_path}-1" --trace gitlab-clone-example "${local_path}" | ||
|
||
say "Asking to clone the same public group without using a token, via ssh, with submodules (effectively only initializing submodules)" | ||
GITLAB_TOKEN="" cmd "${native_image_config_dir}/${local_path}-2" --trace gitlab-clone-example -r "${local_path}" | ||
|
||
local_path="${test_clones_dir}/public-with-token-ssh-with-submodules-debug" | ||
say "Asking to clone a public group using a token, via ssh, with submodules" | ||
cmd "${native_image_config_dir}/${local_path}" --debug -r gitlab-clone-example "${local_path}" | ||
|
||
local_path="${test_clones_dir}/public-with-token-https-with-submodules-verbose" | ||
say "Asking to clone a public group using a token, via https, with submodules" | ||
cmd "${native_image_config_dir}/${local_path}" -v -r -c HTTPS -u devex-bot gitlab-clone-example "${local_path}" | ||
|
||
local_path="${test_clones_dir}/private-without-token-ssh-with-submodules-verbose" | ||
say "Asking to clone a private group without using a token, via ssh, with submodules" | ||
GITLAB_TOKEN="" cmd "${native_image_config_dir}/${local_path}" -v -r gitlab-clone-example-private "${local_path}" || true | ||
|
||
local_path="${test_clones_dir}/public-without-token-https-with-submodules-verbose" | ||
say "Asking to clone a private group without using a token, via https, with submodules" | ||
GITLAB_TOKEN="" cmd "${native_image_config_dir}/${local_path}" -v -r -c HTTPS -u devex-bot gitlab-clone-example-private "${local_path}" || true | ||
|
||
local_path="${test_clones_dir}/private-with-token-ssh-with-submodules-very-verbose" | ||
say "Asking to clone a private group using a token, via ssh, with submodules" | ||
cmd "${native_image_config_dir}/${local_path}" -x -r gitlab-clone-example-private "${local_path}" | ||
|
||
local_path="${test_clones_dir}/public-with-token-https-with-submodules-very-verbose" | ||
say "Asking to clone a private group using a token, via https, with submodules" | ||
cmd "${native_image_config_dir}/${local_path}" -x -r -c HTTPS -u devex-bot gitlab-clone-example-private "${local_path}" | ||
|
||
local_path="${test_clones_dir}/public-by-id-with-token-very-verbose" | ||
say "Asking to clone a public group by id using a token, via https, with submodules" | ||
cmd "${native_image_config_dir}/${local_path}" -x -m id -r -c HTTPS -u devex-bot 11961707 "${local_path}" | ||
|
||
local_path="${test_clones_dir}/public-sub-group-by-full-path-with-token-very-verbose" | ||
say "Asking to clone a public subgroup by full path using a token, via https, with submodules" | ||
cmd "${native_image_config_dir}/${local_path}" -x -m full_path -r -c HTTPS -u devex-bot gitlab-clone-example/sub-group-2/sub-group-3 "${local_path}" |
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,27 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
say() { | ||
what="$@" | ||
echo "==> ${what}" | ||
} | ||
|
||
os="${1:-darwin}" | ||
|
||
native_image_config_dir="native-image-config" | ||
output_dir="src/main/resources/META-INF/native-image" | ||
|
||
rm -rf "${output_dir}" | ||
mkdir -p "${output_dir}" | ||
|
||
[[ -d "${native_image_config_dir}" ]] || exit 1 | ||
|
||
|
||
say "Merging native-image build config" | ||
input_dirs="" | ||
for config_dir in "${native_image_config_dir}"/*/*; do | ||
input_dirs+="--input-dir=${config_dir} " | ||
done | ||
|
||
eval "graalvm/bin/native-image-configure-${os}" generate "${input_dirs}" --output-dir="${output_dir}" |
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,56 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
say() { | ||
what="$@" | ||
echo "==> ${what}" | ||
} | ||
|
||
say "Asking for tool version" | ||
build/native-image/application -V | ||
|
||
say "Asking for tool help" | ||
build/native-image/application -h | ||
|
||
local_path="ssh-no-submodules" | ||
say "Asking to clone a group, via ssh, without submodules" | ||
build/native-image/application gitlab clone -x gitlab-clone-example "${local_path}" | ||
[[ ! -f "${local_path}/gitlab-clone-example/a-project/some-project-sub-module/README.md" ]] | ||
|
||
say "Asking to clone the same group, via ssh, with submodules (effectively only initializing submodules)" | ||
build/native-image/application gitlab clone -x -r gitlab-clone-example "${local_path}" | ||
[[ -f "${local_path}/gitlab-clone-example/a-project/some-project-sub-module/README.md" ]] | ||
cd "${local_path}/gitlab-clone-example/a-project" | ||
[[ "$(git remote -v | head -n 1)" == *"git@"* ]] | ||
cd - | ||
|
||
local_path="ssh-with-submodules" | ||
say "Asking to clone group, via ssh, with submodules" | ||
build/native-image/application gitlab clone -x -r gitlab-clone-example "${local_path}" | ||
[[ -f "${local_path}/gitlab-clone-example/a-project/some-project-sub-module/README.md" ]] | ||
cd "${local_path}/gitlab-clone-example/a-project" | ||
[[ "$(git remote -v | head -n 1)" == *"git@"* ]] | ||
cd - | ||
|
||
local_path="https-with-submodules" | ||
say "Asking to clone group, via https, with submodules" | ||
build/native-image/application gitlab clone -x -r -c HTTPS -u devex-bot gitlab-clone-example "${local_path}" | ||
[[ -f "${local_path}/gitlab-clone-example/a-project/some-project-sub-module/README.md" ]] | ||
cd "${local_path}/gitlab-clone-example/a-project" | ||
[[ "$(git remote -v | head -n 1)" == *"https://"* ]] | ||
cd - | ||
|
||
local_path="https-by-id" | ||
say "Asking to clone group by id" | ||
build/native-image/application gitlab clone -x -r -c HTTPS -u devex-bot -m id 11961707 "${local_path}" | ||
[[ -f "${local_path}/gitlab-clone-example/a-project/some-project-sub-module/README.md" ]] | ||
cd "${local_path}/gitlab-clone-example/a-project" | ||
[[ "$(git remote -v | head -n 1)" == *"https://"* ]] | ||
cd - | ||
|
||
local_path="ssh-by-full-path" | ||
say "Asking to clone group by full path" | ||
build/native-image/application gitlab clone -x -m full_path gitlab-clone-example/sub-group-2/sub-group-3 "${local_path}" | ||
[[ -f "${local_path}/gitlab-clone-example/sub-group-2/sub-group-3/another-project/README.md" ]] | ||
cd - |
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,118 @@ | ||
name: "Continuous Delivery" | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
build_release: | ||
name: "Build release" | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, macos-latest ] | ||
steps: | ||
- name: "[${{ runner.os }}] Checkout sources" | ||
uses: actions/checkout@v2 | ||
- name: "[${{ runner.os }}] Cache dependencies" | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle | ||
${GITHUB_WORKSPACE}/.gradle | ||
key: ${{ matrix.os }}-devex-release-java11 | ||
- name: "[${{ runner.os }}] Install GraalVM" | ||
uses: DeLaGuardo/[email protected] | ||
with: | ||
graalvm: '21.1.0' | ||
java: 'java11' | ||
arch: 'amd64' | ||
- name: "[${{ runner.os }}] Install native-image" | ||
run: gu install native-image | ||
- name: "[${{ runner.os }}] Setup SSH" | ||
run: | | ||
mkdir -p ~/.ssh | ||
cat .github/files/known_hosts > ~/.ssh/known_hosts | ||
echo "${bot_devex_ssh_private_key}" > ~/.ssh/id_rsa | ||
chmod -R 500 ~/.ssh | ||
env: | ||
bot_devex_ssh_private_key: ${{ secrets.BOT_DEVEX_SSH_PRIVATE_KEY }} | ||
- name: "[${{ runner.os }}] Gradle build" | ||
run: ./gradlew build nativeImage | ||
env: | ||
GITLAB_TOKEN: ${{ secrets.BOT_GITLAB_TOKEN_READ_API }} | ||
- name: "[${{ runner.os }}] Run and test native image" | ||
run: .github/scripts/run-native-binary.sh | ||
env: | ||
GITLAB_TOKEN: ${{ secrets.BOT_GITLAB_TOKEN_READ_API }} | ||
- name: "[${{ runner.os }}] Clean up" | ||
if: ${{ always() }} | ||
run: sudo rm -rf ~/.ssh | ||
- name: '[${{ runner.os }}] Upload artifacts' | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: devex-${{ runner.os }} | ||
path: build/native-image/application | ||
if-no-files-found: error | ||
|
||
create_release: | ||
name: "Create release" | ||
needs: build_release | ||
runs-on: ubuntu-latest | ||
env: | ||
release_body_file: "body.txt" | ||
steps: | ||
- name: "Checkout sources" | ||
uses: actions/checkout@v2 | ||
- name: "Download all workflow run artifacts" | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: "artifacts" | ||
- name: "Generate changelog" | ||
id: changelog | ||
uses: metcalfc/[email protected] | ||
with: | ||
myToken: ${{ secrets.GITHUB_TOKEN }} | ||
- name: "Prepare release files" | ||
id: release-files | ||
run: | | ||
version=${tag_ref/refs\/tags\//} | ||
# Create sha256sum for each release file | ||
mkdir release | ||
cd artifacts | ||
for file in */*; do release_name="$(dirname ${file})"; cp "${file}" "../release/${release_name}-${version}"; done | ||
cd ../release | ||
for file in *; do sha256sum "${file}" > "${file}.sha256sum"; done | ||
tar czf all-files-${version}.tar.gz * | ||
sha256sum all-files-${version}.tar.gz > all-files-${version}.tar.gz.sha256sum | ||
cd .. | ||
# Create release text | ||
cat <<'EOF' > "${release_body_file}" | ||
## SHA 256 | ||
EOF | ||
cd release | ||
for file in *.sha256sum; do echo "- $(cat "${file}")" >> "../${release_body_file}"; done | ||
cd .. | ||
cat <<'EOF' >> "${release_body_file}" | ||
## Change log | ||
EOF | ||
echo "${change_log}" >> "${release_body_file}" | ||
env: | ||
tag_ref: ${{ github.ref }} | ||
change_log: ${{ steps.changelog.outputs.changelog }} | ||
- name: "Create release" | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body_path: ${{ env.release_body_file }} | ||
files: release/* | ||
draft: false | ||
prerelease: false | ||
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,76 @@ | ||
name: "Continuous Integration" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: "Build code" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout sources" | ||
uses: actions/checkout@v2 | ||
- name: "Cache dependencies" | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle | ||
${GITHUB_WORKSPACE}/.gradle | ||
~/.cache/pip/ | ||
key: ${{ runner.os }}-devex-development-java11 | ||
- name: "Install GraalVM" | ||
uses: DeLaGuardo/[email protected] | ||
with: | ||
graalvm: '21.1.0' | ||
java: 'java11' | ||
arch: 'amd64' | ||
- name: "Install native-image" | ||
run: | | ||
gu install native-image | ||
- name: "Setup SSH" | ||
run: | | ||
mkdir -p ~/.ssh | ||
cat .github/files/known_hosts > ~/.ssh/known_hosts | ||
echo "${bot_devex_ssh_private_key}" > ~/.ssh/id_rsa | ||
chmod -R 500 ~/.ssh | ||
env: | ||
bot_devex_ssh_private_key: ${{ secrets.BOT_DEVEX_SSH_PRIVATE_KEY }} | ||
- name: "Gradle build" | ||
run: ./gradlew build | ||
env: | ||
GITLAB_TOKEN: ${{ secrets.BOT_GITLAB_TOKEN_READ_API }} | ||
- name: "Publish Unit Test Results" | ||
uses: EnricoMi/publish-unit-test-result-action/composite@v1 | ||
if: always() | ||
with: | ||
files: build/test-results/test/*.xml | ||
- name: "Create native-image build config" | ||
run: | | ||
.github/scripts/create-native-image-build-config.sh | ||
.github/scripts/merge-native-image-build-config.sh linux | ||
env: | ||
GITLAB_TOKEN: ${{ secrets.BOT_GITLAB_TOKEN_READ_API }} | ||
- name: "Gradle nativeImage" | ||
run: ./gradlew nativeImage | ||
env: | ||
GITLAB_TOKEN: ${{ secrets.BOT_GITLAB_TOKEN_READ_API }} | ||
- name: "Run and test native binary" | ||
run: .github/scripts/run-native-binary.sh | ||
env: | ||
GITLAB_TOKEN: ${{ secrets.BOT_GITLAB_TOKEN_READ_API }} | ||
- uses: EndBug/add-and-commit@v7 # You can change this to use a specific version | ||
with: | ||
add: "src/main/resources/META-INF/native-image" | ||
author_name: "DevEx Bot" | ||
author_email: "[email protected]" | ||
default_author: "user_info" | ||
message: "Update native-image build config" | ||
branch: ${{ github.head_ref }} | ||
- name: "Clean up" | ||
if: ${{ always() }} | ||
run: sudo rm -rf ~/.ssh |
Oops, something went wrong.