Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate checks for upstream changes #1

Open
stevegrunwell opened this issue Feb 26, 2020 · 3 comments
Open

Automate checks for upstream changes #1

stevegrunwell opened this issue Feb 26, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@stevegrunwell
Copy link
Member

It would be great if we were periodically (once a week, or so) checking the upstream script file to see if anything's changed.

This would be a great opportunity to explore GitHub Actions, and I have the basic logic started:

name: Check for out-of-date shell scripts

on:
  # Run this every Monday at 00:00:00.
  schedule:
  - cron: "0 0 0 0 1"

jobs:
  check-dependencies:
    steps:
      - name: Refresh bin/install-wp-tests.sh
        run: composer refresh-install-wp-tests
      - name: Verify if anything has changed
        run: git diff --exit-code

The last thing needed is to notify repo maintainers if changes were found so we can update + tag a new release accordingly.

@stevegrunwell stevegrunwell added the enhancement New feature or request label Feb 26, 2020
@szepeviktor
Copy link
Contributor

@stevegrunwell It is update time :)

index f8db3cc..6a295fa 100644
--- a/bin/install-wp-tests.sh
+++ b/bin/install-wp-tests.sh
@@ -17,7 +17,7 @@ SKIP_DB_CREATE=${6-false}
 TMPDIR=${TMPDIR-/tmp}
 TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")
 WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib}
-WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/}
+WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress}

 download() {
     if [ `which curl` ]; then
@@ -64,10 +64,9 @@ install_wp() {
    mkdir -p $WP_CORE_DIR

    if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
-       mkdir -p $TMPDIR/wordpress-nightly
-       download https://wordpress.org/nightly-builds/wordpress-latest.zip  $TMPDIR/wordpress-nightly/wordpress-nightly.zip
-       unzip -q $TMPDIR/wordpress-nightly/wordpress-nightly.zip -d $TMPDIR/wordpress-nightly/
-       mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR
+       mkdir -p $TMPDIR/wordpress-trunk
+       svn export --quiet https://core.svn.wordpress.org/trunk $TMPDIR/wordpress-trunk/wordpress
+       mv $TMPDIR/wordpress-trunk/wordpress/* $WP_CORE_DIR
    else
        if [ $WP_VERSION == 'latest' ]; then
            local ARCHIVE_NAME='latest'
@@ -109,8 +108,8 @@ install_test_suite() {
    if [ ! -d $WP_TESTS_DIR ]; then
        # set up testing suite
        mkdir -p $WP_TESTS_DIR
-       svn co --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
-       svn co --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
+       svn export --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
+       svn export --quiet --ignore-externals https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
    fi

    if [ ! -f wp-tests-config.php ]; then
@@ -167,8 +166,7 @@ install_db() {
    fi

    # create database
-   # Overwritten to incorporate https://github.com/wp-cli/scaffold-command/pull/255.
-   if [ $(mysql --user="$DB_USER" --password="$DB_PASS" --execute='show databases;' | grep ^$DB_NAME$) ]
+   if [ $(mysql --user="$DB_USER" --password="$DB_PASS"$EXTRA --execute='show databases;' | grep ^$DB_NAME$) ]
    then
        echo "Reinstalling will delete the existing test database ($DB_NAME)"
        read -p 'Are you sure you want to proceed? [y/N]: ' DELETE_EXISTING_DB

May I send a PR?

@stevegrunwell
Copy link
Member Author

Please feel free, and I'll make sure you get Hacktoberfest credit for it, too 😉 Thank you!

@szepeviktor
Copy link
Contributor

you get Hacktoberfest credit for it,

Okay, no need for that. Just send €1 000 000 to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants