Skip to content

Commit

Permalink
Migrate to shared GitHub Actions workflow
Browse files Browse the repository at this point in the history
Migrates to a new, shared GitHub Actions workflow template provided by the BerkeleyLibrary/.github repository. This does essentially what we have always done, but pulls the workflow configuration from the central repository. The CI process is as follows:

- Build: The Docker image is built, tagged (branch, SHA, and tag), and pushed to ghcr.io/berkeleylibrary/geodata.
- Test: The built image is tested using `docker compose`.

The test stage depends on the consuming repository having implemented `bin/test`, `bin/setup`, and `docker-compose(.ci)?.yml` files. For more information on that, see the accompanying files in this commit or the forthcoming documentation in the shared workflows repo.
  • Loading branch information
danschmidt5189 committed Jan 24, 2025
1 parent 868b55c commit 3712b1e
Show file tree
Hide file tree
Showing 14 changed files with 167 additions and 316 deletions.
81 changes: 81 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
*.rbc
capybara-*.html
.bash*
.rspec
/db/*.sqlite3
/db/*.sqlite3-journal
/db/*.sqlite3-[0-9]*
/public/system
/coverage/
/spec/tmp
*.orig
rerun.txt
pickle-email-*.html

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# TODO Comment out this rule if you are OK with secrets being uploaded to the repo
config/initializers/secret_token.rb
config/master.key

# Only include if you have production secrets in this file, which is no longer a Rails default
# config/secrets.yml

# dotenv
# TODO Comment out this rule if environment variables can be committed
.env

## Environment normalization:
/.bundle
/vendor/bundle

# these should all be checked in to normalize the environment:
# Gemfile.lock, .ruby-version, .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# if using bower-rails ignore default bower_components path bower.json files
/vendor/assets/bower_components
*.bowerrc
bower.json

# Ignore pow environment settings
.powenv

# Ignore Byebug command history file.
.byebug_history

# Ignore Bash history file.
.bash_history

# Ignore node_modules
node_modules/

# Ignore precompiled javascript packs
/public/packs
/public/packs-test
/public/assets

# Ignore yarn files
/yarn-error.log
yarn-debug.log*
.yarn-integrity

# Ignore uploaded files in development
/storage/*
!/storage/.keep

# Build/test artifacts
/artifacts/

# Ignore solr files
solr/*/data/*

.irb_history

.github
159 changes: 0 additions & 159 deletions .github/workflows/build.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Docker CI

on:
push:
release:
workflow_dispatch:

jobs:
build:
uses: BerkeleyLibrary/.github/.github/workflows/[email protected]

test:
needs: build
uses: BerkeleyLibrary/.github/.github/workflows/[email protected]
69 changes: 0 additions & 69 deletions .github/workflows/release.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,9 @@ Rails/RootJoinChain: # new in 2.13
Enabled: true

# to skip default code generation
Layout/ClassLength:
Metrics/ClassLength:
Enabled: false
Layout/MethodLength:
Metrics/MethodLength:
Enabled: false
Layout/BlockLength:
Metrics/BlockLength:
Enabled: false
2 changes: 1 addition & 1 deletion .simplecov
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ SimpleCov.start 'rails' do
add_filter %w[/app/channels/ /app/jobs/ /bin/ /db/]
coverage_dir 'artifacts'
formatter SimpleCov::Formatter::RcovFormatter
minimum_coverage 100
minimum_coverage 70
end
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ RUN mkdir -p /opt/app \
&& chown -R $APP_USER:$APP_USER /opt/app /usr/local/bundle

# Get list of available packages
RUN apt-get update -qq
RUN apt-get update -qq

# Install standard packages from the Debian repository
RUN apt-get install -y --no-install-recommends \
bash \
curl \
default-jre \
ca-certificates \
ca-certificates \
nodejs \
libpq-dev \
libvips42 \
Expand All @@ -42,7 +42,7 @@ USER geodata
WORKDIR /opt/app

# Add binstubs to the path.
ENV PATH "/opt/app/bin:$PATH"
ENV PATH="/opt/app/bin:$PATH"


# If run with no other arguments, the image will start the rails server by
Expand Down Expand Up @@ -106,14 +106,14 @@ RUN rails assets:precompile assets:clean log:clear tmp:clear
ARG BUILD_TIMESTAMP
ARG BUILD_URL
ARG DOCKER_TAG
ARG GIT_BRANCH
ARG GIT_COMMIT
ARG GIT_URL
ARG GIT_REF_NAME
ARG GIT_SHA
ARG GIT_REPOSITORY_URL

# build arguments aren't persisted in the image, but ENV values are
ENV BUILD_TIMESTAMP="${BUILD_TIMESTAMP}"
ENV BUILD_URL="${BUILD_URL}"
ENV DOCKER_TAG="${DOCKER_TAG}"
ENV GIT_BRANCH="${GIT_BRANCH}"
ENV GIT_COMMIT="${GIT_COMMIT}"
ENV GIT_URL="${GIT_URL}"
ENV GIT_REF_NAME="${GIT_REF_NAME}"
ENV GIT_SHA="${GIT_SHA}"
ENV GIT_REPOSITORY_URL="${GIT_REPOSITORY_URL}"
Loading

0 comments on commit 3712b1e

Please sign in to comment.