Skip to content

[#499] Improve error message #676

[#499] Improve error message

[#499] Improve error message #676

name: Test Generated App
on: push
env:
COMPOSE_FILE: docker-compose.test.yml
APP_NAME: rails-templates
DOCKER_IMAGE: ${{ github.repository }}
DOCKER_REGISTRY_HOST: ${{ secrets.DOCKER_REGISTRY_HOST }}
DOCKER_REGISTRY_USERNAME: ${{ github.repository_owner }}
DOCKER_REGISTRY_TOKEN: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
RUBY_VERSION: 3.2.2
NODE_VERSION: 18
RAILS_VERSION: 7.1.2
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: ${{ matrix.variant }} variant
runs-on: ubuntu-latest
strategy:
matrix:
variant: [web, api]
steps:
- uses: actions/checkout@v3
- name: Set env BRANCH_TAG
uses: nimblehq/branch-tag-action@1
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Cache gems
uses: actions/cache@v3
with:
path: /home/runner/.rubies/ruby-${{ env.RUBY_VERSION }}
key: ${{ runner.os }}-gems-${{ env.RUBY_VERSION }}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-${{ env.RUBY_VERSION }}-
- name: Create app folder
run: mkdir $APP_NAME
- name: Get yarn cache directory path
if: ${{ matrix.variant == 'web' }}
id: yarn-cache-dir-path
run: echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache npm packages
if: ${{ matrix.variant == 'web' }}
uses: actions/cache@v3
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.yarn_cache_dir }}
**/yarn.lock
**/node_modules
key: ${{ runner.os }}-npm-packages-${{ hashFiles('**/package.json*') }}
restore-keys: |
${{ runner.os }}-npm-packages-
- name: Create rails app
run: |
gem install rails -v ${{ env.RAILS_VERSION }} --no-document
make create_${{ matrix.variant }}
- name: Login to docker registry
uses: docker/login-action@v2
with:
registry: ${{ env.DOCKER_REGISTRY_HOST }}
username: ${{ env.DOCKER_REGISTRY_USERNAME }}
password: ${{ env.DOCKER_REGISTRY_TOKEN }}
- name: Pull docker image
if: env.BRANCH_TAG != 'latest' && env.BRANCH_TAG != 'development'
run: |
export BRANCH_TAG=${{ env.BRANCH_TAG }}-${{ matrix.variant }}
cd $APP_NAME
docker compose pull test || true
- name: Build docker image
run: |
export BRANCH_TAG=${{ env.BRANCH_TAG }}-${{ matrix.variant }}
make build
- name: Push docker image to docker registry
run: |
export BRANCH_TAG=${{ env.BRANCH_TAG }}-${{ matrix.variant }}
cd $APP_NAME
docker compose push test
- name: Test the structure that is generated by the template
run: |
export BRANCH_TAG=${{ env.BRANCH_TAG }}-${{ matrix.variant }}
make test_template VARIANT=${{ matrix.variant }}
- name: Test the generated app
run: |
export BRANCH_TAG=${{ env.BRANCH_TAG }}-${{ matrix.variant }}
make test_variant_app