├── .circleci ├── config-sample.yml └── config.yml ├── .deployignore ├── .github ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── ci-sample.yml │ └── ci.yml ├── .travis.yml ├── README.md ├── deploy-travis-prepare.sh ├── deploy.sh ├── fixtures └── skip-this-file.txt ├── known_hosts └── tests ├── verify-circle.sh └── verify-gha.sh /.circleci/config-sample.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | docker: 5 | # Pick a base image which matches the version of Node you need for 6 | # building from https://hub.docker.com/r/cimg/node/tags 7 | # 8 | # Note: If using a different container, make sure it contains at least 9 | # git 2.6.0. 10 | - image: cimg/node:12.16 11 | 12 | branches: 13 | # Don't build from a branch with the `-built` suffix, to 14 | # prevent endless loops of deploy scripts. 15 | # REQUIRED: If you're amended an existing config, the below are two 16 | # of the required lines you must add 17 | ignore: 18 | - /^.*-built$/ 19 | 20 | steps: 21 | - checkout 22 | 23 | # @TODO: Configure build steps 24 | # - run: npm install 25 | # - run: npm run build 26 | # 27 | # These can also be specified with a name: 28 | # - run: 29 | # name: Build the thing 30 | # command: npm run build-thing 31 | 32 | # @TODO: modify or remove this example 33 | - run: echo "Building..." 34 | - run: 35 | name: Create build directory 36 | command: mkdir -p build 37 | 38 | - run: 39 | name: Create build readme 40 | command: echo "This was built in CI on $(date)" > build/README.md 41 | 42 | # multiple commands can be combined by starting with the | 43 | # do not indent with tabs! 44 | - run: 45 | name: Add some helpful info to the README 46 | command: | 47 | echo -e "\n\n## Continuous Integration & Continuous Deployment on VIP Go" >> build/README.md 48 | echo -e "\nSee our docs in the [VIP Lobby](https://vip.wordpress.com/documentation/automated-build-and-deploy-on-vip-go/)" >> build/README.md 49 | echo -e "\n\nThis branch e.g. master-built is created automatically when " >> build/README.md 50 | echo "a commit or merge is made to the base branch e.g. master, using [your CircleCI configuration](../.circleci/config.yml), which you can **customize**" >> build/README.md 51 | 52 | # Test to ensure the build was good, do not deploy bad stuff! 53 | - run: 54 | name: Test the build 55 | command: | 56 | if [ -f build/README.md ]; then 57 | echo "Build succeeded"; 58 | else 59 | echo "Build failed, file missing"; exit 1 60 | fi 61 | 62 | # Uncomment this and supply your ssh fingerprint to enable CircleCI to push the built branch to GitHub 63 | #- add_ssh_keys: 64 | # fingerprints: 65 | # - "ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff" 66 | 67 | # Run the deploy: 68 | # REQUIRED: If you're amended an existing config, the below are two 69 | # of the required lines you must add 70 | # This will push the result to the {currentbranch}-built branch 71 | - deploy: 72 | name: Deploy -built branch to github 73 | command: bash <(curl -s "https://raw.githubusercontent.com/Automattic/vip-go-build/master/deploy.sh") 74 | 75 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | docker: 5 | # Pick a base image which matches the version of Node you need for 6 | # building from https://hub.docker.com/r/cimg/node/tags 7 | # 8 | # Note: If using a different container, make sure it contains at least 9 | # git 2.6.0. 10 | - image: cimg/node:12.6 11 | 12 | branches: 13 | # Don't build from a branch with the `-built` suffix, to 14 | # prevent endless loops of deploy scripts. 15 | ignore: 16 | - /^.*-built$/ 17 | 18 | steps: 19 | - add_ssh_keys: 20 | fingerprints: 21 | - "40:8f:0c:e5:83:d5:62:a3:44:1a:e8:0a:1d:fa:44:93" 22 | 23 | - checkout 24 | 25 | - run: echo "Building..." 26 | - run: 27 | name: Create build directory 28 | command: mkdir -p build 29 | 30 | - run: 31 | name: Create build readme 32 | command: echo "This was built in CI on $(date)" > build/README.md 33 | 34 | # multiple commands can be combined by starting with the | 35 | # do not indent with tabs! 36 | - run: 37 | name: Add some helpful info to the README 38 | command: | 39 | echo -e "\n\n## Continuous Integration & Continuous Deployment on VIP Go" >> build/README.md 40 | echo -e "\nSee our docs in the [VIP Lobby](https://vip.wordpress.com/documentation/automated-build-and-deploy-on-vip-go/)" >> build/README.md 41 | echo -e "\n\nThis branch e.g. master-built is created automatically when " >> build/README.md 42 | echo "a commit or merge is made to the base branch e.g. master, using [your CircleCI configuration](../.circleci/config.yml), which you can **customize**" >> build/README.md 43 | 44 | # Test to ensure the build was good, do not deploy bad stuff! 45 | - run: 46 | name: Test the build 47 | command: | 48 | if [ -f build/README.md ]; then 49 | echo "Build succeeded"; 50 | else 51 | echo "Build failed, file missing"; exit 1 52 | fi 53 | 54 | # Run the deploy: 55 | # This will push the result to the {currentbranch}-built branch 56 | # Note: if running multiple times, you may need to `git push --delete origin {currentbranch}` between runs to clear out the branch. 57 | - deploy: 58 | name: Deploy -built branch to github 59 | command: ./deploy.sh 60 | 61 | - run: 62 | name: Verify that -built branch was deployed correctly 63 | command: ./tests/verify-circle.sh 64 | 65 | -------------------------------------------------------------------------------- /.deployignore: -------------------------------------------------------------------------------- 1 | fixtures/skip-this-file.txt 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## For Automatticians! 2 | 3 | :wave: Just a quick reminder that this is a public repo. Please don't include any internal links or sensitive data (like PII, private code, client names, site URLs, etc. If you're not sure if something is safe to share, please just ask! 4 | 5 | If you're not an Automattician, welcome! We look forward to your contribution! :heart: 6 | 7 | Please remove this section before submitting the issue. 8 | 9 | --- 10 | 11 | ## Expected/Desired Behavior 12 | 13 | Fill with either one: 14 | 15 | 1. Expected behavior for bugs 16 | 1. Desired behavior for improvements/enhancements 17 | 18 | ## Actual Behavior 19 | 20 | How does the package/util currently work. 21 | 22 | ## Steps to Reproduce the Problem 23 | 24 | 1. Step 1 25 | 1. Step 2 26 | 1. Step 3 27 | 28 | ## (Optional) Additional notes 29 | 30 | Any other relevant information to help with debugging/implemention. 31 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## For Automatticians! 2 | 3 | :wave: Just a quick reminder that this is a public repo. Please don't include any internal links or sensitive data (like PII, private code, client names, site URLs, etc. If you're not sure if something is safe to share, please just ask! 4 | 5 | If you're not an Automattician, welcome! We look forward to your contribution! :heart: 6 | 7 | Please remove this section before submitting the PR. 8 | 9 | --- 10 | 11 | ## Description 12 | 13 | A few sentences describing the overall goals of the Pull Request. 14 | 15 | Should include any special considerations, decisions, and links to relevant GitHub issues. 16 | 17 | Please don't include internal or private links :) 18 | 19 | ## Steps to Test 20 | 21 | Outline the steps to test and verify the PR here. 22 | 23 | Example: 24 | 25 | 1. Check out PR. 26 | 1. Run `deploy.sh` 27 | 1. Verify deployed cookies are delicious. 28 | 29 | -------------------------------------------------------------------------------- /.github/workflows/ci-sample.yml: -------------------------------------------------------------------------------- 1 | name: CI (VIP Build and Deploy) 2 | 3 | on: 4 | push: 5 | # REQUIRED: Prevent endless loops of deploy scripts by not building from a branch name 6 | # that includes a `-built` suffix. 7 | branches-ignore: 8 | - "**-built" 9 | - "**-built-**" 10 | workflow_dispatch: 11 | 12 | permissions: 13 | contents: read 14 | 15 | jobs: 16 | ci: 17 | name: CI 18 | runs-on: ubuntu-latest 19 | permissions: 20 | contents: write 21 | env: 22 | # The suffix to append to the current branch name when deploying the built branch. 23 | # If migrating from another CI provider to GitHub Actions, a different suffix, like -gha-built, 24 | # can be used to avoid conflicts during the CI migration. 25 | # 26 | # NOTE: For the changes to be deployed, the WordPress VIP application must be configured 27 | # to deploy from the built branch. 28 | # https://docs.wpvip.com/code-deployment/default-deployment/deploying-branches/update/ 29 | VIP_DEPLOY_SUFFIX: "-built" 30 | steps: 31 | - name: Check out source code 32 | uses: actions/checkout@v4 33 | 34 | # @TODO: Configure build steps for the project, as needed. 35 | # - name: Install NPM dependencies and run the npm build command at the root of the repository 36 | # run: npm ci && npm run build 37 | # 38 | # - name: Install PHP dependencies at the root of the repository 39 | # run: composer install --no-dev --no-interaction 40 | 41 | # The following four steps are not required for all projects, but demonstrate how to create 42 | # and update a README.md file with build information in a "build" directory, which will be 43 | # included in the built branch. 44 | 45 | # 1. Create a build directory where a build artifact can be placed. 46 | - name: Create build directory 47 | run: mkdir -p build 48 | 49 | # 2. Create a README.md file in the build directory. 50 | - name: Create build readme 51 | run: | 52 | echo -e "# Continuous Integration & Continuous Deployment on VIP\n\nThis was built in CI on $(date)" > build/README.md 53 | 54 | # 3. Add some helpful info to the ./build/README.md file. 55 | - name: Add some helpful info to the ./build/README.md 56 | run: | 57 | echo -e "\nThis \`${GITHUB_REF_NAME}${VIP_DEPLOY_SUFFIX}\` branch was created automatically" \ 58 | "when a commit or merge was made to the base branch, \`${GITHUB_REF_NAME}\`, using" \ 59 | "[a GitHub Actions workflow](../.github/workflows/), which can be **customized**." >> build/README.md 60 | 61 | echo -e "\nSee the WordPress VIP documentation about [Build and Deploy](https://docs.wpvip.com/code-deployment/default-deployment/build-and-deploy/)." >> build/README.md 62 | 63 | # 4. Test the build steps above by verifying that the ./build/README.md file was created. 64 | - name: Test the build 65 | run: | 66 | if [ -f build/README.md ]; then 67 | echo "Build succeeded"; 68 | else 69 | echo "Build failed, file missing"; exit 1 70 | fi 71 | 72 | # REQUIRED: Fetch and run the VIP deploy script to push the build artifacts to the built branch. 73 | # If amending an existing config, the step below is one of the required steps to include. 74 | # This will push the result to the {current_branch}-built branch, 75 | # or {current_branch}{VIP_DEPLOY_SUFFIX} if a suffix is configured above. 76 | # 77 | # NOTE: For the changes to be deployed, the WordPress VIP application must be configured 78 | # to deploy from the built branch. 79 | # https://docs.wpvip.com/code-deployment/default-deployment/deploying-branches/update/ 80 | # 81 | # The {{ secrets.GITHUB_TOKEN }} variable is an automatically generated token used to push 82 | # the new built branch to this GitHub repository. 83 | # https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication 84 | - name: Deploy built branch to GitHub 85 | run: | 86 | export GITHUB_AUTH_TOKEN=$(echo -n "x-access-token:${{ secrets.GITHUB_TOKEN }}" | base64 -w 0) 87 | bash <(curl -s "https://raw.githubusercontent.com/Automattic/vip-go-build/master/deploy.sh") 88 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches-ignore: 6 | - "**-built" 7 | - "**-built-**" 8 | workflow_dispatch: 9 | 10 | permissions: 11 | contents: read 12 | 13 | jobs: 14 | ci: 15 | name: CI 16 | runs-on: ubuntu-latest 17 | permissions: 18 | contents: write 19 | env: 20 | VIP_DEPLOY_SUFFIX: "-gha-built" 21 | steps: 22 | - name: Check out source code 23 | uses: actions/checkout@v4 24 | 25 | - name: Create build directory 26 | run: mkdir -p build 27 | 28 | - name: Create build readme 29 | run: echo "This was built in CI on $(date)" > build/README.md 30 | 31 | - name: Add some helpful info to the README 32 | run: | 33 | echo -e "\n\n## Continuous Integration & Continuous Deployment on VIP Go" >> build/README.md 34 | echo -e "\nSee our docs in the [VIP Lobby](https://vip.wordpress.com/documentation/automated-build-and-deploy-on-vip-go/)" >> build/README.md 35 | echo -e "\n\nThis branch e.g. master-built is created automatically when " >> build/README.md 36 | echo "a commit or merge is made to the base branch e.g. master, using [your GitHub workflow](../.github/workflows/ci.yml), which you can **customize**" >> build/README.md 37 | 38 | - name: Test the build 39 | run: | 40 | if [ -f build/README.md ]; then 41 | echo "Build succeeded"; 42 | else 43 | echo "Build failed, file missing"; exit 1 44 | fi 45 | 46 | - name: Deploy -built branch to github 47 | run: | 48 | export GITHUB_AUTH_TOKEN=$(echo -n "x-access-token:${GITHUB_TOKEN}" | base64 -w 0) 49 | export GITHUB_TOKEN="" 50 | ./deploy.sh 51 | env: 52 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 53 | 54 | - name: Verify that -built branch was deployed correctly 55 | run: ./tests/verify-gha.sh 56 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | sudo: false 4 | 5 | # This "ignore" directive travis from processing branches with 6 | # a -built suffix, thus avoiding endless loops 7 | # REQUIRED: If you're amended an existing config, the following 8 | # two lines are required. 9 | if: branch =~ ^.*(? ~/.ssh/id_rsa 20 | chmod 600 ~/.ssh/id_rsa 21 | 22 | # Restore script echoing now we've done the private things 23 | set -x 24 | 25 | curl -s "https://raw.githubusercontent.com/Automattic/vip-go-build/master/known_hosts" >> ~/.ssh/known_hosts 26 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # 3 | # Deploy your branch on VIP Go. 4 | # 5 | 6 | # This script uses various CircleCI, Travis CI or GitHub Actions environment 7 | # variables. CircleCI prefix their environment variables with 8 | # `CIRCLE_`, Travis with `TRAVIS_`, and GitHub Actions with `GITHUB_`. 9 | # Documentation: 10 | # https://circleci.com/docs/2.0/env-vars/#circleci-built-in-environment-variables 11 | # https://docs.travis-ci.com/user/environment-variables/ 12 | # https://docs.github.com/en/actions/learn-github-actions/environment-variables 13 | 14 | set -ex 15 | 16 | # The deploy suffix flexibility is mainly here to allow 17 | # us to test Circle and Travis builds simultaneously on 18 | # the https://github.com/Automattic/vip-go-skeleton/ repo. 19 | DEPLOY_SUFFIX="${VIP_DEPLOY_SUFFIX:--built}" 20 | 21 | if [ -n "$CIRCLECI" ]; then 22 | BRANCH="$CIRCLE_BRANCH" 23 | REPO_SLUG="${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" 24 | COMMIT_SHA="$CIRCLE_SHA1" 25 | # SRC_DIR="$CIRCLE_WORKING_DIRECTORY" 26 | SRC_DIR="$PWD" 27 | BUILD_URL="$CIRCLE_BUILD_URL" 28 | elif [ -n "$TRAVIS" ]; then 29 | BRANCH="$TRAVIS_BRANCH" 30 | REPO_SLUG="$TRAVIS_REPO_SLUG" 31 | COMMIT_SHA="$TRAVIS_COMMIT" 32 | SRC_DIR="$TRAVIS_BUILD_DIR" 33 | BUILD_URL="$TRAVIS_BUILD_WEB_URL" 34 | elif [ -n "$GITHUB_ACTIONS" ]; then 35 | BRANCH="$GITHUB_REF_NAME" 36 | REPO_SLUG="$GITHUB_REPOSITORY" 37 | COMMIT_SHA="$GITHUB_SHA" 38 | SRC_DIR="$GITHUB_WORKSPACE" 39 | BUILD_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" 40 | REPO_SSH_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" 41 | else 42 | echo "Unknown CI environment, exiting." 43 | exit 1 44 | fi 45 | 46 | BUILD_DIR="/tmp/vip-go-build-$(date +%s)" 47 | REPO_SSH_URL="${REPO_SSH_URL:-"git@github.com:${REPO_SLUG}"}" 48 | DEPLOY_BRANCH="${BRANCH}${DEPLOY_SUFFIX}" 49 | cd "$SRC_DIR" 50 | COMMIT_AUTHOR_NAME="$( git log --format=%an -n 1 "${COMMIT_SHA}" )" 51 | COMMIT_AUTHOR_EMAIL="$( git log --format=%ae -n 1 "${COMMIT_SHA}" )" 52 | COMMIT_COMMITTER_NAME="$( git log --format=%cn -n 1 "${COMMIT_SHA}" )" 53 | COMMIT_COMMITTER_EMAIL="$( git log --format=%ce -n 1 "${COMMIT_SHA}" )" 54 | 55 | 56 | # Run some checks 57 | # --------------- 58 | 59 | if [ -n "$TRAVIS" ] && [ -n "$CIRCLECI" ] && [ -n "$GITHUB_ACTIONS" ]; then 60 | echo "ERROR: this script requires either CircleCI, Travis CI, or GitHub Actions" 61 | echo "You will need to amend the setup above to set the required variables from the information specific to your CI service or tool." 62 | exit 1 63 | fi 64 | 65 | if [ -z "${BRANCH}" ]; then 66 | echo "ERROR: No branch specified!" 67 | echo "This variable should be set by Travis CI, CircleCI, and GitHub Actions; if you consistently experience errors please check with WordPress.com VIP support." 68 | exit 1 69 | fi 70 | 71 | if [ -d "$BUILD_DIR" ]; then 72 | echo "ERROR: ${BUILD_DIR} already exists." 73 | echo "This should not happen, if you consistently experience errors please check with WordPress.com VIP support." 74 | exit 1 75 | fi 76 | 77 | if [[ "${BRANCH}" == *${DEPLOY_SUFFIX} ]]; then 78 | echo "NOTICE: Attempting to build from branch '${BRANCH}' to deploy '${DEPLOY_BRANCH}', seems like recursion so aborting." 79 | echo "This is a protective measure, no action is required." 80 | exit 0 81 | fi 82 | 83 | if [[ -n $TRAVIS ]] && [ "$TRAVIS_PULL_REQUEST" != 'false' ]; then 84 | echo "NOTICE: Aborting a build to '${DEPLOY_BRANCH}' from a pull request on '${BRANCH}', only build from merges directly to the branch" 85 | echo "This is a protective measure, no action is required." 86 | exit 0 87 | fi 88 | 89 | # Everything seems OK, getting the built repo sorted 90 | # -------------------------------------------------- 91 | 92 | echo "Deploying ${BRANCH} to ${DEPLOY_BRANCH}" 93 | 94 | # Making the directory we're going to sync the build into 95 | git init "${BUILD_DIR}" 96 | cd "${BUILD_DIR}" 97 | 98 | if [ -n "${GITHUB_AUTH_TOKEN}" ]; then 99 | git config --local http.https://github.com/.extraheader "Authorization: basic ${GITHUB_AUTH_TOKEN}" 100 | fi 101 | 102 | git remote add origin "${REPO_SSH_URL}" 103 | if [[ 0 = $(git ls-remote --heads "${REPO_SSH_URL}" "${DEPLOY_BRANCH}" | wc -l) ]]; then 104 | echo -e "\nCreating a ${DEPLOY_BRANCH} branch..." 105 | git checkout --quiet --orphan "${DEPLOY_BRANCH}" 106 | else 107 | echo "Using existing ${DEPLOY_BRANCH} branch" 108 | git fetch origin "${DEPLOY_BRANCH}" --depth=1 109 | git checkout --quiet "${DEPLOY_BRANCH}" 110 | fi 111 | 112 | # Expand all submodules 113 | git submodule update --init --recursive; 114 | 115 | # Copy the files over 116 | # ------------------- 117 | 118 | if ! command -v 'rsync'; then 119 | APT_GET_PREFIX='' 120 | if command -v 'sudo'; then 121 | APT_GET_PREFIX='sudo' 122 | fi 123 | 124 | $APT_GET_PREFIX apt-get update 125 | $APT_GET_PREFIX apt-get install -q -y rsync 126 | fi 127 | 128 | echo "Syncing files... quietly" 129 | 130 | rsync --delete -a "${SRC_DIR}/" "${BUILD_DIR}" --exclude='.git/' 131 | 132 | # gitignore override 133 | # To allow commiting built files in the build branch (which are typically ignored) 134 | # ------------------- 135 | 136 | BUILD_DEPLOYIGNORE_PATH="${BUILD_DIR}/.deployignore" 137 | if [ -f "$BUILD_DEPLOYIGNORE_PATH" ]; then 138 | BUILD_GITIGNORE_PATH="${BUILD_DIR}/.gitignore" 139 | 140 | if [ -f "$BUILD_GITIGNORE_PATH" ]; then 141 | rm "$BUILD_GITIGNORE_PATH" 142 | fi 143 | 144 | echo "-- found .deployignore; emptying all gitignore files" 145 | find "$BUILD_DIR" -type f -name '.gitignore' | while read GITIGNORE_FILE; do 146 | echo "# Emptied by vip-go-build; '.deployignore' exists and used as global .gitignore. See https://wp.me/p9nvA-89A" > "$GITIGNORE_FILE" 147 | echo "${GITIGNORE_FILE}" 148 | done 149 | 150 | echo "-- using .deployignore as global .gitignore" 151 | mv "$BUILD_DEPLOYIGNORE_PATH" "$BUILD_GITIGNORE_PATH" 152 | fi 153 | 154 | # Make up the commit, commit, and push 155 | # ------------------------------------ 156 | 157 | # Set Git committer 158 | git config user.name "${COMMIT_COMMITTER_NAME}" 159 | git config user.email "${COMMIT_COMMITTER_EMAIL}" 160 | 161 | # Add changed files, delete deleted, etc, etc, you know the drill 162 | git add -A . 163 | 164 | if [ -z "$(git status --porcelain)" ]; then 165 | echo "NOTICE: No changes to deploy" 166 | exit 0 167 | fi 168 | 169 | # Commit it. 170 | MESSAGE=$( printf 'Build changes from %s\n\n%s' "${COMMIT_SHA}" "${BUILD_URL}" ) 171 | # Set the Author to the commit (expected to be a client dev) and the committer 172 | # will be set to the default Git user for this CI system 173 | git commit --author="${COMMIT_AUTHOR_NAME} <${COMMIT_AUTHOR_EMAIL}>" -m "${MESSAGE}" 174 | 175 | # Push it (push it real good). 176 | git push origin "${DEPLOY_BRANCH}" 177 | -------------------------------------------------------------------------------- /fixtures/skip-this-file.txt: -------------------------------------------------------------------------------- 1 | This file should not be pushed to the built branch! 2 | -------------------------------------------------------------------------------- /known_hosts: -------------------------------------------------------------------------------- 1 | github.com ssh-dss AAAAB3NzaC1kc3MAAACBANGFW2P9xlGU3zWrymJgI/lKo//ZW2WfVtmbsUZJ5uyKArtlQOT2+WRhcg4979aFxgKdcsqAYW3/LS1T2km3jYW/vr4Uzn+dXWODVk5VlUiZ1HFOHf6s6ITcZvjvdbp6ZbpM+DuJT7Bw+h5Fx8Qt8I16oCZYmAPJRtu46o9C2zk1AAAAFQC4gdFGcSbp5Gr0Wd5Ay/jtcldMewAAAIATTgn4sY4Nem/FQE+XJlyUQptPWMem5fwOcWtSXiTKaaN0lkk2p2snz+EJvAGXGq9dTSWHyLJSM2W6ZdQDqWJ1k+cL8CARAqL+UMwF84CR0m3hj+wtVGD/J4G5kW2DBAf4/bqzP4469lT+dF2FRQ2L9JKXrCWcnhMtJUvua8dvnwAAAIB6C4nQfAA7x8oLta6tT+oCk2WQcydNsyugE8vLrHlogoWEicla6cWPk7oXSspbzUcfkjN3Qa6e74PhRkc7JdSdAlFzU3m7LMkXo1MHgkqNX8glxWNVqBSc0YRdbFdTkL0C6gtpklilhvuHQCdbgB3LBAikcRkDp+FCVkUgPC/7Rw== 2 | github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== 3 | -------------------------------------------------------------------------------- /tests/verify-circle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | DEPLOY_SUFFIX="${VIP_DEPLOY_SUFFIX:--built}" 4 | DEPLOY_BRANCH="${CIRCLE_BRANCH}${DEPLOY_SUFFIX}" 5 | REPO_SLUG="${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" 6 | REPO_SSH_URL="git@github.com:${REPO_SLUG}" 7 | VERIFY_DIR="/tmp/vip-go-build-verify-$(date +%s)" 8 | 9 | if [[ -d "$VERIFY_DIR" ]]; then 10 | echo "ERROR: ${VERIFY_DIR} already exists." 11 | echo "This should not happen, and something is probably broken!" 12 | exit 1 13 | fi 14 | 15 | echo "Verifying built branch: ${DEPLOY_BRANCH} for ${REPO_SSH_URL} in ${VERIFY_DIR}" 16 | 17 | git clone --depth 1 --single-branch --branch "${DEPLOY_BRANCH}" "${REPO_SSH_URL}" "${VERIFY_DIR}" 18 | 19 | cd "${VERIFY_DIR}" 20 | 21 | echo "" 22 | echo "## Running some tests" 23 | echo "" 24 | 25 | README_FILE="build/README.md" 26 | if [ ! -f "${README_FILE}" ]; then 27 | echo "- Generated file (${README_FILE}) was not found; something is broken!": exit 1 28 | else 29 | echo "- ${README_FILE} looks good!" 30 | fi 31 | 32 | echo "" 33 | 34 | SKIPPED_FILE="fixtures/skip-this-file.txt" 35 | if [ -f "${SKIPPED_FILE}" ]; then 36 | echo "- Found file (${SKIPPED_FILE}) that should have been ignored; something is broken!"; exit 1 37 | else 38 | echo "- ${SKIPPED_FILE} looks good!" 39 | fi 40 | -------------------------------------------------------------------------------- /tests/verify-gha.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -ex 4 | 5 | DEPLOY_SUFFIX="${VIP_DEPLOY_SUFFIX:--built}" 6 | DEPLOY_BRANCH="${GITHUB_REF_NAME}${DEPLOY_SUFFIX}" 7 | REPO_CLONE_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" 8 | VERIFY_DIR="/tmp/vip-go-build-verify-$(date +%s)" 9 | 10 | if [ -d "$VERIFY_DIR" ]; then 11 | echo "ERROR: ${VERIFY_DIR} already exists." 12 | echo "This should not happen; something is probably broken!" 13 | exit 1 14 | fi 15 | 16 | echo "Verifying built branch: ${DEPLOY_BRANCH} for ${REPO_CLONE_URL} in ${VERIFY_DIR}" 17 | 18 | git clone --depth 1 --single-branch --branch "${DEPLOY_BRANCH}" "${REPO_CLONE_URL}" "${VERIFY_DIR}" 19 | 20 | cd "${VERIFY_DIR}" 21 | 22 | echo "" 23 | echo "## Running some tests" 24 | echo "" 25 | 26 | README_FILE="build/README.md" 27 | if [ ! -f "${README_FILE}" ]; then 28 | echo "- Generated file (${README_FILE}) was not found; something is broken!": exit 1 29 | else 30 | echo "- ${README_FILE} looks good!" 31 | fi 32 | 33 | echo "" 34 | 35 | SKIPPED_FILE="fixtures/skip-this-file.txt" 36 | if [ -f "${SKIPPED_FILE}" ]; then 37 | echo "- Found file (${SKIPPED_FILE}) that should have been ignored; something is broken!"; exit 1 38 | else 39 | echo "- ${SKIPPED_FILE} looks good!" 40 | fi 41 | --------------------------------------------------------------------------------