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

British library - DO NOT MERGE!!!! #83

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
steps:
- id: setup
name: Setup
uses: scientist-softserv/actions/[email protected].11
uses: notch8/actions/[email protected].13
with:
tag: ${{ inputs.tag }}
image_name: ${{ inputs.image_name }}
Expand All @@ -90,7 +90,7 @@ jobs:
cd ${{ inputs.subdir }};
touch .env.development;
touch .env;
TAG=latest docker-compose pull web || true
TAG=latest docker compose pull web || true
- name: Retag action for web
id: meta-web
uses: docker/[email protected]
Expand Down
134 changes: 134 additions & 0 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: "Cypress testing"
on:
workflow_dispatch:
inputs:
confdir:
required: false
type: string
default: "/app/samvera/hyrax-webapp/solr/config"
cypress-container-name:
required: false
type: string
subdir:
default: '.'
type: string
tag:
required: false
type: string
rspec_cmd:
required: false
type: string
default: "gem install semaphore_test_boosters && rspec_booster --job $CI_NODE_INDEX/$CI_NODE_TOTAL"
setup_db_cmd:
required: false
type: string
default: "RAILS_ENV=test bundle exec rake db:create db:schema:load db:migrate"
worker:
required: false
type: boolean
workflow_call:
inputs:
confdir:
required: false
type: string
default: "/app/samvera/hyrax-webapp/solr/config"
cypress-container-name:
required: false
type: string
subdir:
default: '.'
type: string
tag:
required: false
type: string
rspec_cmd:
required: false
type: string
default: "gem install semaphore_test_boosters && rspec_booster --job $CI_NODE_INDEX/$CI_NODE_TOTAL"
setup_db_cmd:
required: false
type: string
default: "RAILS_ENV=test bundle exec rake db:create db:schema:load db:migrate"
worker:
required: false
type: boolean

env:
REGISTRY: ghcr.io

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
env:
ALLOW_ANONYMOUS_LOGIN: "yes"
CONFDIR: ${{ inputs.confdir }}
DB_CLEANER_ALLOW_REMOTE_DB_URL: "true"
TB_RSPEC_FORMATTER: progress
TB_RSPEC_OPTIONS: --format RspecJunitFormatter --out rspec.xml
steps:
- id: setup
name: Setup
uses: notch8/actions/[email protected]
with:
tag: ${{ inputs.tag }}
token: ${{ secrets.CHECKOUT_TOKEN || secrets.GITHUB_TOKEN }}
- name: Github Container Login
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
with:
limit-access-to-actor: true
- name: Pull image to prevent build
run: >-
cd ${{ inputs.subdir }};
touch .env.development;
touch .env;
docker compose pull web
- name: Pull worker image to prevent build
if: ${{ inputs.worker }}
run: >-
cd ${{ inputs.subdir }};
docker compose pull worker
- name: Start containers
run: >-
cd ${{ inputs.subdir }};
[ -f "db/schema.rb" ] && chmod 777 db/schema.rb;
docker compose up -d web
- name: Check for and setup Solr if needed
shell: bash
run: |
cd ${{ inputs.subdir }};
if [ -d solr ]
then
docker compose exec -T web sh -c \
"solrcloud-upload-configset.sh "${CONFDIR}" &&
SOLR_COLLECTION_NAME=hydra-test solrcloud-assign-configset.sh &&
solrcloud-assign-configset.sh"
else
echo "No solr directory found, skipping..."
fi
- name: Setup db
run: >-
cd ${{ inputs.subdir }};
docker compose exec -T web sh -c
"${{ inputs.setup_db_cmd }}"
- name: Run Cypress Tests
id: run-specs
continue-on-error: true
run: >-
cd ${{ inputs.subdir }};
docker compose up ${{ inputs.cypress-container-name }}
- name: Fail job if spec failure
run: if [[ ${{ steps.run-specs.outcome }} == "failure" ]]; then exit 1; else exit 0; fi
- name: Publish Cypress Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: 'cypress/results/results-*.xml'
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
steps:
- id: setup
name: Setup
uses: scientist-softserv/actions/[email protected].11
uses: notch8/actions/[email protected].13
with:
tag: ${{ inputs.tag }}
image_name: ${{ inputs.image_name }}
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: "Lint for Rails Projects"
on:
workflow_dispatch:
inputs:
lint_cmd:
required: false
type: string
default: docker compose run web bundle exec rubocop --parallel --format progress
subdir:
default: '.'
type: string
Expand All @@ -13,6 +17,10 @@ on:
type: boolean
workflow_call:
inputs:
lint_cmd:
required: false
type: string
default: docker compose run web bundle exec rubocop --parallel --format progress
subdir:
default: '.'
type: string
Expand All @@ -32,7 +40,7 @@ jobs:
steps:
- id: setup
name: Setup
uses: scientist-softserv/actions/[email protected].11
uses: notch8/actions/[email protected].13
with:
tag: ${{ inputs.tag }}
token: ${{ secrets.CHECKOUT_TOKEN || secrets.GITHUB_TOKEN }}
Expand All @@ -47,17 +55,18 @@ jobs:
cd ${{ inputs.subdir }};
touch .env.development;
touch .env;
docker-compose pull web
docker compose pull web
- name: Pull worker image to prevent build
run: >-
cd ${{ inputs.subdir }};
docker-compose pull worker
docker compose pull worker
if: ${{ inputs.worker }}
- name: Run Rubocop
run: >-
cd ${{ inputs.subdir }};
[ -f "db/schema.rb" ] && chmod 777 db/schema.rb;
docker-compose run web bundle exec rubocop --parallel --format progress
[ -f "bin/checkout_all.sh" ] && ./bin/checkout_all.sh;
${{ inputs.lint_cmd }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
steps:
- id: setup
name: Setup
uses: scientist-softserv/actions/[email protected].11
uses: notch8/actions/[email protected].13
with:
tag: ${{ inputs.tag }}
token: ${{ secrets.CHECKOUT_TOKEN || secrets.GITHUB_TOKEN }}
Expand All @@ -92,24 +92,24 @@ jobs:
cd ${{ inputs.subdir }};
touch .env.development;
touch .env;
docker-compose pull web
docker compose pull web
- name: Pull worker image to prevent build
if: ${{ inputs.worker }}
run: >-
cd ${{ inputs.subdir }};
docker-compose pull worker
docker compose pull worker
- name: Start containers
run: >-
cd ${{ inputs.subdir }};
[ -f "db/schema.rb" ] && chmod 777 db/schema.rb;
docker-compose up -d web
docker compose up -d web
- name: Check for and setup Solr if needed
shell: bash
run: |
cd ${{ inputs.subdir }};
if [ -d solr ]
then
docker-compose exec -T web sh -c \
docker compose exec -T web sh -c \
"solrcloud-upload-configset.sh "${CONFDIR}" &&
SOLR_COLLECTION_NAME=hydra-test solrcloud-assign-configset.sh &&
solrcloud-assign-configset.sh"
Expand All @@ -119,7 +119,7 @@ jobs:
- name: Setup db
run: >-
cd ${{ inputs.subdir }};
docker-compose exec -T web sh -c
docker compose exec -T web sh -c
"${{ inputs.setup_db_cmd }}"
- name: Run Specs
id: run-specs
Expand All @@ -132,7 +132,7 @@ jobs:
continue-on-error: true
run: >-
cd ${{ inputs.subdir }};
docker-compose exec -T web sh -c
docker compose exec -T web sh -c
"${{ inputs.rspec_cmd }}"
- name: Fail job if spec failure
run: if [[ ${{ steps.run-specs.outcome }} == "failure" ]]; then exit 1; else exit 0; fi
Expand Down