generated from OpenSourcePolitics/decidim-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* preparation IH * fix specs * remove deface * fix i18n * re add deface * Update .github/workflows/ci_cd.yml Co-authored-by: Armand Fardeau <[email protected]> * Update .github/workflows/ci_cd.yml Co-authored-by: Armand Fardeau <[email protected]> * Revert "remove deface" This reverts commit 5c4471d. * Disable deface when precompiling * Fix issues * lint and add default value for deface enabled * Revert "lint and add default value for deface enabled" This reverts commit 36745a4. * Update Dockerfile Co-authored-by: Armand Fardeau <[email protected]> * Update config/environments/production.rb Co-authored-by: Armand Fardeau <[email protected]> * lint * wip (#53) * update dockerignore --------- Co-authored-by: Armand Fardeau <[email protected]> Co-authored-by: armandfardeau <[email protected]>
- Loading branch information
1 parent
346771e
commit cb72dac
Showing
23 changed files
with
497 additions
and
335 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 |
---|---|---|
|
@@ -23,3 +23,5 @@ docker-compose.prod.yml | |
docker-compose.yml | ||
OVERLOADS.md | ||
Makefile | ||
public/decidim-packs | ||
public/packs-test |
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 |
---|---|---|
@@ -0,0 +1,157 @@ | ||
name: "CI/CD" | ||
on: [push] | ||
|
||
env: | ||
CI: "true" | ||
SIMPLECOV: "true" | ||
RSPEC_FORMAT: "documentation" | ||
RUBY_VERSION: 3.0.2 | ||
RAILS_ENV: test | ||
NODE_VERSION: 16.9.1 | ||
RUBYOPT: '-W:no-deprecated' | ||
|
||
jobs: | ||
lint: | ||
name: Lint code | ||
runs-on: ubuntu-latest | ||
if: "!startsWith(github.head_ref, 'chore/l10n')" | ||
timeout-minutes: 60 | ||
steps: | ||
- uses: rokroskar/[email protected] | ||
if: "github.ref != 'refs/heads/develop'" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
- uses: OpenSourcePolitics/lint-action@master | ||
with: | ||
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" ] | ||
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: localhost | ||
RAILS_ENV: test | ||
# Set locales available for i18n tasks | ||
ENFORCED_LOCALES: "en,fr" | ||
steps: | ||
- uses: rokroskar/[email protected] | ||
if: "github.ref != 'refs/heads/master' || github.ref != 'refs/heads/develop'" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
- uses: OpenSourcePolitics/rspec-action@master | ||
with: | ||
command: 'bundle exec rspec --exclude-pattern "spec/system/**/*_spec.rb"' | ||
prepare_command: "bundle exec rails db:create db:migrate" | ||
system_tests: | ||
name: System tests | ||
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: 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: OpenSourcePolitics/rspec-action@master | ||
with: | ||
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 | ||
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, system_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, system_tests, test_build ] | ||
if: "github.ref == 'refs/heads/master'" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: mathieudutour/[email protected] | ||
name: Bump vaersion 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 was deleted.
Oops, something went wrong.
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,36 +1,39 @@ | ||
FROM ruby:2.7.1 | ||
FROM ruby:3.0.2 | ||
|
||
# Install NodeJS | ||
RUN curl https://deb.nodesource.com/setup_16.x | bash | ||
RUN apt install -y nodejs | ||
|
||
# Install Yarn | ||
RUN curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null | ||
RUN echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | tee /etc/apt/sources.list.d/yarn.list | ||
RUN apt update && apt install -y yarn | ||
|
||
# Decidim dependencies | ||
RUN apt install -y libicu-dev postgresql-client | ||
|
||
# Install npm | ||
RUN npm install -g [email protected] | ||
# Install bundler | ||
RUN gem install bundler:2.2.29 | ||
ENV RAILS_ENV=production \ | ||
SECRET_KEY_BASE=dummy | ||
|
||
# Copy all decidim-app content to /app | ||
ADD . /app | ||
WORKDIR /app | ||
|
||
RUN bundle install && yarn install && bundle exec rails assets:precompile | ||
|
||
# Perform assets compilation | ||
# 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 . | ||
COPY packages packages | ||
RUN yarn install | ||
RUN SECRET_KEY_BASE=dummy bundle exec rails assets:precompile | ||
|
||
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 | ||
|
||
CMD ["rails", "server", "-b", "0.0.0.0"] | ||
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"] |
Oops, something went wrong.