Skip to content

Commit

Permalink
Merge tag 'upstream/1.14.1'
Browse files Browse the repository at this point in the history
v1.14.1
  • Loading branch information
sorah committed Nov 3, 2023
2 parents 34aeffd + 889bafd commit db596a9
Show file tree
Hide file tree
Showing 26 changed files with 282 additions and 281 deletions.
122 changes: 25 additions & 97 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,120 +12,49 @@ on:
schedule:
- cron: "30 15 * * *" # 7:30 PST (-8), 8:30 PDT (-7)

env:
OSXCROSS_REVISION: 4287300a5c96397a2ee9ab3942e66578a1982031
XCODE_VERSION: '12.4'

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Install libraries
run: sudo apt-get install bison git libonig-dev
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true

- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.9.1
- name: Integration test
run: bundle exec rake test:integration

docker-build:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [linux]
arch: [x86_64, i686, armhf, aarch64]
include:
- { os: linux, arch: x86_64 }
- { os: linux, arch: i386 }
- { os: linux, arch: armhf }
- { os: linux, arch: aarch64 }
- { os: darwin, arch: x86_64 }
- { os: darwin, arch: aarch64 }
fail-fast: false
steps:
- name: Install libraries
run: sudo apt-get install bison git libonig-dev
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true

- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.9.1
- name: Build ${{ matrix.os }}-${{ matrix.arch }} binary
run: bundle exec rake release:build:${{ matrix.os }}-${{ matrix.arch }} release:compress

- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: mitamae-${{ matrix.arch }}-${{ matrix.os }}
path: mitamae-build/

macos-sdk:
runs-on: macos-latest
steps:
- uses: actions/cache@v2
id: macos-sdk-cache
with:
key: macos-sdk-${{ env.OSXCROSS_REVISION }}-${{ env.XCODE_VERSION }}
path: osxcross/tarballs
- name: Package MacOSX SDK
if: steps.macos-sdk-cache.outputs.cache-hit != 'true'
run: |
curl -sSLf https://github.com/tpoechtrager/osxcross/archive/${OSXCROSS_REVISION}.tar.gz | tar zxf -
mv osxcross-${OSXCROSS_REVISION} osxcross
cd osxcross
XCODEDIR=/Applications/Xcode_${XCODE_VERSION}.app tools/gen_sdk_package.sh
mv MacOSX*.sdk.tar.xz tarballs/
osxcross:
runs-on: ubuntu-latest
needs:
- macos-sdk
steps:
- name: Download osxcross
run: |
curl -sSLf https://github.com/tpoechtrager/osxcross/archive/${OSXCROSS_REVISION}.tar.gz | tar zxf -
mv osxcross-${OSXCROSS_REVISION} osxcross
- uses: actions/cache@v2
with:
key: macos-sdk-${{ env.OSXCROSS_REVISION }}-${{ env.XCODE_VERSION }}
path: osxcross/tarballs
- uses: actions/cache@v2
id: osxcross-cache
with:
key: osxcross-${{ runner.os }}-${{ env.OSXCROSS_REVISION }}-${{ env.XCODE_VERSION }}
path: osxcross/target
- name: Build osxcross
if: steps.osxcross-cache.outputs.cache-hit != 'true'
run: UNATTENDED=1 ./build.sh
working-directory: osxcross

osxcross-build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [darwin]
arch: [x86_64, aarch64]
fail-fast: false
needs:
- osxcross
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- uses: actions/cache@v2
id: osxcross-cache
with:
key: osxcross-${{ runner.os }}-${{ env.OSXCROSS_REVISION }}-${{ env.XCODE_VERSION }}
path: osxcross/target
- name: Build mitamae
run: |
export PATH="$PWD/osxcross/target/bin:$PATH"
bundle exec rake compile BUILD_TARGET="${{ matrix.os }}-${{ matrix.arch }}"
mkdir -p mitamae-build
cp "mruby/build/${{ matrix.os }}-${{ matrix.arch }}/bin/mitamae" "mitamae-build/mitamae-${{ matrix.arch }}-${{ matrix.os }}"
cd mitamae-build
tar zcvf "mitamae-${{ matrix.arch }}-${{ matrix.os }}.tar.gz" "mitamae-${{ matrix.arch }}-${{ matrix.os }}"
- name: Upload artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: mitamae-${{ matrix.arch }}-${{ matrix.os }}
path: mitamae-build/
Expand All @@ -134,31 +63,30 @@ jobs:
runs-on: ubuntu-latest
needs:
- test
- docker-build
- osxcross-build
- build
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v3
with:
name: mitamae-x86_64-linux
path: mitamae-build/
- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v3
with:
name: mitamae-i686-linux
name: mitamae-i386-linux
path: mitamae-build/
- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v3
with:
name: mitamae-armhf-linux
path: mitamae-build/
- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v3
with:
name: mitamae-aarch64-linux
path: mitamae-build/
- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v3
with:
name: mitamae-x86_64-darwin
path: mitamae-build/
- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v3
with:
name: mitamae-aarch64-darwin
path: mitamae-build/
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ mitamae-build/
ghr
*.zip
/mruby
/MacOSX.sdk
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
## v1.14.1

- Upgrade specinfra [from v2.83.3 to v2.87.0](https://github.com/mizzy/specinfra/compare/v2.83.3...v2.87.0)

## v1.14.0

- Migrate the cross-compilation toolchain to Zig
- All Linux targets use musl, so no libc dependency.
- Now linux-i386 is distributed instead of linux-i686
- Upgrade mruby-yaml
- `123_456` is parsed as `123456` instead of `"123_456"`

## v1.13.1

- Upgrade specinfra [from v2.82.25 to v2.83.3](https://github.com/mizzy/specinfra/compare/v2.82.25...v2.83.3)

## v1.13.0

- `local_ruby_block` executes `code` under `cwd` if it's present

## v1.12.10

- Stream output of `run_command` with `--log-level debug` or `log_output: true` option

## v1.12.9

- Get encrypted passwords from `/etc/shadow` for some platforms

## v1.12.8

- Support Itamae v1.11.0's `sensitive` attribute in file resources

## v1.12.7

- Add mruby-enum-ext
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

mitamae is a tool to automate configuration management using a Chef-like DSL powered by mruby.

It's been used for provisioning servers, e.g. [RubyCI servers](https://github.com/ruby/ruby-infra-recipe)
and [Ruby's git server](https://github.com/ruby/git.ruby-lang.org), and setting up local environments
with [dotfiles](https://github.com/search?q=dotfiles+mitamae&type=code).

### Key Features

* **Fast** -
Expand Down Expand Up @@ -40,7 +44,7 @@ service 'nginx' do
end
```

And then excute `mitamae local` command to apply a recipe to a local machine.
And then execute `mitamae local` command to apply a recipe to a local machine.

```diff
$ mv mitamae-x86_64-linux mitamae
Expand Down Expand Up @@ -91,6 +95,7 @@ They should be ported to Itamae at some point.

* `not_if` / `only_if` can take a block instead of a command
* `file`, `remote_file`, and `template` resources have `atomic_update` attribute
* `run_command` streams log output with `--log-level debug` or `log_output: true` option.

### Plugins

Expand Down Expand Up @@ -145,6 +150,14 @@ and recipes to the servers and run them remotely. There are at least the followi
and recipes from an object storage and run them.
Deployment tools like [AWS CodeDeploy](https://aws.amazon.com/codedeploy/) are useful to achieve them.

### Example recipes

The following recipes are open-source usages of mitamae.

* [ruby/ruby-infra-recipe](https://github.com/ruby/ruby-infra-recipe)
* [ruby/git.ruby-lang.org](https://github.com/ruby/git.ruby-lang.org)
* [k0kubun/dotfiles](https://github.com/k0kubun/dotfiles)

### Migrating from Chef

While the DSL is inspired by Chef, there are some differences you need to keep in mind
Expand Down
23 changes: 11 additions & 12 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ file :mruby do
end
end

DOCKCROSS_TARGETS = %w[
CROSS_TARGETS = %w[
linux-x86_64
linux-i686
linux-i386
linux-armhf
linux-aarch64
darwin-x86_64
darwin-i386
darwin-aarch64
]

STRIP_TARGETS = %w[
linux-x86_64
linux-i686
linux-i386
]

# avoid redefining constants in mruby Rakefile
Expand Down Expand Up @@ -86,18 +86,17 @@ task :clean do
end

desc 'cross compile for release'
task 'release:build' => DOCKCROSS_TARGETS.map { |target| "release:build:#{target}" }
task 'release:build' => CROSS_TARGETS.map { |target| "release:build:#{target}" }

DOCKCROSS_TARGETS.each do |target|
CROSS_TARGETS.each do |target|
desc "Build for #{target}"
task "release:build:#{target}" do
sh [
'docker', 'run', '--rm', '-e', "BUILD_TARGET=#{target}",
'-v', "#{File.expand_path(__dir__)}:/home/mruby/code", '-w', '/home/mruby/code',
"k0kubun/mitamae-dockcross:#{target}", 'rake', 'compile',
].shelljoin

Dir.chdir(__dir__) do
# Workaround: Running `rake compile` twice breaks mattn/mruby-onig-regexp
FileUtils.rm_rf('mruby/build')

sh "rake compile BUILD_TARGET=#{target.shellescape}"

FileUtils.mkdir_p('mitamae-build')
os, arch = target.split('-', 2)
bin = "mitamae-build/mitamae-#{arch}-#{os}"
Expand Down
Loading

0 comments on commit db596a9

Please sign in to comment.