diff --git a/.github/bleeding_edge.rb b/.github/bleeding_edge.rb new file mode 100644 index 00000000..c90afe51 --- /dev/null +++ b/.github/bleeding_edge.rb @@ -0,0 +1,11 @@ +puts "source \"https://rubygems.org\"" + +Gem::Specification.stubs.map do |stub| + url = stub.metadata["source_code_uri"] || stub.homepage + matched = url[%r{https?://git(?:hub|lab)\.com/[^\/]*/[^\/]*}] + if matched + puts "gem #{stub.name.inspect}, git: #{matched.inspect}" + else + puts "gem #{stub.name.inspect}" + end +end diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index b5a74b39..ba88cf94 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -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 @@ -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 > Gemfile && bundle lock && cat Gemfile.lock + - name: Build uses: docker/build-push-action@v5 @@ -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: | @@ -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: @@ -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 }} diff --git a/Dockerfile b/Dockerfile index a5089a96..73afc691 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -12,7 +13,7 @@ FROM node:20-alpine3.20 AS node-downloader RUN npm install esbuild@0.23.1 -g -FROM ruby:3.3.4-alpine3.20 +FROM ${BASE_IMAGE:-ruby:3.3.4-alpine3.20} WORKDIR /app