diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 864818f..cf6a664 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,6 +29,11 @@ jobs: with: rubocop: true + language-versions: + uses: ./.github/workflows/linters.yml + with: + language-versions: true + specs: uses: ./.github/workflows/testing.yml strategy: diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index bae6257..ce15798 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -13,6 +13,9 @@ on: rubocop: type: boolean default: false + language-versions: + type: boolean + default: false jobs: linters: @@ -45,3 +48,26 @@ jobs: run: | ${{ inputs.run-before-linters }} bundle exec rubocop + + - name: Ensure language versions match + if: ${{ inputs.language-versions == true }} + run: | + NODE_VERSION=$(cat .node-version) + if ! grep -q "^ARG NODE_MAJOR=$NODE_VERSION" Dockerfile; then + echo "Dockerfile has wrong node: $(grep '^ARG NODE_MAJOR' Dockerfile)" >&2 + exit 1 + fi + if ! grep -q "^ARG NODE_MAJOR=$NODE_VERSION" Dockerfile.production; then + echo "Dockerfile.production has wrong node: $(grep '^ARG NODE_MAJOR' Dockerfile.production)" >&2 + exit 1 + fi + + RUBY_VERSION=$(cat .ruby-version) + if ! grep -q "^FROM ruby:$RUBY_VERSION" Dockerfile; then + echo "Dockerfile has wrong ruby: $(grep '^FROM ruby:' Dockerfile)" >&2 + exit 1 + fi + if ! grep -q "^ARG RUBY_VERSION=$RUBY_VERSION" Dockerfile.production; then + echo "Dockerfile.production has wrong ruby: $(grep '^ARG RUBY_VERSION' Dockerfile.production)" >&2 + exit 1 + fi