Make sure full_module_name is set #9
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: RSpec and Rubocop | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
name: RSpec and Rubocop | |
timeout-minutes: 3 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: setup ruby version and foobara branch and sha1 | |
run: | | |
foobara_entry=`grep -A2 -m 1 ' remote: foobara$' Gemfile.lock` | |
regex="revision: ([0-9a-f]+)\s+branch: ([-_[:alnum:]]+)$" | |
if [[ $foobara_entry =~ $regex ]]; then | |
foobara_sha1="${BASH_REMATCH[1]}" | |
foobara_branch="${BASH_REMATCH[2]}" | |
echo foobara_sha1=$foobara_sha1 >> "$GITHUB_ENV" | |
echo foobara_branch=$foobara_branch >> "$GITHUB_ENV" | |
else | |
echo "$foobara_entry doesn't match $regex" >&2 | |
fi | |
echo ruby_version=`cat .ruby-version` >> "$GITHUB_ENV" | |
- name: cache foobara | |
id: cache-foobara | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-foobara | |
with: | |
path: ~/work/domain-generator/foobara | |
key: ${{ env.cache-name }}-${{ env.foobara_branch }}-${{ env.foobara_sha1 }} | |
restore-keys: | | |
${{ env.cache-name }}-${{ env.foobara_branch }}- | |
${{ env.cache-name }}- | |
- if: ${{ steps.cache-foobara.outputs.cache-hit != 'true' }} | |
name: clone or pull foobara | |
run: | | |
set -e | |
cd .. | |
if [ -d foobara ]; then | |
echo pulling | |
cd foobara | |
ssh-agent sh -c 'echo "${{ secrets.FOOBARA_KEY }}" | ssh-add - && | |
git fetch --depth=1 origin $foobara_sha1 && | |
if git rev-parse --verify -q $foobara_branch; then | |
git checkout -q $foobara_branch | |
git reset --hard $foobara_sha1 | |
else | |
git branch $foobara_branch $foobara_sha1 | |
git checkout -q $foobara_branch | |
fi' | |
else | |
echo cloning | |
ssh-agent sh -c 'echo "${{ secrets.FOOBARA_KEY }}" | ssh-add - && | |
git clone -b $foobara_branch --depth=1 git@github.com:foobara/foobara.git' | |
fi | |
- name: symlink foobara and point bundler at it | |
run: | | |
set -e | |
mkdir -p .bundle | |
echo -e "---\nBUNDLE_LOCAL__FOOBARA: '/home/runner/work/domain-generator/foobara'" > .bundle/config | |
mkdir ../../foobara | |
ln -s ../../domain-generator/foobara ../../foobara/foobara | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ env.ruby_version }} | |
bundler-cache: true | |
- name: Run rspec | |
run: bundle exec rspec | |
- name: Run rubocop | |
run: bundle exec rubocop | |
# - name: Upload coverage directory | |
# if: always() | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: coverage-report | |
# path: coverage/ |