-
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 #2 from linuxfrorg/ruby3
The board is now compatible with ruby 3
- Loading branch information
Showing
10 changed files
with
150 additions
and
57 deletions.
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,4 @@ | ||
/.git | ||
/.github | ||
/deployment | ||
.*.swp |
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,25 @@ | ||
name: Build the ruby gem in a container | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build-ruby-gem: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout project code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Docker builder | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build container for build target | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./deployment/Containerfile | ||
target: build | ||
push: false | ||
load: true | ||
tags: linuxfrorg/board-sse-linuxfr.org:${{ github.sha }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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,47 @@ | ||
name: Build the ruby gem in a container and publish it on Github Package Repository | ||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build-ruby-gem: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout project code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Docker builder | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build container for build target | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./deployment/Containerfile | ||
target: build | ||
push: false | ||
load: true | ||
tags: linuxfrorg/board-sse-linuxfr.org:${{ github.sha }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Publish gem to Github Package Repository | ||
uses: addnab/docker-run-action@v3 | ||
env: | ||
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}" | ||
OWNER: ${{ github.repository_owner }} | ||
with: | ||
image: linuxfrorg/board-sse-linuxfr.org:${{ github.sha }} | ||
options: >- | ||
-e OWNER | ||
-e GEM_HOST_API_KEY | ||
run: | | ||
set -eux | ||
IFS=$'\n\t' | ||
mkdir -p "${HOME}/.gem" | ||
touch "${HOME}/.gem/credentials" | ||
chmod 0600 "${HOME}/.gem/credentials" | ||
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > "${HOME}/.gem/credentials" | ||
gem push --KEY github --host "https://rubygems.pkg.github.com/${OWNER}" *.gem |
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 |
---|---|---|
|
@@ -6,21 +6,21 @@ require './lib/board-linuxfr/version' | |
Gem::Specification.new do |s| | ||
s.name = "board-linuxfr" | ||
s.version = BoardLinuxfr::VERSION | ||
s.authors = ["Bruno Michel"] | ||
s.email = "[email protected]" | ||
s.authors = ["Bruno Michel", "Adrien Dorsaz"] | ||
s.email = "[email protected]" | ||
s.homepage = "https://github.com/linuxfrorg/board-sse-linuxfr.org" | ||
s.summary = "Push notifications for the board of LinuxFr.org via Server-Sent Events" | ||
s.description = "Push notifications for the board of LinuxFr.org via Server-Sent Events" | ||
|
||
s.files = `git ls-files bin lib`.split("\n") | ||
s.files = Dir['lib/**/*.rb'] + Dir['bin/*'] | ||
s.platform = Gem::Platform::RUBY | ||
s.executables = ["board-linuxfr"] | ||
s.require_path = 'lib' | ||
|
||
s.add_dependency "goliath", "~>1.0" | ||
s.add_dependency "hiredis", "~>0.4" | ||
s.add_dependency "redis", "~>3.0" | ||
s.add_dependency "yajl-ruby", "~>1.2" | ||
s.add_runtime_dependency "goliath", "~>1.0", ">= 1.0.7" | ||
s.add_runtime_dependency "hiredis", "~>0.4" | ||
s.add_runtime_dependency "redis", "~>3.0" | ||
s.add_runtime_dependency "yajl-ruby", "~>1.2" | ||
|
||
s.add_development_dependency "minitest", "~>2.3" | ||
end |
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,18 @@ | ||
services: | ||
linuxfr-board: | ||
build: | ||
context: . | ||
dockerfile: ./deployment/Containerfile | ||
env_file: | ||
- deployment/default.env | ||
depends_on: | ||
- redis | ||
|
||
redis: | ||
image: redis:5 | ||
volumes: | ||
- data-redis:/data | ||
|
||
volumes: | ||
data-redis: | ||
driver: local |
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,45 @@ | ||
FROM ruby:3-slim-bookworm AS build | ||
|
||
LABEL org.opencontainers.image.title="LinuxFr.org boards" | ||
LABEL org.opencontainers.image.description="Chat rooms for LinuxFr" | ||
LABEL org.opencontainers.image.source="https://github.com/linuxfrorg/board-sse-linuxfr.org" | ||
LABEL org.opencontainers.image.url="https://github.com/linuxfrorg/board-sse-linuxfr.org" | ||
LABEL org.opencontainers.image.licenses="AGPL-3.0-only" | ||
LABEL org.opencontainers.image.version="ruby3-bookworm" | ||
LABEL org.opencontainers.image.authors="Adrien Dorsaz <[email protected]>" | ||
|
||
ARG UID=1200 | ||
|
||
RUN <<EOF | ||
set -eux | ||
IFS=$'\n\t' | ||
|
||
apt-get update | ||
|
||
apt-get install -y --no-install-recommends \ | ||
build-essential ruby ruby-dev | ||
|
||
apt-get clean | ||
EOF | ||
|
||
USER ${UID} | ||
WORKDIR /linuxfr-board | ||
ENV HOME=/linuxfr-board | ||
|
||
# Install board-linuxfr | ||
COPY --chown=${UID}:0 --chmod=770 . . | ||
RUN gem build board-linuxfr.gemspec | ||
|
||
FROM build as productioproduction | ||
|
||
RUN gem install ./board-linuxfr-*.gem | ||
|
||
# Clean development dependencies | ||
USER 0 | ||
RUN apt purge --autoremove -y build-essential ruby-dev | ||
|
||
USER ${UID} | ||
EXPOSE 9000 | ||
|
||
CMD ["board-linuxfr"] | ||
|
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,3 @@ | ||
REDIS_HOST=redis | ||
REDIS_PORT=6379 | ||
REDIS_URL=redis://redis:6379/0 |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
require "goliath" | ||
require "board-linuxfr/monkeypatch" | ||
require "yajl" | ||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
class BoardLinuxfr | ||
VERSION = "0.1.3" | ||
VERSION = "0.1.4" | ||
end |