-
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 #127 from OpenSourcePolitics/develop
Bump 0.27
- Loading branch information
Showing
325 changed files
with
191,560 additions
and
21,304 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 |
---|---|---|
|
@@ -5,7 +5,7 @@ env: | |
CI: "true" | ||
SIMPLECOV: "true" | ||
RSPEC_FORMAT: "documentation" | ||
RUBY_VERSION: 2.7.5 | ||
RUBY_VERSION: 3.0.6 | ||
RAILS_ENV: test | ||
NODE_VERSION: 16.9.1 | ||
RUBYOPT: '-W:no-deprecated' | ||
|
@@ -37,11 +37,23 @@ jobs: | |
with: | ||
ruby_version: ${{ env.RUBY_VERSION }} | ||
node_version: ${{ env.NODE_VERSION }} | ||
zeitwerk: | ||
name: Check for Zeitwerk errors | ||
runs-on: ubuntu-latest | ||
if: "!startsWith(github.head_ref, 'chore/l10n')" | ||
timeout-minutes: 60 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ env.RUBY_VERSION }} | ||
bundler-cache: true | ||
- name: Check for Zeitwerk errors | ||
run: | | ||
bundle exec rails zeitwerk:check | ||
tests: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
slice: [ "0-2", "1-2" ] | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
services: | ||
|
@@ -64,58 +76,17 @@ jobs: | |
if: "github.ref != 'refs/heads/master' || github.ref != 'refs/heads/develop'" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ env.RUBY_VERSION }} | ||
bundler-cache: true | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- name: Install dependencies | ||
run: yarn install --prefer-offline --frozen-lockfile | ||
- name: Create db | ||
run: | | ||
bundle exec rails parallel:create parallel:migrate | ||
- name: Register cache hash | ||
id: cache-hash | ||
run: | | ||
echo "::set-output name=hash::$(bundle exec rake test:assets_hash)" | ||
- uses: OpenSourcePolitics/cache-precompile-action@master | ||
- uses: OpenSourcePolitics/rspec-action@master | ||
with: | ||
key: asset-cache-${{ runner.os }}-${{ steps.cache-hash.outputs.hash }} | ||
- run: mkdir -p ./spec/tmp/screenshots | ||
name: Create the screenshots folder | ||
# TODO: Use latest version | ||
- uses: nanasess/setup-chromedriver@v2 | ||
with: | ||
chromedriver-version: "114.0.5735.90" | ||
- run: bundle exec rake "test:run[exclude, spec/system/**/*_spec.rb, ${{ matrix.slice }}]" | ||
name: RSpec | ||
- run: ./.github/upload_coverage.sh decidim-app $GITHUB_EVENT_PATH | ||
name: Upload coverage | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: screenshots | ||
path: ./spec/tmp/screenshots | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: assets-manifest-${{ matrix.slice }} | ||
path: ./tmp/assets_manifest.json | ||
command: 'bundle exec rspec --exclude-pattern "spec/system/**/*_spec.rb"' | ||
prepare_command: "bundle exec rails db:create db:migrate" | ||
system_tests: | ||
strategy: | ||
matrix: | ||
slice: [ "0-4", "1-4", "2-4", "3-4" ] | ||
name: System tests | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:11 | ||
ports: ["5432:5432"] | ||
ports: [ "5432:5432" ] | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
|
@@ -127,53 +98,18 @@ jobs: | |
DATABASE_USERNAME: postgres | ||
DATABASE_PASSWORD: postgres | ||
DATABASE_HOST: localhost | ||
RAILS_ENV: test | ||
# Set locales available for i18n tasks | ||
ENFORCED_LOCALES: "en" | ||
steps: | ||
- uses: rokroskar/[email protected] | ||
if: "github.ref != 'refs/heads/master' || github.ref != 'refs/heads/develop'" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
- uses: actions/checkout@v3 | ||
- uses: OpenSourcePolitics/rspec-action@master | ||
with: | ||
fetch-depth: 1 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ env.RUBY_VERSION }} | ||
bundler-cache: true | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- name: Install dependencies | ||
run: yarn install --prefer-offline --frozen-lockfile | ||
- name: Create db | ||
run: | | ||
bundle exec rails parallel:create parallel:migrate | ||
- name: Register cache hash | ||
id: cache-hash | ||
run: | | ||
echo "::set-output name=hash::$(bundle exec rake test:assets_hash)" | ||
- uses: OpenSourcePolitics/cache-precompile-action@master | ||
with: | ||
key: asset-cache-${{ runner.os }}-${{ steps.cache-hash.outputs.hash }} | ||
- run: mkdir -p ./spec/tmp/screenshots | ||
name: Create the screenshots folder | ||
# TODO: Use latest version | ||
- uses: nanasess/setup-chromedriver@v2 | ||
with: | ||
chromedriver-version: "114.0.5735.90" | ||
- run: bundle exec rake "test:run[include, spec/system/**/*_spec.rb, ${{ matrix.slice }}]" | ||
name: RSpec | ||
- run: ./.github/upload_coverage.sh decidim-app $GITHUB_EVENT_PATH | ||
name: Upload coverage | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: screenshots | ||
path: ./spec/tmp/screenshots | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: assets-manifest-${{ matrix.slice }} | ||
path: ./tmp/assets_manifest.json | ||
command: 'bundle exec rspec "spec/system"' | ||
prepare_command: "bundle exec rails db:create db:migrate" | ||
test_build: | ||
name: Test build docker image | ||
runs-on: ubuntu-latest | ||
|
@@ -204,9 +140,9 @@ jobs: | |
database_password: ${{ env.DATABASE_PASSWORD }} | ||
database_host: ${{ env.DATABASE_HOST }} | ||
build_and_push_image_dev: | ||
name: Build and push image to Registry | ||
if: "github.ref == 'refs/heads/develop'" | ||
needs: [lint, tests, system_tests, test_build] | ||
name: Build and push image to Registry | ||
needs: [ lint, zeitwerk, tests, system_tests, test_build ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: OpenSourcePolitics/build-and-push-images-action@master | ||
|
@@ -215,10 +151,10 @@ jobs: | |
namespace: ${{ vars.REGISTRY_NAMESPACE }} | ||
password: ${{ secrets.TOKEN }} | ||
image_name: ${{ vars.IMAGE_NAME }} | ||
tag: "develop" | ||
tag: ${{ github.ref }} | ||
generate_release: | ||
name: Generate release | ||
needs: [lint, tests, system_tests, test_build] | ||
needs: [ lint, zeitwerk, tests, system_tests, test_build ] | ||
if: "github.ref == 'refs/heads/master'" | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
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 |
---|---|---|
|
@@ -87,3 +87,4 @@ git-status.txt | |
/yarn-error.log | ||
yarn-debug.log* | ||
.yarn-integrity | ||
app/compiled_views/ |
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,11 @@ | ||
Style/OpenStructUse: | ||
Enabled: false | ||
|
||
Gemspec/RequireMFA: | ||
Enabled: false | ||
|
||
Naming/MemoizedInstanceVariableName: | ||
Enabled: false | ||
|
||
RSpec/VerifiedDoubleReference: | ||
Enabled: false |
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,4 @@ | ||
inherit_from: | ||
- .rubocop_ruby.yml | ||
- .rubocop_rails.yml | ||
- .rubocop_rails.yml | ||
- .rubocop-disabled.yml |
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
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
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 +1 @@ | ||
2.7.5 | ||
3.0.6 |
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,39 +1,56 @@ | ||
FROM ruby:2.7.5 | ||
FROM ruby:3.0.6-slim as builder | ||
|
||
ENV RAILS_ENV=production \ | ||
SECRET_KEY_BASE=dummy | ||
|
||
WORKDIR /app | ||
|
||
# Install NodeJS | ||
RUN --mount=type=cache,target=/var/cache/apt \ | ||
RUN apt-get update && \ | ||
apt-get -y install libpq-dev curl git libicu-dev build-essential && \ | ||
curl https://deb.nodesource.com/setup_16.x | bash && \ | ||
apt install -y nodejs && \ | ||
apt update && \ | ||
npm install -g [email protected] && \ | ||
apt-get install -y nodejs && \ | ||
npm install --global yarn && \ | ||
apt install -y libicu-dev postgresql-client && \ | ||
gem install bundler:2.2.17 && \ | ||
rm -rf /var/lib/apt/lists/* | ||
gem install bundler:2.4.9 | ||
|
||
COPY Gemfile* ./ | ||
RUN bundle config set --local without 'development test' && bundle install | ||
RUN bundle config set --local without 'development test' && \ | ||
bundle install -j"$(nproc)" | ||
|
||
COPY package* ./ | ||
COPY yarn.lock . | ||
COPY packages packages | ||
RUN yarn install | ||
RUN yarn install --frozen-lockfile | ||
|
||
COPY . . | ||
|
||
RUN bundle exec bootsnap precompile --gemfile app/ lib/ config/ bin/ db/ && \ | ||
bundle exec rails assets:precompile && \ | ||
bundle exec rails deface:precompile | ||
|
||
# Configure endpoint. | ||
COPY ./entrypoint.sh /usr/bin/ | ||
RUN chmod +x /usr/bin/entrypoint.sh | ||
ENTRYPOINT ["entrypoint.sh"] | ||
EXPOSE 3000 | ||
RUN rm -rf node_modules tmp/cache vendor/bundle spec \ | ||
&& rm -rf /usr/local/bundle/cache/*.gem \ | ||
&& find /usr/local/bundle/gems/ -name "*.c" -delete \ | ||
&& find /usr/local/bundle/gems/ -name "*.o" -delete \ | ||
&& find /usr/local/bundle/gems/ -type d -name "spec" -prune -exec rm -rf {} \; \ | ||
&& rm -rf log/*.log | ||
|
||
FROM ruby:3.0.6-slim as runner | ||
|
||
ENV RAILS_ENV=production \ | ||
SECRET_KEY_BASE=dummy \ | ||
RAILS_LOG_TO_STDOUT=true | ||
|
||
RUN apt update && \ | ||
apt install -y postgresql-client imagemagick libproj-dev proj-bin libjemalloc2 && \ | ||
gem install bundler:2.4.9 | ||
|
||
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"] | ||
WORKDIR /app | ||
|
||
COPY --from=builder /usr/local/bundle /usr/local/bundle | ||
COPY --from=builder /app /app | ||
|
||
ENV LD_PRELOAD="libjemalloc.so.2" \ | ||
MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:5000,muzzy_decay_ms:5000,narenas:2" | ||
|
||
EXPOSE 3000 | ||
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.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
Oops, something went wrong.