Skip to content

Commit e8c69ec

Browse files
bastelfreakrwaffen
authored andcommitted
Switch builds to native GitHub actions
1 parent 9435a2b commit e8c69ec

File tree

3 files changed

+41
-84
lines changed

3 files changed

+41
-84
lines changed

.github/workflows/pr-testing.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,33 @@ jobs:
8383
run: rake spec
8484

8585
build:
86-
name: build openvox-server
86+
name: build openvox-server - Java ${{ matrix.version }}
8787
runs-on: ubuntu-24.04
88+
strategy:
89+
fail-fast: false
90+
matrix:
91+
version: ['11', '17', '21']
8892
steps:
8993
- name: checkout repo
9094
uses: actions/checkout@v4
9195
with:
9296
submodules: recursive
97+
- name: setup java
98+
uses: actions/setup-java@v4
99+
with:
100+
distribution: 'temurin'
101+
java-version: ${{ matrix.version }}
93102
- name: setup ruby
94103
uses: ruby/setup-ruby@v1
95104
with:
96105
ruby-version: '3.2'
97106
bundler-cache: true
98-
# uses the Dockerfile to build openvox-server in a container
99-
# the container hardcodes the java version
107+
- name: Output ruby environment
108+
run: bundle env
109+
- name: Install clojure tools
110+
uses: DeLaGuardo/[email protected]
111+
with:
112+
lein: latest
100113
- name: build it
101114
run: bundle exec rake vox:build
102115

Dockerfile

Lines changed: 0 additions & 19 deletions
This file was deleted.

tasks/build.rake

Lines changed: 25 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -18,71 +18,34 @@ rpm_platforms = ENV['RPM_PLATFORMS'] || 'el-7,el-8,el-9,el-10,sles-15,amazon-202
1818
@debs = deb_platforms.split(',').map{ |p| "base-#{p.split('-').join}-i386.cow" }.join(' ')
1919
@rpms = rpm_platforms.split(',').map{ |p| "pl-#{p}-x86_64" }.join(' ')
2020

21-
def image_exists
22-
!`docker images -q #{@image}`.strip.empty?
23-
end
24-
25-
def container_exists
26-
!`docker container ls --all --filter 'name=#{@container}' --format json`.strip.empty?
27-
end
28-
29-
def teardown
30-
if container_exists
31-
puts "Stopping #{@container}"
32-
run_command("docker stop #{@container}", silent: false, print_command: true)
33-
run_command("docker rm #{@container}", silent: false, print_command: true)
34-
end
35-
end
36-
37-
def start_container(ezbake_dir)
38-
run_command("docker run -d --name #{@container} -v .:/code -v #{ezbake_dir}:/ezbake #{@image} /bin/sh -c 'tail -f /dev/null'", silent: false, print_command: true)
39-
end
40-
41-
def run(cmd)
42-
run_command("docker exec #{@container} /bin/bash --login -c '#{cmd}'", silent: false, print_command: true)
43-
end
44-
4521
namespace :vox do
4622
desc 'Build openvox-server packages with Docker'
4723
task :build, [:tag] do |_, args|
48-
begin
49-
#abort 'You must provide a tag.' if args[:tag].nil? || args[:tag].empty?
50-
if args[:tag].nil? || args[:tag].empty?
51-
puts 'running build with current branch'
52-
else
53-
puts "running build on #{args[:tag]}"
54-
run_command("git fetch --tags && git checkout #{args[:tag]}")
55-
end
56-
57-
# If the Dockerfile has changed since this was last built,
58-
# delete all containers and do `docker rmi ezbake-builder`
59-
unless image_exists
60-
puts "Building ezbake-builder image"
61-
run_command("docker build -t ezbake-builder .", silent: false, print_command: true)
62-
end
63-
64-
puts "Checking out ezbake"
65-
tmp = Dir.mktmpdir("ezbake")
66-
ezbake_dir = "#{tmp}/ezbake"
67-
ezbake_repo = ENV.fetch('EZBAKE_REPO', 'https://github.com/openvoxproject/ezbake')
68-
ezbake_branch = ENV['EZBAKE_BRANCH'] || 'main'
69-
run_command("git clone -b #{ezbake_branch} #{ezbake_repo} #{ezbake_dir}", silent: false, print_command: true)
70-
71-
puts "Starting container"
72-
teardown if container_exists
73-
start_container(ezbake_dir)
74-
75-
puts "Installing ezbake from source"
76-
run("cd /ezbake && lein install")
77-
78-
puts "Building openvox-server"
79-
run("cd /code && rm -rf ruby && rm -rf output && bundle install --without test && lein install")
80-
run("cd /code && COW=\"#{@debs}\" MOCK=\"#{@rpms}\" GEM_SOURCE='https://rubygems.org' EZBAKE_ALLOW_UNREPRODUCIBLE_BUILDS=true EZBAKE_NODEPLOY=true LEIN_PROFILES=ezbake lein with-profile user,ezbake,provided,internal ezbake local-build")
81-
run_command("sudo chown -R $USER output", print_command: true)
82-
Dir.glob('output/**/*i386*').each { |f| FileUtils.rm_rf(f) }
83-
Dir.glob('output/puppetserver-*.tar.gz').each { |f| FileUtils.mv(f, f.sub('puppetserver','openvox-server'))}
84-
ensure
85-
teardown
24+
if args[:tag].nil? || args[:tag].empty?
25+
puts 'running build with current branch'
26+
else
27+
puts "running build on #{args[:tag]}"
28+
run_command("git fetch --tags && git checkout #{args[:tag]}")
8629
end
30+
31+
puts "Checking out ezbake"
32+
tmp = Dir.mktmpdir("ezbake")
33+
ezbake_dir = "#{tmp}/ezbake"
34+
ezbake_repo = ENV.fetch('EZBAKE_REPO', 'https://github.com/openvoxproject/ezbake')
35+
ezbake_branch = ENV['EZBAKE_BRANCH'] || 'main'
36+
run_command("git clone -b #{ezbake_branch} #{ezbake_repo} #{ezbake_dir}", silent: false, print_command: true)
37+
38+
# prepare git foo for packaging gem (????)
39+
run_command("git config --global user.email '[email protected]'; git config --global user.name 'Your Name'")
40+
41+
puts "Installing ezbake from source"
42+
run_command("cd #{ezbake_dir} && lein install")
43+
44+
puts "Building openvox-server"
45+
run_command("rm -rf ruby && rm -rf output && lein install")
46+
run_command("COW=\"#{@debs}\" MOCK=\"#{@rpms}\" GEM_SOURCE='https://rubygems.org' EZBAKE_ALLOW_UNREPRODUCIBLE_BUILDS=true EZBAKE_NODEPLOY=true LEIN_PROFILES=ezbake lein with-profile user,ezbake,provided,internal ezbake local-build")
47+
run_command("sudo chown -R $USER output", print_command: true)
48+
Dir.glob('output/**/*i386*').each { |f| FileUtils.rm_rf(f) }
49+
Dir.glob('output/puppetserver-*.tar.gz').each { |f| FileUtils.mv(f, f.sub('puppetserver','openvox-server'))}
8750
end
8851
end

0 commit comments

Comments
 (0)