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

Merge upstream changes | 2023-5-8 #3

Closed
wants to merge 8 commits into from
Closed
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
244 changes: 166 additions & 78 deletions .github/workflows/build-test-lint.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
name: "Ruby on Rails CI"
name: "Build & Test Docker Images"
on:
push:
branches:
- develop
pull_request:
branches:
- develop
- main
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false

env:
REGISTRY: ghcr.io
Expand All @@ -20,90 +15,158 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set env
run: echo "TAG=${GITHUB_SHA::8}" >> $GITHUB_ENV
run: >-
echo "TAG=${HEAD_TAG::8}" >> ${GITHUB_ENV};
echo ${HEAD_TAG::8}
env:
HEAD_TAG: ${{ github.event.pull_request.head.sha || github.sha }}
shell: bash
- name: Downcase repo
run: echo "REPO_LOWER=${REPO,,}" >> $GITHUB_ENV
env:
REPO: '${{ github.repository }}'
REPO: "${{ github.repository }}"
run: |
echo "REPO_LOWER=${REPO,,}" >> ${GITHUB_ENV}
shell: bash
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Github Container Login
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull from cache to speed up build
run: >-
touch .env.development;
touch .env;
TAG=latest docker-compose pull web || true
- 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: Build and push
- name: Retag action for web
id: meta-web
uses: docker/[email protected]
with:
images: |
name=${{ env.REGISTRY }}/${{ env.REPO_LOWER }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
- name: Retag action for worker
id: meta-worker
uses: docker/[email protected]
with:
images: |
name=${{ env.REGISTRY }}/${{ env.REPO_LOWER }}/worker
tags: |
type=raw,value=latest,enable={{is_default_branch}}
- name: Retag action for solr
id: meta-solr
uses: docker/[email protected]
with:
images: |
name=${{ env.REGISTRY }}/${{ env.REPO_LOWER }}/solr
tags: |
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push web
uses: docker/build-push-action@v3
with:
build-args: |
APP_PATH=.
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_LOWER }}:${{ env.TAG }}
context: .
# platforms: linux/amd64,linux/arm64
file: ./Dockerfile
# platforms: "linux/amd64,linux/arm64"
platforms: linux/amd64
target: ams-base
build-args: |
SETTINGS__BULKRAX__ENABLED=true
EXTRA_APK_PACKAGES=less vim bash openjdk11-jre ffmpeg rsync yarn
cache-from: |
${{ env.REGISTRY }}/${{ env.REPO_LOWER }}:${TAG}
push: true
tags: |
${{ steps.meta-web.outputs.tags }}
${{ env.REGISTRY }}/${{ env.REPO_LOWER }}:${{ env.TAG }}
target: ams-base
- name: Build and push worker
uses: docker/build-push-action@v3
with:
build-args: |
APP_PATH=.
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_LOWER }}/worker:${{ env.TAG }}
context: .
file: ./Dockerfile
platforms: linux/amd64
# platforms: linux/amd64,linux/arm64
target: ams-worker
build-args: |
SETTINGS__BULKRAX__ENABLED=true
EXTRA_APK_PACKAGES=less vim bash openjdk11-jre ffmpeg rsync yarn
cache-from: |
${{ env.REGISTRY }}/${{ env.REPO_LOWER }}:${TAG}
# platforms: "linux/amd64,linux/arm64"
push: true
tags: |
${{ steps.meta-worker.outputs.tags }}
${{ env.REGISTRY }}/${{ env.REPO_LOWER }}/worker:${{ env.TAG }}
target: ams-worker
- name: Build and push solr
uses: docker/build-push-action@v3
with:
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.REPO_LOWER }}/solr:${{ env.TAG }}
context: ./solr
platforms: "linux/amd64,linux/arm64"
push: true
tags: |
${{ steps.meta-solr.outputs.tags }}
${{ env.REGISTRY }}/${{ env.REPO_LOWER }}/solr:${{ env.TAG }}
target: ams-solr

# lint:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: Set env
# run: echo "TAG=${GITHUB_SHA::8}" >> $GITHUB_ENV
# # run: echo "TAG=f9867d90" >> $GITHUB_ENV
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Github Container Login
# uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Pull from cache to speed up build
# run: >-
# touch .env.development;
# docker-compose pull web;
# docker-compose pull worker
# - name: Run Rubocop
# run: docker-compose run web bundle exec rubocop --parallel --format progress --format junit --out rubocop.xml --display-only-failed
# - name: Publish Test Report
# uses: mikepenz/action-junit-report@v3
# if: always() # always run even if the previous step fails
# with:
# report_paths: 'rubocop*.xml'
lint:
needs: build
runs-on: ubuntu-latest
steps:
- name: Set env
run: >-
echo "TAG=${HEAD_TAG::8}" >> ${GITHUB_ENV};
echo ${HEAD_TAG::8}
env:
HEAD_TAG: ${{ github.event.pull_request.head.sha || github.sha }}
shell: bash
- name: Downcase repo
env:
REPO: "${{ github.repository }}"
run: |
echo "REPO_LOWER=${REPO,,}" >> ${GITHUB_ENV}
shell: bash
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull image to prevent build
run: >-
touch .env.development;
touch .env;
docker-compose pull web
- name: Pull worker image to prevent build
run: >-
docker-compose pull worker
- name: Run Rubocop
run: >-
[ -f "db/schema.rb" ] && chmod 777 db/schema.rb;
docker-compose run web bundle exec rubocop --parallel --format progress
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: 'rubocop*.xml'

test:
needs: build
Expand All @@ -126,39 +189,63 @@ jobs:
TB_RSPEC_OPTIONS: --format RspecJunitFormatter --out rspec.xml
steps:
- name: Set env
run: echo "TAG=${GITHUB_SHA::8}" >> $GITHUB_ENV
# run: echo "TAG=f9867d90" >> $GITHUB_ENV
run: >-
echo "TAG=${HEAD_TAG::8}" >> ${GITHUB_ENV};
echo ${HEAD_TAG::8}
env:
HEAD_TAG: ${{ github.event.pull_request.head.sha || github.sha }}
shell: bash
- name: Downcase repo
env:
REPO: "${{ github.repository }}"
run: |
echo "REPO_LOWER=${REPO,,}" >> ${GITHUB_ENV}
shell: bash
- name: Checkout code
uses: actions/checkout@v3
- name: Github Container Login
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
submodules: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull from cache to speed up build
- name: Pull image to prevent build
run: >-
touch .env.development;
docker-compose pull web;
touch .env;
docker-compose pull web
- name: Pull worker image to prevent build
run: >-
docker-compose pull worker
- 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: Start containers
run: docker-compose up -d web
- name: Setup solr
run: >-
docker-compose exec -T web bash -c
"solrcloud-upload-configset.sh /app/samvera/hyrax-webapp/solr/config &&
SOLR_COLLECTION_NAME=hydra-test solrcloud-assign-configset.sh &&
solrcloud-assign-configset.sh"
[ -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: |
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: >-
docker-compose exec -T web bash -c
"RAILS_ENV=test bundle exec rake db:schema:load db:migrate db:seed"
docker-compose exec -T web sh -c
"RAILS_ENV=test bundle exec rake db:create db:schema:load db:migrate"
- name: Run Specs
id: run-specs
env:
# Specifies how many jobs you would like to run in parallel,
# used for partitioning
Expand All @@ -167,9 +254,10 @@ jobs:
CI_NODE_INDEX: ${{ matrix.ci_node_index }}
continue-on-error: true
run: >-
docker-compose exec -T web bash -c
"gem install semaphore_test_boosters &&
rspec_booster --job $CI_NODE_INDEX/$CI_NODE_TOTAL"
docker-compose exec -T web sh -c
"gem install semaphore_test_boosters && rspec_booster --job $CI_NODE_INDEX/$CI_NODE_TOTAL"
- name: Fail job if spec failure
run: if [[ ${{ steps.run-specs.outcome }} == "failure" ]]; then exit 1; else exit 0; fi
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/deploy.yaml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/main.yaml

This file was deleted.

Loading