Bump to rails 8 #665
Workflow file for this run
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
name: Tests | |
on: | |
pull_request: | |
types: [review_requested, opened, reopened] | |
push: | |
branches: | |
- main | |
jobs: | |
security: | |
name: Brakeman (Static security) | |
if: "${{ github.actor != 'dependabot[bot]' }}" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
cache-version: 321 | |
- name: Run Brakeman | |
run: bundle exec brakeman -q | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
cache-version: 321 | |
- name: Run RuboCop | |
run: bundle exec rubocop --parallel | |
unit-test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Install packages | |
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y postgresql-client libpq-dev | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
cache-version: 321 | |
- name: Run unit tests | |
env: | |
RAILS_ENV: test | |
RAILS_TEST_KEY: ${{ secrets.RAILS_TEST_KEY }} | |
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432 | |
run: bin/rails db:setup spec | |
e2e-test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Install packages | |
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y postgresql-client libpq-dev | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
cache-version: 321 | |
- name: Run e2e tests | |
env: | |
RAILS_ENV: test | |
RAILS_TEST_KEY: ${{ secrets.RAILS_TEST_KEY }} | |
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432 | |
run: bin/rails db:setup; bundle exec cucumber | |
continuous-deployment: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
needs: | |
- security | |
- lint | |
- unit-test | |
- e2e-test | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
host: [services1, services2] | |
fail-fast: false | |
environment: production | |
env: | |
DEPLOY_HTTPS_LOGIN: ${{ secrets.DEPLOY_HTTPS_LOGIN }} | |
DEPLOY_HTTPS_PASSWORD: ${{ secrets.DEPLOY_HTTPS_PASSWORD }} | |
DEPLOY_HTTPS_REQUEST_URL: ${{ vars.DEPLOY_HTTPS_REQUEST_URL }} | |
DEPLOY_HTTPS_RESPONSE_URL: ${{ vars.DEPLOY_HTTPS_RESPONSE_URL }} | |
DEPLOY_HOST: host_${{ matrix.host }} | |
DEPLOY_APP: formulaire_qf_production | |
DEPLOY_BRANCH: main | |
steps: | |
- name: Download and run deploy script | |
shell: bash | |
run: | | |
git clone https://github.com/etalab/api-entreprise-integration | |
cd api-entreprise-integration | |
./deploy-parteprise.sh |