Skip to content

Commit

Permalink
Run our CI steps in our docker-compose setup
Browse files Browse the repository at this point in the history
  • Loading branch information
hennevogel committed Nov 9, 2023
1 parent 5ec4077 commit 29e0bfa
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
42 changes: 18 additions & 24 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,51 +12,45 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
- name: install bundle
run: |
bundle config set --local force_ruby_platform true
bundle config build.nokogiri --use-system-libraries
bundle config set --local path 'vendor/bundle';
bundle config set --local jobs 3
bundle config set --local retry 3
docker-compose run --rm --no-deps software bundle install --local
- name: Cache Ruby Bundle
uses: actions/cache@v3
with:
ruby-version: 3.1
bundler-cache: true
linter:
path: |
vendor/bundle
key: bundle-${{ hashFiles('Gemfile.lock') }}
rubocop:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true
- name: Run linter
run: bundle exec rubocop
run: docker-compose run --rm --no-deps software bundle exec rubocop
haml-linter:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true
- name: Run linter
run: bundle exec haml-lint app/views/
run: docker-compose run --rm --no-deps software bundle exec haml-lint app/views/
unit:
needs: [linter, haml-linter]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true
- name: Run unit tests
run: bundle exec rake test
run: docker-compose run --rm software bundle exec rake test
system:
needs: [linter, haml-linter]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true
- name: Run system tests
run: bundle exec rake test:system
run: docker-compose run --rm software bundle exec rake test:system
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ diff.diff

# Bundler config
/.bundle
# Local bundle
/vendor/bundle

# Static files in public
public/111
Expand Down
18 changes: 11 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ RUN usermod -u $CONTAINER_USERID software
# docker would use it's cache for this and the following stages.
ADD Gemfile /software/Gemfile
ADD Gemfile.lock /software/Gemfile.lock
COPY vendor/cache /software/vendor/cache
RUN chown -R software /software

USER software
WORKDIR /software

# Setup bundler
# We always want to build for our platform instead of using precompiled gems
ENV BUNDLE_FORCE_RUBY_PLATFORM=true
RUN bundle config build.nokogiri --use-system-libraries

# Refresh our bundle
RUN bundle install --jobs=3 --retry=3
# Setup our Ruby bundle
# - build for our platform instead of using precompiled gems
# - use system libraries instead of rebuilding them
# - install into vendor/bundle
RUN bundle config set --local force_ruby_platform true; \
bundle config build.nokogiri --use-system-libraries; \
bundle config set --local path 'vendor/bundle'; \
bundle config set --local jobs 3; \
bundle config set --local retry 3; \
bundle install --local

# Run our command
CMD ["rails", "server", "-b", "0.0.0.0"]
Expand Down

0 comments on commit 29e0bfa

Please sign in to comment.