Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Avo 3 #2044

Merged
merged 9 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Steps to reproduce the behavior:

- [ ] Community
- [ ] Pro
- [ ] Advanced

**Are you using Avo monkey patches, overriding views or view components?**
<!-- (Mark [x] inside the brackets) -->
Expand Down
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Fixes # (issue)
- [ ] I have made corresponding changes to the [documentation](https://github.com/avo-hq/avodocs)
- [ ] I have added tests that prove my fix is effective or that my feature works

## Screenshots
<!-- Does the PR introduce any visual changes? Can you show us before and after? -->

## Manual review steps
<!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. -->
Expand Down
36 changes: 0 additions & 36 deletions .github/delete-release-notes-draft.js

This file was deleted.

28 changes: 0 additions & 28 deletions .github/get-release-notes-from-draft.js

This file was deleted.

2 changes: 2 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ template: |
More information and release video [here](https://avohq.io/releases/$NEXT_PATCH_VERSION)

$CHANGES

For more information, check out [Avo's release notes page](https://avohq.io/releases)
10 changes: 10 additions & 0 deletions .github/workflows/build-release-notes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Build release notes

on:
push:
branches:
- main

jobs:
update_release_notes:
uses: avo-hq/support/.github/workflows/build-release-notes.yml@main
20 changes: 0 additions & 20 deletions .github/workflows/codeball.yml

This file was deleted.

111 changes: 111 additions & 0 deletions .github/workflows/feature-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Feature Tests

on:
pull_request:
branches:
- main
- 1.x
- 2.x
push:
branches:
- main
- 1.x
- 2.x

env:
RAILS_ENV: test
PGHOST: localhost
PGUSER: postgres
PGPORT: 5432
POSTGRES_HOST: localhost
POSTGRES_USERNAME: postgres
POSTGRES_PORT: 5432
BUNDLE_PATH_RELATIVE_TO_CWD: true
AVO_LICENSE_KEY: license_123
BUNDLE_RUBYGEMS__PKG__GITHUB__COM: adrianthedev:${{secrets.GH_REGISTRY_AVO_FILTERS_TOKEN}}

jobs:
feature_specs:
strategy:
matrix:
ruby:
- '3.2.2'
rails:
- '6.0'
- '6.1'
- '7.0'
- '7.1'
runs-on: ubuntu-latest

env:
RAILS_VERSION: ${{matrix.rails}}
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.rails }}_ruby_${{ matrix.ruby }}.gemfile

services:
postgres:
image: postgres:10.8
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
# bundler-cache: true
bundler: default
ruby-version: ${{ matrix.ruby }}

- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-test-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-test-gems-${{ hashFiles('**/Gemfile.lock') }}

- name: Bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
bin/rails db:create
bin/rails db:migrate

- name: Get yarn cache directory path
id: test-yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v3
id: test-yarn-cache
with:
path: ${{ steps.test-yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-test-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-test-yarn-${{ hashFiles('**/yarn.lock') }}

- name: Yarn install the dummy app
run: |
cd spec/dummy
yarn

- name: Yarn install
run: yarn

- name: Build assets
env:
RAILS_ENV: production
NODE_ENV: production
run: |
yarn build:js
yarn build:custom-js
yarn build:css

- name: Run tests
id: run_tests
run: bundle exec rspec spec/features

- uses: actions/upload-artifact@v3
if: always() && steps.run_tests.outcome == 'failure'
with:
name: rspec_failed_screenshots_rails_${{ matrix.rails }}_ruby_${{ matrix.ruby }}
path: ./spec/dummy/tmp/screenshots
16 changes: 7 additions & 9 deletions .github/workflows/label-pr.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
name: PR Labeler
name: Label PR

on:
pull_request:
pull_request_target:
types: [opened]

permissions:
contents: read

jobs:
pr-labeler:
label-pr:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: TimonVS/pr-labeler-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
contents: read # for TimonVS/pr-labeler-action to read config file
pull-requests: write # for TimonVS/pr-labeler-action to add labels in PR
uses: avo-hq/support/.github/workflows/label-pr.yml@main
33 changes: 7 additions & 26 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,8 @@
name: Linting
on: [pull_request]
jobs:
standardrb:
name: runner / standardrb
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
- name: standardrb
uses: adrianthedev/action-standardrb@master
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review # Default is github-pr-check
rubocop_version: 0.1.6
rubocop_flags: --format progress
name: Lint

on:
- pull_request

eslint:
name: runner / eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: yarn
- name: eslint
uses: reviewdog/action-eslint@v1
with:
reporter: github-pr-review
jobs:
lint:
uses: avo-hq/support/.github/workflows/lint.yml@main
20 changes: 0 additions & 20 deletions .github/workflows/release-notes.yml

This file was deleted.

23 changes: 16 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.0

- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-production-gems-${{ hashFiles('**/Gemfile.lock') }}
Expand All @@ -38,7 +38,7 @@ jobs:
id: production-yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
- uses: actions/cache@v3
id: production-yarn-cache
with:
path: ${{ steps.production-yarn-cache-dir-path.outputs.dir }}
Expand All @@ -52,6 +52,9 @@ jobs:
- name: Yarn check integrity
run: yarn check --integrity

- name: Symlink avo packages
run: bundle exec rails avo:sym_link

- name: Build assets
run: |
yarn prod:build:js
Expand All @@ -66,21 +69,27 @@ jobs:
echo "::set-output name=tag::$(sed "s|refs/tags/v||" <<< ${{ github.ref }})"

- name: Get release notes
uses: actions/github-script@v6
id: get_release_notes
run: |
echo "::set-output name=release_notes::$(node .github/get-release-notes-from-draft.js ${{github.repository}} ${{secrets.GITHUB_TOKEN}})"
with:
script: |
const {data: releases} = await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
});
return releases.find((r) => r.draft)?.body || "No draft release found."

- name: Create Release
id: create_release
if: ${{steps.get_release_notes.outputs.release_notes != ''}}
if: ${{steps.get_release_notes.outputs.result != ''}}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
${{fromJson(steps.get_release_notes.outputs.release_notes)}}
${{fromJson(steps.get_release_notes.outputs.result)}}
draft: false
prerelease: false

Expand Down