Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
moklidia committed Jul 17, 2023
2 parents ee819da + 6658415 commit 0ecbca6
Show file tree
Hide file tree
Showing 18 changed files with 161 additions and 125 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/create-github-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Create Linux release
on:
push:
tags:
- 'v*.*.*'

env:
RELEASE_VERSION: ${GITHUB_REF#refs/*/}

jobs:
make:
strategy:
matrix:
os: [ubuntu-20.04, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: 'Install Linux dependencies'
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt update
sudo apt install -y build-essential squashfs-tools curl gcc make bison
- name: 'Install MacOs dependencies'
if: matrix.os == 'macos-latest'
run: |
brew install squashfs
- uses: actions/checkout@v2
- name: 'Set up Ruby'
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0.3'
- name: Set env
run: |
export LINUX_BIN_NAME=uffizzi-${{ env.RELEASE_VERSION }}-linux-x86_64
export DARWIN_BIN_NAME=uffizzi-${{ env.RELEASE_VERSION }}-darwin-x86_64
- name: 'Create Linux Bin'
if: matrix.os == 'ubuntu-20.04'
run: |
wget https://github.com/pmq20/ruby-packer/releases/download/linux-x64/rubyc
chmod +x ./rubyc
./rubyc --openssl-dir=/etc/ssl ./uffizzi --output=LINUX_BIN_NAME
- name: 'Create Darwin Bin'
if: matrix.os == 'macos-latest'
run: |
wget https://github.com/pmq20/ruby-packer/releases/download/darwin-x64/rubyc
chmod +x ./rubyc
./rubyc --openssl-dir=/etc/ssl ./uffizzi --output=DARWIN_BIN_NAME
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: LINUX_BIN_NAME
path: LINUX_BIN_NAME
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: DARWIN_BIN_NAME
path: DARWIN_BIN_NAME
create_release:
runs-on: ubuntu-latest
needs:
- make
steps:
- name: Download Linux Bin
uses: actions/download-artifact@master
with:
name: LINUX_BIN_NAME
- name: Download Macos Bin
uses: actions/download-artifact@master
with:
name: DARWIN_BIN_NAME
- name: Generate release notes
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ env.RELEASE_VERSION }}
name: ${{ env.RELEASE_VERSION }}
files: |
${{ github.workspace }}/LINUX_BIN_NAME
${{ github.workspace }}/DARWIN_BIN_NAME
generate_release_notes: true
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: Uffizzi CLI Release
name: Uffizzi CLI Image Release
on:
release:
types: [published]
push:
tags:
- 'v*.*.*'

jobs:
code-quality:
name: Test and Lint
uses: ./.github/workflows/code-quality.yml
release:
name: Build and publish image
runs-on: ubuntu-latest
needs:
- code-quality
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
pull_request:
types: [opened,synchronize,reopened]

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
code-quality:
name: Test and Lint
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
/spec/reports/
/tmp/
.byebug_history
./uffizzi-*
packaging/traveling-ruby-*
25 changes: 24 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
## [Unreleased]
## [2.0.5] - 2023-11-07
## [2.0.4] - 2023-11-07
## [2.0.3] - 2023-11-07
- Show spinner while cluster is being created
https://github.com/UffizziCloud/uffizzi_cli/issues/245
## [2.0.1] - 2023-05-07
- Fix GHA environment check
https://github.com/UffizziCloud/uffizzi_cli/issues/241

## [2.0.0] - 2023-05-07
- Access tokens management
https://github.com/UffizziCloud/uffizzi_cli/issues/231
- uffizzi cluster create
https://github.com/UffizziCloud/uffizzi_cli/issues/223
- uffizzi project create
https://github.com/UffizziCloud/uffizzi_cli/issues/233
- uffizzi cluster list
https://github.com/UffizziCloud/uffizzi_cli/issues/234
- uffizzi cluster update-kubeconfig
https://github.com/UffizziCloud/uffizzi_cli/issues/230
- Improvements for uffizzi cluster update-kubeconfig
https://github.com/UffizziCloud/uffizzi_cli/issues/235
- Improve uffizzi cluster create UX
https://github.com/UffizziCloud/uffizzi_cli/issues/228

## [0.1.0] - 2021-11-12

Expand Down
8 changes: 5 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
uffizzi-cli (2.0.2)
uffizzi-cli (2.0.4)
activesupport
awesome_print
faker
Expand Down Expand Up @@ -127,12 +127,14 @@ GEM
zeitwerk (2.5.1)

PLATFORMS
aarch64-linux
aarch64-linux-musl
x86_64-linux
x86_64-linux-musl

DEPENDENCIES
bump
bundler (~> 2.2)
bundler (~> 2.1)
byebug
deepsort (~> 0.4.5)
factory_bot
Expand All @@ -152,4 +154,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.2.32
2.4.16
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ release:
git checkout develop
@echo 'Set a new version'
docker-compose run --rm gem bash -c "bundle exec bump set ${VERSION}"
docker-compose run --rm web bash -c "bundle install"
docker-compose run --rm gem bash -c "bundle install"
git commit -am "Change version to ${VERSION}"
@echo 'Update remote origin'
git push origin develop
Expand Down
91 changes: 0 additions & 91 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,94 +21,3 @@ desc 'Generate roff output files from ronn format'
task :generate_docs do
sh 'ronn --roff man/*.ronn'
end

PACKAGE_NAME = 'uffizzi'
VERSION = Uffizzi::VERSION
LINUX_TRAVELING_RUBY_VERSION = '20230605-2.6.10'
MACOS_TRAVELING_RUBY_VERSION = '20230605-3.0.6'

desc 'Package your app'
task package: ['package:linux:x86_64', 'package:osx:arm64', 'package:osx:x86_64']

# rubocop:disable Naming/VariableNumber
namespace :package do
namespace :linux do
desc 'Package your app for Linux x86_64'
task x86_64: [:bundle_install, "packaging/traveling-ruby-#{LINUX_TRAVELING_RUBY_VERSION}-linux-x86_64.tar.gz"] do
create_package('linux-x86_64', LINUX_TRAVELING_RUBY_VERSION)
end
end

desc 'Package your app for OS X'
namespace :osx do
task arm64: [:bundle_install, "packaging/traveling-ruby-#{MACOS_TRAVELING_RUBY_VERSION}-osx-arm64.tar.gz"] do
create_package('osx-arm64', MACOS_TRAVELING_RUBY_VERSION)
end

task x86_64: [:bundle_install, "packaging/traveling-ruby-#{MACOS_TRAVELING_RUBY_VERSION}-osx-x86_64.tar.gz"] do
create_package('osx-x86_64', MACOS_TRAVELING_RUBY_VERSION)
end
end
# rubocop:enable Naming/VariableNumber

desc 'Install gems to local directory'
task :bundle_install do
sh 'rm -rf packaging/tmp'
sh 'mkdir packaging/tmp'
sh 'mkdir packaging/tmp/lib'
sh 'mkdir packaging/tmp/lib/uffizzi'
sh 'cp lib/uffizzi/version.rb packaging/tmp/lib/uffizzi/version.rb'
sh 'cp Gemfile uffizzi.gemspec Gemfile.lock packaging/tmp/'
Bundler.with_clean_env do
sh 'cd packaging/tmp && env BUNDLE_IGNORE_CONFIG=0 bundle install --path ../vendor --without development'
end
sh 'rm -rf packaging/tmp'
sh 'rm -f packaging/vendor/*/*/cache/*'
end
end

file "packaging/traveling-ruby-#{LINUX_TRAVELING_RUBY_VERSION}-linux-x86_64.tar.gz" do
download_runtime('linux-x86_64', LINUX_TRAVELING_RUBY_VERSION)
end

file "packaging/traveling-ruby-#{MACOS_TRAVELING_RUBY_VERSION}-osx-x86_64.tar.gz" do
download_runtime('osx-x86_64', MACOS_TRAVELING_RUBY_VERSION)
end

file "packaging/traveling-ruby-#{MACOS_TRAVELING_RUBY_VERSION}-osx-arm64.tar.gz" do
download_runtime('osx-arm64', MACOS_TRAVELING_RUBY_VERSION)
end

def create_package(target, version)
package_dir = "#{PACKAGE_NAME}-#{VERSION}-#{target}"
sh("rm -rf #{package_dir}")
sh("mkdir #{package_dir}")
sh("mkdir -p #{package_dir}/lib/app")
sh("mkdir -p #{package_dir}/lib/app/config")
sh("mkdir -p #{package_dir}/lib/app/lib")
sh("mkdir -p #{package_dir}/lib/app/lib/uffizzi")

sh("cp packaging/uffizzi #{package_dir}/lib/app/uffizzi")
sh("cp -R lib/uffizzi #{package_dir}/lib/app/lib")
sh("cp lib/uffizzi.rb #{package_dir}/lib/app/lib/uffizzi.rb")
sh("cp config/uffizzi.rb #{package_dir}/lib/app/config/uffizzi.rb")
sh("mkdir #{package_dir}/lib/ruby")
sh("tar -xzf packaging/traveling-ruby-#{version}-#{target}.tar.gz -C #{package_dir}/lib/ruby")
sh("cp packaging/wrapper.sh #{package_dir}/uffizzi")
sh("cp -pR packaging/vendor #{package_dir}/lib/")
sh("cp uffizzi.gemspec Gemfile Gemfile.lock #{package_dir}/lib/vendor/")
sh("mkdir #{package_dir}/lib/vendor/lib")
sh("mkdir #{package_dir}/lib/vendor/lib/uffizzi")
sh("cp lib/uffizzi/version.rb #{package_dir}/lib/vendor/lib/uffizzi/version.rb")
sh("mkdir #{package_dir}/lib/vendor/.bundle")
sh("cp packaging/bundler-config #{package_dir}/lib/vendor/.bundle/config")
if !ENV['DIR_ONLY']
sh("tar -czf #{package_dir}.tar.gz #{package_dir}")
sh("rm -rf #{package_dir}")
end
sh('rm -rf packaging/vendor')
end

def download_runtime(target, version)
sh("cd packaging && curl -L -O --fail https://github.com/YOU54F/traveling-ruby/releases/download/rel-20230605/traveling-ruby-#{version}-#{target}.tar.gz")
end
6 changes: 5 additions & 1 deletion lib/uffizzi/cli/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def handle_succeed_set_default_response(response)
def handle_create_success_response(response)
project = response[:body][:project]
ConfigFile.write_option(:project, project[:slug])
Uffizzi.ui.say("Project #{project[:name]} was successfully created")
Uffizzi.ui.say("Project '#{project[:name]}' with slug '#{project[:slug]}' was successfully created")
end

def print_projects(projects)
Expand All @@ -170,6 +170,10 @@ def print_projects(projects)

def set_default_project(project)
ConfigFile.write_option(:project, project[:slug])
account = project[:account]
return ConfigFile.write_option(:account, Uffizzi::ConfigHelper.account_config(account[:id], account[:name])) if account

# For core versions < core_v2.2.3
ConfigFile.write_option(:account, Uffizzi::ConfigHelper.account_config(project[:account_id]))
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/uffizzi/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Uffizzi
VERSION = '2.0.2'
VERSION = '2.0.4'
end
3 changes: 0 additions & 3 deletions packaging/bundler-config

This file was deleted.

14 changes: 0 additions & 14 deletions packaging/wrapper.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
{
"project":
{
"account_id": 1,
"slug": "project_slug_1"
"name": "default",
"slug": "project_slug_1",
"description": "",
"deployments": [],
"secrets": [],
"account": {
"id": 1,
"kind": "organizational",
"name": "uffizzi",
"state": "trial"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
"projects": [
{
"slug": "project_slug_1"
"slug": "project_slug_1",
"account_id": 1,
"account": {
"id": 1,
"kind": "organizational",
"name": "uffizzi",
"state": "trial"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,23 @@
"projects": [
{
"account_id": 1,
"slug": "project_slug_1"
"slug": "project_slug_1",
"account": {
"id": 1,
"kind": "organizational",
"name": "uffizzi",
"state": "trial"
}
},
{
"account_id": 1,
"slug": "project_slug_2"
"slug": "project_slug_2",
"account": {
"id": 1,
"kind": "organizational",
"name": "uffizzi",
"state": "trial"
}
}
]
}
2 changes: 2 additions & 0 deletions test/uffizzi/cli/project_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ def test_project_set_default_success

@project.set_default(project_slug)

account_id = body[:project][:account][:id]
assert_equal(project_slug, Uffizzi::ConfigFile.read_option(:project))
assert_equal(account_id, Uffizzi::ConfigFile.read_option(:account)[:id])
assert_equal('Default project has been updated.', Uffizzi.ui.last_message)
assert_requested(stubbed_uffizzi_projects)
end
Expand Down
File renamed without changes.
Loading

0 comments on commit 0ecbca6

Please sign in to comment.