├── gplint ├── Dockerfile ├── lint.php └── .buildkite └── pipeline.yml /gplint: -------------------------------------------------------------------------------- 1 | #! /bin/bash -eu 2 | 3 | xgettext -o /dev/null "$@" 4 | 5 | php /lint.php "$@" 6 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM php:7.4 3 | 4 | RUN curl https://wordpress.org/latest.tar.gz --output wordpress.tar.gz 5 | RUN tar -xf wordpress.tar.gz && rm wordpress.tar.gz 6 | COPY lint.php lint.php 7 | COPY gplint /bin/gplint 8 | RUN chmod +x /bin/gplint 9 | 10 | RUN apt-get update -y && apt-get install -y gettext -------------------------------------------------------------------------------- /lint.php: -------------------------------------------------------------------------------- 1 | import_from_file( $file ); 19 | 20 | if ( false === $result ) { 21 | echo 'Invalid localization file'; 22 | exit(2); 23 | } 24 | } 25 | 26 | echo 'Localization file is valid' . PHP_EOL; 27 | -------------------------------------------------------------------------------- /.buildkite/pipeline.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - label: ":docker: Publish to ECR" 3 | command: | 4 | 5 | echo "~~~ :key: Logging In" 6 | aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/automattic 7 | 8 | echo "~~~ :hammer: Building Image" 9 | docker build -t glotpress-validator . 10 | 11 | # If a tag is present use it 12 | if [ -n "$BUILDKITE_TAG" ]; then 13 | echo "~~~ :label: Tagging Image with version $BUILDKITE_TAG" 14 | docker tag glotpress-validator:latest public.ecr.aws/automattic/glotpress-validator:$BUILDKITE_TAG 15 | 16 | echo "~~~ :arrow_up: Pushing Image" 17 | docker push public.ecr.aws/automattic/glotpress-validator:$BUILDKITE_TAG 18 | exit 0 19 | fi 20 | 21 | if [ $BUILDKITE_BRANCH = "trunk" ]; then 22 | echo "~~~ :label: Tagging 'latest' version" 23 | docker tag glotpress-validator:latest public.ecr.aws/automattic/glotpress-validator:latest 24 | 25 | echo "~~~ :arrow_up: Pushing Image" 26 | docker push public.ecr.aws/automattic/glotpress-validator:latest 27 | exit 0 28 | fi 29 | 30 | if [ -n "$BUILDKITE_COMMIT" ]; then 31 | echo "~~~ :label: Tagging Image with commit $BUILDKITE_COMMIT" 32 | docker tag glotpress-validator:latest public.ecr.aws/automattic/glotpress-validator:$BUILDKITE_COMMIT 33 | 34 | echo "~~~ :arrow_up: Pushing Image" 35 | docker push public.ecr.aws/automattic/glotpress-validator:$BUILDKITE_COMMIT 36 | exit 0 37 | fi 38 | 39 | echo "Unable to publish image" 40 | exit 1 41 | --------------------------------------------------------------------------------