Skip to content

Commit

Permalink
use composer for psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris-de committed Oct 3, 2023
1 parent b1f64f4 commit a3506a6
Show file tree
Hide file tree
Showing 5 changed files with 2,111 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ jobs:

- name: Psalm
uses: docker://vimeo/psalm-github-actions
with:
composer_require_dev: true
composer_ignore_platform_reqs: true

- name: Psalm Security Analysis
uses: docker://vimeo/psalm-github-actions
with:
security_analysis: true
report_file: results.sarif
composer_require_dev: true
composer_ignore_platform_reqs: true

- name: Upload Security Analysis results to GitHub
uses: github/codeql-action/upload-sarif@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ albums
test-album
*-private
test/tmp
vendor
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ DOCKER ?= docker
TEST_ALBUM_DIR = test-album

PSALM_MARKER = $(BUILD_DIR)/.psalm
COMPOSER_PSALM_MARKER = $(BUILD_DIR)/.composer-psalm
COVERAGE_MARKER = $(BUILD_DIR)/coverage/.marker
MIG_SITE_MARKER = $(BUILD_DIR)/.site
BUILD_DIR_MARKER = $(BUILD_DIR)/.marker
Expand Down Expand Up @@ -178,10 +179,14 @@ container-webserver: $(INDEX_PHP) $(TEST_ALBUM_DIR)
$(DOCKER) stop $(CONTAINER_NAME)
$(DOCKER) rm $(CONTAINER_NAME)

$(COMPOSER_PSALM_MARKER):
composer install
@touch $(COMPOSER_PSALM_MARKER)

psalm: $(PSALM_MARKER)
$(PSALM_MARKER): $(INDEX_PHP) $(BUILD_DIR_MARKER)
psalm $<
psalm --taint-analysis $<
$(PSALM_MARKER): $(INDEX_PHP) $(BUILD_DIR_MARKER) $(COMPOSER_PSALM_MARKER)
./vendor/vimeo/psalm/psalm $<
./vendor/vimeo/psalm/psalm --taint-analysis $<
@touch $(PSALM_MARKER)

albums: $(TEST_ALBUM_MARKER)
Expand All @@ -193,13 +198,14 @@ dev-server: albums

clean-marker:
rm -f $(PSALM_MARKER) $(COVERAGE_MARKER) $(MIG_SITE_MARKER) $(BUILD_DIR_MARKER) $(UNITTESTS_MARKER) \
$(TEST_ALBUM_MARKER) $(CONTAINER_UNITTESTS_MARKER) $(CONTAINER_UNITTESTS_ALL_MARKER) $(PHPUNIT_DIR_MARKER)
$(TEST_ALBUM_MARKER) $(CONTAINER_UNITTESTS_MARKER) $(CONTAINER_UNITTESTS_ALL_MARKER) $(PHPUNIT_DIR_MARKER) \
$(COMPOSER_PSALM_MARKER)

clean: clean-marker
make -C docs clean
$(DOCKER) image rm $(CONTAINER_NAME) $(CONTAINER_NAME_PHPUNIT) 1>/dev/null 2>&1 || true
rm -f $(INDEX_PHP) albums $(PHPUNIT_FILES)
rm -rf test-album $(PHPUNIT_DIR) $(BUILD_DIR) $(CONTAINER_UNITTEST_TMP)
rm -rf test-album $(PHPUNIT_DIR) $(BUILD_DIR) $(CONTAINER_UNITTEST_TMP) vendor

$(BUILD_DIR_MARKER):
mkdir -p $(BUILD_DIR)
Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require-dev": {
"vimeo/psalm": "^5.15"
}
}
Loading

0 comments on commit a3506a6

Please sign in to comment.