Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Artifact creation makefile commands. #1596

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# ignore project specific files
deploy/resources.php

# ignore composer installed files
vendor/
vendor/*
Expand All @@ -21,6 +22,10 @@ deploy/model/orm/*
deploy/www/index.html
deploy/www/intro.html

# build artifacts
deploy/artifacts/
nw-artifact/

#ignore developer specific GNU make configuration for this project
CONFIG

Expand Down
32 changes: 31 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ link-deps:
@ln -sf "$(RELATIVE_VENDOR)twbs/bootstrap/dist/js/bootstrap.min.js" "$(JS)"


dep:
dep: js-deps
@echo "NW step: dep: composer validate then composer install"
@$(COMPOSER) validate
@$(COMPOSER) install
Expand Down Expand Up @@ -164,6 +164,36 @@ test-one:
test-one-no-watch:
php ./vendor/bin/phpunit $(TESTFILE)


create-artifact:
echo "Creating an artifact for future deployment"
echo "Make sure to make dep to build deployable composer and node assets before this"
echo "Currently node_modules is not directly included in the artifact, as we just use it for tests for now"
mkdir -p ./deploy/artifacts
tar -czv -X artifacts-exclude-list.txt -f ./deploy/artifacts/ninjawars-`date +\%F-hour-\%H-min-\%M-sec-\%S-milisec-\%3N`.tar.gz ./composer.json ./composer.lock ./.nvmrc ./.phpver ./.yarnrc.yml ./package.json ./yarn.lock ./Makefile ./deploy/
echo "Artifact created, see ./deploy/artifacts/ for the latest,"
echo "Note the high importance of overwriting the resources.php config file in the final"

clean-artifacts:
rm -rf ./deploy/artifacts/*
rm -rf ./nw-artifact

send-artifacts:
aws s3 sync --include '*.tar.gz' ./deploy/artifacts/ s3://ninjawars-deployment-artifacts/

expand-local-artifact:
echo "unzipping the latest tar to the local nw-artifact directory"
mkdir -p ./nw-artifact
tar -xzvf ./deploy/artifacts/*.tar.gz -C ./nw-artifact
mkdir -p ./nw-artifact/deploy/templates/compiled ./nw-artifact/deploy/templates/cache /tmp/game_logs/ ./nw-artifact/deploy/resources/logs/
chmod -R ugo+rw ./nw-artifact/deploy/templates/compiled ./nw-artifact/deploy/templates/cache
chmod -R ugo+rw /tmp/game_logs/ || true
ls ./nw-artifact

browse-artifact:
xdg-open https://nw-artifact.local


watch:
./vendor/bin/phpunit-watcher watch

Expand Down
5 changes: 5 additions & 0 deletions artifacts-exclude-list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
./deploy/artifacts
./deploy/templates/compiled
./deploy/templates/cache
./deploy/resources/logs/
./deploy/www/bad-router.php