From c3544d768c5ccd72dd1659500ec8d8958e0a45f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Thu, 17 Aug 2023 15:08:03 +0200 Subject: [PATCH] ci: check for unstaged files When you do the following ``` $ asdf install $ npm --version 6.14.16 ``` and run: ``` npm install ``` then you get a changed `package-lock.json`. It is good practice to always check in lock files into version control. On CI we run `npm install` (among other things). If we make sure that we do not leave any updates files, this ensures we always commit our lock files. --- .github/workflows/ci.yml | 17 ++++++++++++++++- .tool-versions | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ea1b2190..1db8a1cbb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,10 +31,19 @@ jobs: - name: Update file watchers because of rails settings cached run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p + - name: Read .tool-versions + uses: marocchino/tool-versions-action@v1 + id: versions + + - name: Use Node.js ${{ steps.versions.outputs.nodejs}} + uses: actions/setup-node@v3 + with: + node-version: ${{ steps.versions.outputs.nodejs}} + - name: Install ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3.0.0 + ruby-version: ${{ steps.versions.outputs.ruby}} bundler-cache: true - name: Cache NPM dependencies @@ -64,3 +73,9 @@ jobs: - name: Run tests run: bin/rake spec + + - name: Check unstaged changes + run: | + git --no-pager diff --color + git update-index --refresh + git diff-index --quiet HEAD diff --git a/.tool-versions b/.tool-versions index 01c9127fd..66831fbc6 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ ruby 3.0.0 -nodejs lts-erbium +nodejs 12.22.12 postgres 12.2