Update README.md (#13) #18
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: Pre-commits | |
on: [push] | |
jobs: | |
checks: | |
name: Run pre-commit | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Environment | |
run: | | |
echo "NODE_VERSION=18.18.0" >> $GITHUB_ENV | |
echo "PYTHON_VERSION=$(cat .tool-versions | grep -Po '(?<=python ).*')" >> $GITHUB_ENV | |
echo "RUBY_VERSION=$(cat .tool-versions | grep -Po '(?<=ruby ).*')" >> $GITHUB_ENV | |
if [ $GITHUB_REF == 'refs/heads/master' ]; then echo "ENV=prod"; else echo "ENV=staging"; fi >> $GITHUB_ENV | |
echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*\/}" >> $GITHUB_ENV | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ env.RUBY_VERSION }} | |
- name: Install Ruby dependencies | |
run: bundle install | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Store python version details for cache | |
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> "$GITHUB_ENV" | |
- name: Pre-commit installation cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
restore-keys: | | |
pre-commit|${{ env.PY }}| | |
- name: Install pre-commit | |
run: | | |
python -m pip install pre-commit | |
pre-commit install --install-hooks | |
- name: Run pre-commit checks | |
run: | | |
pre-commit run --all-files | |
- name: Run license checks | |
run: | | |
pre-commit run license_checks --files doc/dependency_decisions.yml | |
- name: Run specs | |
run: | | |
rspec |