Skip to content

Commit

Permalink
Add macOS support to generate a version report
Browse files Browse the repository at this point in the history
  • Loading branch information
sbkok committed Jan 13, 2024
1 parent bccc75b commit 680b0f8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
32 changes: 20 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,33 @@ update_makefile: report_makefile_version
report_makefile_version:
@echo "Makefile: v$(MAKEFILE_VERSION) $$(shasum --algorithm 256 Makefile)"

report_versions: report_makefile_version
report_versions: .venv report_makefile_version
@echo "$(CLR_YELLOW)*** Beginning of ADF Version Report ***$(CLR_END)"
@echo "ADF Source version: $(SRC_VERSION)"
@echo "ADF $$(cat src/template.yml | grep SemanticVersion | xargs)"
@echo ""
@echo "Hardware platform: $$(uname --hardware-platform || echo 'n/a')"
@echo "Kernel name: $$(uname --kernel-name || echo 'n/a')"
@echo "Kernel release: $$(uname --kernel-release || echo 'n/a')"
@( \
uname --hardware-platform &> /dev/null && ( \
echo "Hardware platform: $$(uname --hardware-platform 2> /dev/null || echo 'n/a')" && \
echo "Kernel name: $$(uname --kernel-name 2> /dev/null || echo 'n/a')" && \
echo "Kernel release: $$(uname --kernel-release 2> /dev/null || echo 'n/a')" \
) || ( \
echo "Hardware platform: $$(uname -m 2> /dev/null || echo 'n/a')" && \
echo "Kernel name: $$(uname -s 2> /dev/null || echo 'n/a')" && \
echo "Kernel release: $$(uname -r 2> /dev/null || echo 'n/a')" \
) || exit 0; \
)
@echo ""
@test -e /etc/os-release && echo "OS Release:" && cat /etc/os-release
@test -e /etc/os-release && echo "OS Release:" && cat /etc/os-release || exit 0
@echo ""
@echo "Disk:"
@df -h $$PWD || echo 'N/A'
@df -h $$PWD 2> /dev/null || echo 'N/A'
@echo ""
@echo "Dependencies:"
@echo "docker: $$(docker --version || echo 'n/a')"
@echo "git: $$(git --version || echo 'n/a')"
@echo "make: $$(make --version || echo 'n/a')"
@echo "docker: $$(docker --version 2> /dev/null || echo '$(CLR_RED)Not installed!$(CLR_END)')"
@echo "git: $$(git --version 2> /dev/null || echo '$(CLR_RED)Not installed!$(CLR_END)')"
@echo "sed: $$(sed --version 2> /dev/null || echo 'test' | sed 's/test/works/g' || echo '$(CLR_RED)Not installed!$(CLR_END)')"
@echo "make: $$(make --version 2> /dev/null || echo '$(CLR_RED)Not installed!$(CLR_END)')"
@( \
. .venv/bin/activate; \
pip --version; \
Expand Down Expand Up @@ -139,12 +148,11 @@ docker:

version_number: .venv
@echo "Generate a new version number..."
cp $(SRC_DIR)/template.yml $(SAM_VERSIONED_TEMPLATE)
( \
. .venv/bin/activate; \
BASE_ADF_VERSION=$$(cat $(SAM_VERSIONED_TEMPLATE) | yq '.Metadata."AWS::ServerlessRepo::Application".SemanticVersion' -r); \
BASE_ADF_VERSION=$$(cat $(SRC_DIR)/template.yml | yq '.Metadata."AWS::ServerlessRepo::Application".SemanticVersion' -r); \
COMMIT_ADF_VERSION=$(SRC_VERSION); \
sed "s/Version: $$BASE_ADF_VERSION/Version: $$COMMIT_ADF_VERSION/g" -i $(SAM_VERSIONED_TEMPLATE); \
sed "s/Version: $$BASE_ADF_VERSION/Version: $$COMMIT_ADF_VERSION/g" $(SRC_DIR)/template.yml > $(SAM_VERSIONED_TEMPLATE); \
)

git_ignore:
Expand Down
6 changes: 6 additions & 0 deletions docs/installation-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ Please note that building on *Windows* is not supported, please use the
- [python 3](https://www.python.org/downloads/)
- To test if it is available, run `python --version`.
This should return 3.11 or later.
- [sed](https://www.gnu.org/software/sed/)
- To test if it is available, run `sed --version`.
This should return 4.3 or later.
- If you have BSD sed installed, as is by default on macOS.
You can test if it works with:
`echo 'does sed work' | sed 's/does.*work/sed works/g'`

Install or update the above requirements as needed.
Alternatively, jump to the [Cloud9 instructions](#22-cloud9-instructions) instead
Expand Down

0 comments on commit 680b0f8

Please sign in to comment.