Skip to content

feat: S3 & Docker compatibility #1419

feat: S3 & Docker compatibility

feat: S3 & Docker compatibility #1419

Workflow file for this run

name: "CI/CD"
on: [push]
env:
RSPEC_FORMAT: "documentation"
RUBY_VERSION: 3.2.2
RAILS_ENV: test
NODE_ENV: test
NODE_VERSION: 18.17.1
AVAILABLE_LOCALES: "en,fr,ca,es"
jobs:
lint:
name: Lint code
runs-on: ubuntu-latest
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 }}
zeitwerk:
name: Check for Zeitwerk errors
runs-on: ubuntu-latest
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:
name: Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
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
steps:
- uses: rokroskar/[email protected]
if: "github.ref != 'refs/heads/main' || github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ inputs.ruby_version }}
bundler-cache: true
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node_version }}
cache: 'npm'
cache-dependency-path: ./package-lock.json
- uses: actions/cache@v4
id: app-cache
with:
path: ./spec/decidim_dummy_app/
key: app-${{ github.sha }}
restore-keys: app-${{ github.sha }}
- run: bundle exec rake test:setup
name: Create test app
shell: "bash"
- run: mkdir -p ./spec/decidim_dummy_app/tmp/screenshots
name: Create the screenshots folder
shell: "bash"
- run: npm install
name: Install JS dependencies
working-directory: ./spec/decidim_dummy_app/
shell: "bash"
env:
NODE_ENV: test
- run: bundle exec rails shakapacker:compile
name: Precompile assets
working-directory: ./spec/decidim_dummy_app/
shell: "bash"
env:
NODE_ENV: test
docker_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 }}
push: "true"
generate_release:
name: Generate release
needs: [lint, zeitwerk, tests, docker_build]
if: "github.ref == 'refs/heads/main'"
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 }}