From 87dc763d924c4221f599fad4bcd35e9cadbc72a7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 17 Sep 2021 16:46:27 +0100 Subject: [PATCH] actions: test that generated code is consistent --- .github/workflows/main.yml | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2176401d3..db51b5070 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -183,6 +183,67 @@ jobs: - name: Run integration tests run: ./tests/travis.sh -t4 + codegen: + name: Generated Code consistency checks + needs: build-php + runs-on: ${{ matrix.image }} + strategy: + fail-fast: false + matrix: + image: [ubuntu-20.04] + php: [8.0.9] + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Restore PHP build cache + id: php-build-cache + uses: actions/cache@v2 + with: + path: "./bin" + key: "php-build-generic-${{ matrix.php }}-${{ matrix.image }}-${{ hashFiles('./tests/gh-actions/build.sh') }}" + + - name: Kill build on PHP build cache miss (should never happen) + if: steps.php-build-cache.outputs.cache-hit != 'true' + run: exit 1 + + - name: Install cached PHP's dependencies + if: steps.php-build-cache.outputs.cache-hit == 'true' + run: ./tests/gh-actions/install-dependencies.sh + + - name: Prefix PHP to PATH + run: echo "$(pwd)/bin/php7/bin" >> $GITHUB_PATH + + - name: Install Composer + run: curl -sS https://getcomposer.org/installer | php + + - name: Restore Composer package cache + uses: actions/cache@v2 + with: + path: | + ~/.cache/composer/files + ~/.cache/composer/vcs + key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}" + restore-keys: | + composer-v2-cache- + + - name: Install Composer dependencies + run: php composer.phar install --no-dev --prefer-dist --no-interaction + + - name: Regenerate registry annotations + run: php build/generate-registry-annotations.php src + + - name: Regenerate KnownTranslation APIs + run: php build/generate-known-translation-apis.php + + - name: Run git diff + run: git diff + + - name: Fail job if changes were made + run: git diff --quiet + codestyle: name: Code Style checks runs-on: ubuntu-20.04