Skip to content

Commit

Permalink
Bleeding edge workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Earlopain committed Oct 21, 2024
1 parent df6816d commit 9c8ff83
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
13 changes: 13 additions & 0 deletions .github/bleeding_edge.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
lines = ["source \"https://rubygems.org\""]

Gem::Specification.stubs.each do |stub|
url = stub.metadata["source_code_uri"] || stub.homepage
matched = url[%r{https?://git(?:hub|lab)\.com/[^\/]*/[^\/]*}]
if matched && stub.name != "minitest"
lines << "gem #{stub.name.inspect}, git: #{matched.inspect}"
else
lines << "gem #{stub.name.inspect}"
end
end

File.write("Gemfile", lines.join("\n"))
30 changes: 28 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,20 @@ on: # yamllint disable-line rule:truthy
pull_request:
branches:
- master
schedule:
- cron: 0 20 * * *
workflow_dispatch:
inputs:
bleeding_edge:
type: boolean
default: false

permissions:
contents: read

env:
BLEEDING_EDGE: "${{ (inputs.bleeding_edge == true || github.event_name == 'schedule') && 'true' || 'false' }}"

jobs:
tests:
runs-on: ubuntu-latest
Expand All @@ -19,6 +29,18 @@ jobs:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- if: env.BLEEDING_EDGE == 'true'
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- if: env.BLEEDING_EDGE == 'true'
name: Unfreeze bundler
run: bundle config --local deployment false
- if: env.BLEEDING_EDGE == 'true'
name: "Use git gem sources"
run: bundle exec ruby .github/bleeding_edge.rb && bundle lock && cat Gemfile.lock


- name: Build
uses: docker/build-push-action@v5
Expand All @@ -27,6 +49,8 @@ jobs:
cache-to: type=gha,mode=max
load: true
tags: foxtrove
build-args: |
BASE_IMAGE=${{ env.BLEEDING_EDGE == 'true' && 'ghcr.io/docker-ruby-nightly/ruby:alpine3.20-nightly' || ''}}
- name: Set env file
run: |
Expand Down Expand Up @@ -54,7 +78,8 @@ jobs:
with:
bundler-cache: true

- name: Run Rubocop
- if: env.BLEEDING_EDGE == 'false'
name: Run Rubocop
run: bundle exec rubocop --format github

docker-checks:
Expand All @@ -67,5 +92,6 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Run ${{ matrix.service }}
- if: env.BLEEDING_EDGE == 'false'
name: Run ${{ matrix.service }}
run: docker compose run ${{ matrix.service }}
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM ruby:3.3.4-alpine3.20 AS ruby-builder
ARG BASE_IMAGE
FROM ${BASE_IMAGE:-ruby:3.3.4-alpine3.20} AS ruby-builder

RUN apk --no-cache add build-base cmake postgresql16-dev

Expand All @@ -12,7 +13,7 @@ FROM node:20-alpine3.20 AS node-downloader

RUN npm install [email protected] -g

FROM ruby:3.3.4-alpine3.20
FROM ${BASE_IMAGE:-ruby:3.3.4-alpine3.20}

WORKDIR /app

Expand Down

0 comments on commit 9c8ff83

Please sign in to comment.