Current user mgmt #928
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: efolder_rake | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [opened, reopened, synchronize] | |
env: | |
FORCE_COLOR: "1" #Forces color within GHA - Note RSPEC still won't use color see line 199 --tty for rspec color | |
jobs: | |
rake: | |
runs-on: ubuntu-8-cores-latest | |
services: | |
postgres: | |
image: postgres:14.8 | |
env: | |
POSTGRES_USER: root | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: caseflow_efolder_test | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
redis: | |
image: redis:4.0.10 | |
ports: | |
- 6379:6379 | |
localstack: | |
image: localstack/localstack:0.12.5 | |
container: | |
image: 065403089830.dkr.ecr.us-gov-west-1.amazonaws.com/gaimg-ruby:2.7.3-ga-browsers | |
options: --privileged # Necessary for Rspec to run with our configuration within GHA. Needed for rspec step to prevent chromedriver issue | |
credentials: | |
username: AWS | |
password: ${{ secrets.VAEC_ECR_PASSWORD }} | |
env: | |
DBUS_SESSION_BUS_ADDRESS: /dev/null | |
RAILS_ENV: test | |
BUNDLE_PATH: vendor/bundle | |
POSTGRES_HOST: postgres | |
POSTGRES_USER: root | |
POSTGRES_PASSWORD: password | |
WD_INSTALL_DIR: .webdrivers | |
CI: true | |
REDIS_URL_CACHE: redis://redis:6379/0/cache/ | |
steps: | |
- uses: actions/checkout@v3 | |
- name: install node version | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '16.16.0' | |
- name: Install Chrome | |
run: | | |
apt-get update | |
wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ | |
&& apt install -y /tmp/chrome.deb \ | |
&& rm /tmp/chrome.deb | |
echo "Chrome exe name: $(ls /usr/bin | chrome)" | |
echo "Chrome version: $(google-chrome --version)" | |
- name: Ruby version | |
run: ruby -v | |
- name: Configure Bundler | |
run: |- | |
BUNDLER_V=$(cat ./Gemfile.lock | tail -1 | tr -d " ") | |
echo $BUNDLER_V | |
gem install bundler:$BUNDLER_V | |
- name: Bundle install | |
run: bundle install --path vendor/bundle | |
- name: yarn install | |
run: ./ci-bin/capture-log "cd client && yarn install --frozen-lockfile" | |
- name: Yarn build | |
run: yarn run build | |
working-directory: "./client" | |
- name: Database setup | |
run: |- | |
./ci-bin/capture-log "RAILS_ENV=test bundle exec rake db:create" | |
./ci-bin/capture-log "RAILS_ENV=test bundle exec rake db:schema:load" | |
- name: Assets Precompile | |
run: | | |
./ci-bin/capture-log "bundle exec rake assets:precompile" | |
- name: RSpec | |
run: |- | |
mkdir -p ./test-results/rspec | |
mkdir .webdrivers | |
chmod -R 777 ${GITHUB_WORKSPACE} | |
set -o pipefail | |
runuser -u circleci -- make -f Makefile.example test | tee ./test-results/rspec/rspec.out # circleci refers to user | |
env: | |
POSTGRES_HOST: postgres | |
shell: bash | |
# Artifact Uploads | |
- uses: actions/upload-artifact@v3 | |
if: success() || failure() | |
with: | |
path: "./test-results" | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
path: "./tmp/capybara" | |
- uses: actions/upload-artifact@v3 | |
if: success() || failure() | |
with: | |
path: "./log/test.log" | |
# Run both Lint and Security since it's not reliant on build process | |
- name: Lint | |
run: |- | |
npm install -g eslint | |
./ci-bin/capture-log "make -f Makefile.example lint" | |
if: ${{ always() }} | |
- name: Security | |
run: ./ci-bin/capture-log "make -f Makefile.example security" | |
if: ${{ always() }} |