Skip to content

Commit

Permalink
fix: gitattributes (#118)
Browse files Browse the repository at this point in the history
* fix: make resource .gitattributes no-op

* fix: rename .gitattributes.dist when init

* infra: test Git archive

* infra: test Git archive

* infra: test Git archive

* infra: test Git archive

* infra: test Git archive

* infra: test Git archive
  • Loading branch information
dkarlovi authored Mar 17, 2023
1 parent 3f1366f commit 809a27e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ jobs:
-
name: Run code quality analysis
run: make analyze
TestArchive:
runs-on: ubuntu-latest
steps:
-
name: Repo checkout
uses: actions/checkout@v3
-
name: Compare resources/ folder against Git archive
run: |
FOLDER_FILES=$(find resources/ -type f | sort)
git archive --output=archive.zip HEAD && ZIP_FILES=$(zipinfo -1 archive.zip | grep resources/ | grep -v /$ | sort) && rm -f archive.zip
DIFF=$(diff <(echo "$FOLDER_FILES") <(echo "$ZIP_FILES") | tr -d '\n')
[ -n "$DIFF" ] && echo "There are files missing from the zip archive:" && echo "$DIFF" && exit 1 || echo OK
Test:
runs-on: ${{ matrix.operating-system }}
strategy:
Expand Down
2 changes: 2 additions & 0 deletions resources/Common/default.mk
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ endif
define dir_copy
if [ -d "${1}" ]; then cp -a ${1}/. .; fi

if [ -f .gitattributes.dist ]; then mv .gitattributes.dist .gitattributes; fi

endef

define str_reverse
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions tests/functional/MakefileTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public function testHelpIsTheDefaultCommand(): void
public function testMakefileHasInit(): void
{
$expected = array_map(static fn (string $path): string => sprintf('if [ -d "$ROOT/resources/%1$s" ]; then cp -a $ROOT/resources/%1$s/. .; fi', $path), $this->getExpectedInitPaths());
$expected = array_merge(...array_values(array_map(static fn ($value) => [$value, 'if [ -f .gitattributes.dist ]; then mv .gitattributes.dist .gitattributes; fi'], $expected)));
$actual = $this->dryRun($this->getMakefilePath(), 'init');

static::assertSame($expected, $actual);
Expand Down

0 comments on commit 809a27e

Please sign in to comment.