-
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 #26 from OpenSourcePolitics/add/admin_creation_task
Préparation IH
- Loading branch information
Showing
19 changed files
with
421 additions
and
62 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Stacktrace** | ||
If applicable, add the error stacktrace to help explain your problem. | ||
|
||
**Extra data (please complete the following information):** | ||
- Device: [e.g. iPhone6, Desktop] | ||
- Device OS: [e.g. iOS8.1, Windows 10] | ||
- Browser: [e.g. Chrome, Firefox, Safari] | ||
- Decidim Version: [e.g. 0.10] | ||
- Decidim installation: [e.g. Metadecidim] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. For instance, add Metadecidim link. |
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,25 @@ | ||
#### :tophat: Description | ||
*Please describe your pull request.* | ||
|
||
#### :pushpin: Related Issues | ||
*Link your PR to an issue* | ||
- Related to #? | ||
- Fixes #? | ||
- [Notion card]() | ||
|
||
#### Testing | ||
*Describe the best way to test or validate your PR.* | ||
|
||
Example: | ||
* Log in as admin | ||
* Access Backoffice | ||
* Go to organization settings | ||
* See ... | ||
|
||
#### Tasks | ||
- [ ] Add specs | ||
- [ ] Add note about overrides in OVERLOADS.md | ||
- [ ] In case of new dependencies or version bump, update related documentation | ||
|
||
### :camera: Screenshots | ||
*Please add screenshots of the changes you're proposing if related to the UI* |
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,10 +1,14 @@ | ||
name: "CI-CD" | ||
on: push | ||
name: "CI/CD" | ||
on: [push] | ||
|
||
env: | ||
CI: "true" | ||
SIMPLECOV: "true" | ||
RSPEC_FORMAT: "documentation" | ||
RUBY_VERSION: 2.7.5 | ||
RAILS_ENV: test | ||
NODE_VERSION: 16.9.1 | ||
RUBYOPT: '-W:no-deprecated' | ||
|
||
jobs: | ||
lint: | ||
|
@@ -17,38 +21,18 @@ jobs: | |
if: "github.ref != 'refs/heads/develop'" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
- uses: actions/[email protected] | ||
- uses: OpenSourcePolitics/lint-action@master | ||
with: | ||
fetch-depth: 1 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ env.RUBY_VERSION }} | ||
bundler-cache: true | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- name: Get npm cache directory path | ||
id: npm-cache-dir-path | ||
run: echo "::set-output name=dir::$(npm get cache)-lint" | ||
- uses: actions/cache@v2 | ||
id: npm-cache | ||
with: | ||
path: ${{ steps.npm-cache-dir-path.outputs.dir }} | ||
key: npm-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
npm- | ||
- name: Install JS dependencies | ||
run: npm ci | ||
- run: bundle exec rubocop -P | ||
name: Lint Ruby files | ||
ruby_version: ${{ env.RUBY_VERSION }} | ||
node_version: ${{ env.NODE_VERSION }} | ||
tests: | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
if: "!startsWith(github.head_ref, 'chore/l10n')" | ||
services: | ||
postgres: | ||
image: postgres:11 | ||
ports: ["5432:5432"] | ||
ports: [ "5432:5432" ] | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
|
@@ -91,3 +75,72 @@ jobs: | |
with: | ||
name: screenshots | ||
path: ./spec/decidim_dummy_app/tmp/screenshots | ||
test_build: | ||
name: Test build docker image | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:11 | ||
ports: [ "5432:5432" ] | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
env: | ||
POSTGRES_PASSWORD: postgres | ||
env: | ||
DATABASE_USERNAME: postgres | ||
DATABASE_PASSWORD: postgres | ||
DATABASE_HOST: host.docker.internal | ||
steps: | ||
- uses: OpenSourcePolitics/build-and-test-images-action@master | ||
with: | ||
registry: ${{ vars.REGISTRY_ENDPOINT }} | ||
namespace: ${{ vars.REGISTRY_NAMESPACE }} | ||
image_name: ${{ vars.IMAGE_NAME }} | ||
tag: ${{ github.ref }} | ||
password: ${{ secrets.TOKEN }} | ||
database_username: ${{ env.DATABASE_USERNAME }} | ||
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, test_build ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: OpenSourcePolitics/build-and-push-images-action@master | ||
with: | ||
registry: ${{ vars.REGISTRY_ENDPOINT }} | ||
namespace: ${{ vars.REGISTRY_NAMESPACE }} | ||
password: ${{ secrets.TOKEN }} | ||
image_name: ${{ vars.IMAGE_NAME }} | ||
tag: "develop-${{ github.sha }}" | ||
generate_release: | ||
name: Generate release | ||
needs: [ lint, tests, test_build ] | ||
if: "github.ref == 'refs/heads/master'" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: mathieudutour/[email protected] | ||
name: Bump version and push tag | ||
id: tag_version | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: ncipollo/release-action@v1 | ||
name: Create a GitHub release | ||
with: | ||
generateReleaseNotes: true | ||
tag: ${{ steps.tag_version.outputs.new_tag }} | ||
name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
body: ${{ steps.tag_version.outputs.changelog }} | ||
- uses: OpenSourcePolitics/build-and-push-images-action@master | ||
with: | ||
registry: ${{ vars.REGISTRY_ENDPOINT }} | ||
namespace: ${{ vars.REGISTRY_NAMESPACE }} | ||
password: ${{ secrets.TOKEN }} | ||
image_name: ${{ vars.IMAGE_NAME }} | ||
tag: ${{ steps.tag_version.outputs.new_tag }} | ||
|
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,37 @@ | ||
FROM ruby:2.6.3 | ||
|
||
ENV LANG C.UTF-8 | ||
ENV LC_ALL C.UTF-8 | ||
ENV RAILS_ENV=production | ||
ENV RAILS_LOG_TO_STDOUT=true | ||
ENV PORT=3000 | ||
ENV SECRET_KEY_BASE=f97271c0788641d98a8a7feaa2b8b40fdc28f83285a4f23703abdaf3ac0641a4f047788fd15e4b698e026325ebda371573c370fd6a3bdb720d7e04a580b84882 | ||
ENV RAILS_SERVE_STATIC_FILES=true | ||
|
||
# Installs bundler dependencies | ||
ENV \ | ||
BUNDLE_BIN=/usr/local/bundle/bin \ | ||
BUNDLE_JOBS=10 \ | ||
BUNDLE_PATH=/usr/local/bundle \ | ||
BUNDLE_RETRY=3 \ | ||
GEM_HOME=/bundle | ||
ENV PATH="${BUNDLE_BIN}:${PATH}" | ||
|
||
RUN apt-get update -qq | ||
RUN apt-get install -y git imagemagick wget \ | ||
&& apt-get clean | ||
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \ | ||
&& apt-get install -y nodejs \ | ||
&& apt-get clean | ||
RUN npm install -g [email protected] | ||
FROM ruby:2.7.5 | ||
|
||
ENV RAILS_ENV=production \ | ||
SECRET_KEY_BASE=dummy | ||
|
||
WORKDIR /app | ||
RUN mkdir -p /app | ||
|
||
COPY docker-entrypoint.sh /app/ | ||
RUN chmod +x /app/docker-entrypoint.sh | ||
# Install NodeJS | ||
RUN --mount=type=cache,target=/var/cache/apt \ | ||
curl https://deb.nodesource.com/setup_16.x | bash && \ | ||
apt install -y nodejs && \ | ||
apt update && \ | ||
npm install -g [email protected] && \ | ||
npm install --global yarn && \ | ||
apt install -y libicu-dev postgresql-client && \ | ||
gem install bundler:2.2.17 && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY Gemfile* ./ | ||
RUN bundle config set --local without 'development test' && bundle install | ||
|
||
COPY package* ./ | ||
COPY yarn.lock . | ||
RUN yarn install | ||
|
||
COPY Gemfile* /app/ | ||
RUN export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ") | ||
RUN gem install bundler | ||
RUN bundle check || bundle install --system | ||
COPY . /app/ | ||
COPY . . | ||
|
||
RUN bundle exec bootsnap precompile --gemfile app/ lib/ config/ bin/ db/ \ | ||
RUN bundle exec rake assets:precompile | ||
|
||
# Configure endpoint. | ||
COPY ./entrypoint.sh /usr/bin/ | ||
RUN chmod +x /usr/bin/entrypoint.sh | ||
ENTRYPOINT ["entrypoint.sh"] | ||
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
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
return unless Rails.env.production? | ||
|
||
HealthCheck.setup do |config| | ||
# uri prefix (no leading slash) | ||
config.uri = "health_check" | ||
|
||
# Text output upon success | ||
config.success = "success" | ||
|
||
# Text output upon failure | ||
config.failure = "health_check failed" | ||
|
||
# Disable the error message to prevent /health_check from leaking | ||
# sensitive information | ||
config.include_error_in_response_body = false | ||
|
||
# Log level (success or failure message with error details is sent to rails log unless this is set to nil) | ||
config.log_level = "info" | ||
|
||
# Timeout in seconds used when checking smtp server | ||
config.smtp_timeout = 30.0 | ||
|
||
config.http_status_for_error_object = 500 | ||
|
||
# You can customize which checks happen on a standard health check, eg to set an explicit list use: | ||
config.standard_checks = %w(database migrations) | ||
end |
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,7 @@ | ||
# frozen_string_literal: true | ||
|
||
return unless Rails.env.production? | ||
|
||
SidekiqAlive.setup do |config| | ||
config.path = "/sidekiq_alive" | ||
end |
Oops, something went wrong.