Skip to content

Commit

Permalink
Add scripts for eva_plugins (autowarefoundation#20)
Browse files Browse the repository at this point in the history
* Add eva_update_vcs_versions.sh

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Add test

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Run post common tasks

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Fix test

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
  • Loading branch information
kenji-miyake authored Jun 25, 2021
1 parent e59adaf commit 47c32c6
Show file tree
Hide file tree
Showing 4 changed files with 219 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/test-release-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,77 @@ jobs:
git branch --show-current | grep "^experiment/20210123-test" || false
cat autoware.proj.repos | grep autoware/autoware.iv -A3 | grep "version: experiment/20210123-test" || false
cat autoware.proj.repos | grep autoware/launcher -A3 | grep "version: experiment/20210123-test" || false
test-eva-release:
needs: vcs-import-cache
runs-on: ubuntu-latest
container: osrf/ros:foxy-desktop

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install yq
run: |
apt-get -y update
apt-get -y install wget
wget -O /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.9.1/yq_linux_amd64
chmod +x /usr/local/bin/yq
- name: Fix eva_plugins.repos for private repositories
run: |
sed -i -e "s|git@github.com:|https://github.com/|g" eva_plugins.repos
- name: Set git config for private repositories
run: |
git config --local --unset-all http.https://github.com/.extraheader || true
git config --global url.https://${{ secrets.REPO_TOKEN }}@github.com.insteadof 'https://github.com'
- name: Run vcs import
run: |
mkdir src
vcs import src < eva_plugins.repos
- name: Fix eva_plugins.repos for private repositories
run: |
sed -i -e "s|git@github.com:|https://github.com/|g" eva_plugins.repos
- name: Commit eva_plugins.repos to remove workspace diff
run: |
git add eva_plugins.repos
git config --global user.email "actions@example.com"
git config --global user.name "Github Actions"
git commit -m "Update eva_plugins.repos in CI"
- name: Set git config for private repositories
run: |
git config --local --unset-all http.https://github.com/.extraheader || true
git config --global url.https://${{ secrets.REPO_TOKEN }}@github.com.insteadof 'https://github.com'
- name: Create rc branches
run: |
./scripts/release/eva_create_product_rc_branches.sh -y v0.0.0
- name: Print versions
run: |
git branch
cat eva_plugins.repos
vcs custom src --git --args branch
- name: Check result
run: |
cat eva_plugins.repos | grep proj_launcher -A3 | grep "version: rc/v0.0.0" || false
- name: Create release tags
run: |
./scripts/release/eva_create_product_release_tags.sh -y v0.0.0
- name: Print versions
run: |
git branch
cat eva_plugins.repos
vcs custom src --git --args branch
- name: Check result
run: |
cat eva_plugins.repos | grep proj_launcher -A3 | grep "version: v0.0.0" || false
69 changes: 69 additions & 0 deletions scripts/release/eva_create_product_rc_branches.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env bash

SCRIPT_DIR=$(readlink -f "$(dirname "$0")")
source "$SCRIPT_DIR/common/helper_functions.sh"

# Override functions
function get_repos_file_path() {
echo "$(git rev-parse --show-toplevel)/eva_plugins.repos"
}

function get_product_repositories() {
find src/eva -type d -name '\.git' -print0 | xargs -0 -I {} dirname "{}"
}

# Define functions
function show_usage() {
echo -e
"Usage: create_reference_rc_branches.sh product_version
[-h/--help] [-y/--yes] [--change-reference-repositories] [--push|--delete]
-h/--help:
Show usage and exit.
-y/--yes:
Proceed without confirmation.
--change-reference-repositories:
Whether to create branches/tags in reference repositories.
--push:
Whether to push branches/tags. Please use this option when you can be sure.
--delete:
Whether to delete branches/tags. Please use this option when you mistook something.
product_version:
The version to be used for product rc branches.
The valid pattern is '^v([0-9]+)\.([0-9]+)\.([0-9]+)$'.
Note: Using --push and --delete at the same time may cause unexpected behaviors."
}

# Parse arguments
source "$SCRIPT_DIR/common/parse_common_args.sh"
product_version="${args[0]}"

# Check args
if ! is_valid_product_rc_version "$product_version"; then
echo -e "\e[31mPlease input a valid product rc version as the 2nd argument\e[m"
show_usage
exit 1
fi

# Run pre common tasks
source "$SCRIPT_DIR/common/pre_common_tasks.sh"

# Set branch prefix
branch_prefix="rc/"

# Create branches in product repositories
echo -e "\e[36mCreate branches in product repositories\e[m"
for product_repository in $(get_product_repositories); do
create_branch "$product_repository" "$branch_prefix$product_version" "$flag_push" "$flag_delete"
done

# Run post common tasks
if [ "$flag_delete" = "" ]; then
source "$SCRIPT_DIR/common/post_common_tasks.sh"
fi
65 changes: 65 additions & 0 deletions scripts/release/eva_create_product_release_tags.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env bash

SCRIPT_DIR=$(readlink -f "$(dirname "$0")")
source "$SCRIPT_DIR/common/helper_functions.sh"

# Override functions
function get_repos_file_path() {
echo "$(git rev-parse --show-toplevel)/eva_plugins.repos"
}

function get_product_repositories() {
find src/eva -type d -name '\.git' -print0 | xargs -0 -I {} dirname "{}"
}

# Define functions
function show_usage() {
echo -e "Usage: create_product_release_tags.sh product_version
[-h/--help] [-y/--yes] [--change-reference-repositories] [--push|--delete]
-h/--help:
Show usage and exit.
-y/--yes:
Proceed without confirmation.
--change-reference-repositories:
Whether to create branches/tags in reference repositories.
--push:
Whether to push branches/tags. Please use this option when you can be sure.
--delete:
Whether to delete branches/tags. Please use this option when you mistook something.
product_version:
The version to be used for product release tags.
The valid pattern is '^v([0-9]+)\.([0-9]+)\.([0-9]+)$'.
Note: Using --push and --delete at the same time may cause unexpected behaviors."
}

# Parse arguments
source "$SCRIPT_DIR/common/parse_common_args.sh"
product_version="${args[0]}"

# Check args
if ! is_valid_product_release_version "$product_version"; then
echo -e "\e[31mPlease input a valid product release version as the 2nd argument\e[m"
show_usage
exit 1
fi

# Run pre common tasks
source "$SCRIPT_DIR/common/pre_common_tasks.sh"

# Create tags in product repositories
echo -e "\e[36mCreate tags in product repositories\e[m"
for product_repository in $(get_product_repositories); do
create_tag "$product_repository" "$product_version" "$flag_push" "$flag_delete"
done

# Run post common tasks
if [ "$flag_delete" = "" ]; then
source "$SCRIPT_DIR/common/post_common_tasks.sh"
fi
11 changes: 11 additions & 0 deletions scripts/release/eva_update_vcs_versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

SCRIPT_DIR=$(readlink -f "$(dirname "$0")")
source "$SCRIPT_DIR/common/helper_functions.sh"

# Override functions
function get_repos_file_path() {
echo "$(git rev-parse --show-toplevel)/eva_plugins.repos"
}

update_vcs_versions

0 comments on commit 47c32c6

Please sign in to comment.