From f53a40c6530af563f663ceb0a9f9752ee5fe6d76 Mon Sep 17 00:00:00 2001 From: Jamil Date: Tue, 10 Oct 2023 09:13:09 -0700 Subject: [PATCH] Version sanity check (#2294) --- .github/workflows/static-analysis.yml | 24 +++++++++++++++++++++++- Makefile | 14 ++++++++++---- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 5d3106234..4b32b9ff9 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -3,7 +3,29 @@ on: workflow_call: jobs: - static-analysis_linter: + version-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Update toolchain + run: rustup show + - uses: Swatinem/rust-cache@v2 + with: + workspaces: ./rust + save-if: ${{ github.ref == 'refs/heads/main' }} + - name: Check version is up to date + run: | + make version + if [ -z "$(git status --porcelain)" ]; then + # Working directory clean + echo "Version manifests up to date" + else + # Uncommitted changes + echo '`make version` found outdated files! Showing diff' + git diff + exit 1 + fi + global-linter: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/Makefile b/Makefile index b87f5da2f..5ef85c319 100644 --- a/Makefile +++ b/Makefile @@ -7,11 +7,17 @@ version = 1.20231001.0 .PHONY: version +ifeq ($(shell uname),Darwin) +SEDARG := -i '' +else +SEDARG := -i +endif + version: # Elixir can set its Application version from a file, but other components aren't so flexible. @echo $(version) > elixir/VERSION - @find rust/ -name "Cargo.toml" -exec sed -i '' -e '/mark:automatic-version/{n;s/[0-9]*\.[0-9]*\.[0-9]*/$(version)/;}' {} \; - @find .github/ -name "*.yml" -exec sed -i '' -e '/mark:automatic-version/{n;s/[0-9]*\.[0-9]*\.[0-9]*/$(version)/;}' {} \; - @find swift/ -name "project.pbxproj" -exec sed -i '' -e 's/MARKETING_VERSION = .*;/MARKETING_VERSION = $(version);/' {} \; - @find kotlin/ -name "build.gradle.kts" -exec sed -i '' -e '/mark:automatic-version/{n;s/versionName =.*/versionName = "$(version)"/;}' {} \; + @find rust/ -name "Cargo.toml" -exec sed $(SEDARG) -e '/mark:automatic-version/{n;s/[0-9]*\.[0-9]*\.[0-9]*/$(version)/;}' {} \; + @find .github/ -name "*.yml" -exec sed $(SEDARG) -e '/mark:automatic-version/{n;s/[0-9]*\.[0-9]*\.[0-9]*/$(version)/;}' {} \; + @find swift/ -name "project.pbxproj" -exec sed $(SEDARG) -e 's/MARKETING_VERSION = .*;/MARKETING_VERSION = $(version);/' {} \; + @find kotlin/ -name "build.gradle.kts" -exec sed $(SEDARG) -e '/mark:automatic-version/{n;s/versionName =.*/versionName = "$(version)"/;}' {} \; @cd rust && cargo check