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

Remove CircleCI and replace with GitHub Actions #16

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .circleci/set-up-globals.sh → .ci/set-up-globals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,15 @@ touch $BASH_ENV
) >> $BASH_ENV
source $BASH_ENV

set -ex

TERMINUS_PLUGINS_DIR=.. terminus list -n remote
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we just remove Circle now that we have GitHub actions?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still being used by GitHub Actions. You just commented where it's being used. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misread as .circleci/... 😊


set +ex
echo "Test site is $TERMINUS_SITE"
echo "Logging in with a machine token:"
terminus auth:login -n --machine-token="$TERMINUS_TOKEN"
terminus whoami
mkdir -p $HOME/.ssh
touch $HOME/.ssh/config
echo "StrictHostKeyChecking no" >> "$HOME/.ssh/config"
git config --global user.email "$GIT_EMAIL"
git config --global user.name "Circle CI"
git config --global user.name "GitHub Actions"
# Ignore file permissions.
git config --global core.fileMode false
71 changes: 0 additions & 71 deletions .circleci/config.yml

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Terminus Plugin Example
on: push
jobs:
checkout_lint:
runs-on: ubuntu-latest
container:
image: quay.io/pantheon-public/php-ci:v7.4
name: Checkout & lint
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Save repo content as artifact
uses: actions/upload-artifact@v2
with:
name: full-workspace
path: ${{ github.workspace }}
- name: Full Composer Install
run: composer install
- name: Install test tools
run: composer install-tools
- name: Validate Code
run: composer cs

test:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
php-versions: ['7.4', '8.0']
container:
image: pantheonpublic/terminus-plugin-test:4.x-php${{ matrix.php-versions }}
name: Test (PHP ${{ matrix.php-versions }})
needs: [ checkout_lint ]
defaults:
run:
shell: bash
working-directory: /terminus-plugin-test/plugin
env:
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
TERMINUS_SITE: ${{ secrets.TERMINUS_SITE }}
BASH_ENV: ~/.bashrc
HOME: /home/tester
steps:
- name: Download repo content from artifact
uses: actions/download-artifact@v2
with:
name: full-workspace
path: /terminus-plugin-test/plugin
- name: Setup environment
run: chmod +x ./.ci/set-up-globals.sh && ./.ci/set-up-globals.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you just copy this from Build Tools? I don't see the set-up-globals script.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The directory was renamed from .circleci to .ci. To answer your question, I copied from terminus-rsync-plugin.

- name: Check Terminus version
run: terminus --version
- name: Install plugin
run: terminus self:plugin:install .
- name: Install SSH key
uses: shimataro/[email protected]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is failing right now, presumably due to the lack of a secret. This plugin does not require a fixture site, so we have the deep philosophical question: should we set up testing fixtures for plugins that don't need them, just so that folks who copy the code have example test fixtures? There's some merit to that, but I'd say maybe we should just keep it simple and remove TERMINUS_TOKEN et. al. from these tests, and put them back in where needed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd comment stuff out in the ci.yml file. This way, it's still there for people to copy but it's not affecting this project. Maybe comment out the lines and add a comment that to enable people should add secret and uncomment?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will commenting make the tests pass though? Can't we just make universal test secrets that are limited in scope to only testing repos?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting those sections in this specific plugin will make it pass because this plugin tests don't need those secrets

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ssh-key-action is failing in GitHub actions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just set the secrets everywhere if we want the example here for reference.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we plan on solving the ssh/secrets bottleneck?

with:
key: ${{ secrets.SSH_KEY }}
known_hosts: unnecessary
- name: Run tests
run: composer test
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Terminus Plugin Example

[![CircleCI](https://circleci.com/gh/pantheon-systems/terminus-plugin-example.svg?style=shield)](https://circleci.com/gh/pantheon-systems/terminus-plugin-example)
[![GitHub Actions](https://github.com/pantheon-systems/terminus-plugin-example/actions/workflows/ci.yml/badge.svg)](https://github.com/pantheon-systems/terminus-plugin-example/actions)
[![Terminus v2.x - v3.x Compatible](https://img.shields.io/badge/terminus-2.x%20--%203.x-green.svg)](https://github.com/pantheon-systems/terminus-plugin-example/tree/2.x)

A simple plugin for Terminus-CLI to demonstrate how to add new commands.
Expand Down Expand Up @@ -28,6 +28,7 @@ On older versions of Terminus:
mkdir -p ~/.terminus/plugins
curl https://github.com/pantheon-systems/terminus-plugin-example/archive/2.x.tar.gz -L | tar -C ~/.terminus/plugins -xvz
```
For help installing, see [Manage Plugins](https://pantheon.io/docs/terminus/plugins/).

## Testing
This example project includes four testing targets:
Expand All @@ -37,11 +38,11 @@ This example project includes four testing targets:
* `composer unit`: Run unit tests with phpunit
* `composer functional`: Run functional test with bats

To run all tests together, use `composer test`.

Note that prior to running the tests, you should first run:
Prior to running the tests, you should first run:
* `composer install`
* `composer install-tools`

To run all tests together, use `composer test`.

## Help
Run `terminus help auth:hello` for help.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"cbf": "phpcbf --standard=PSR2 -n src",
"lint": "find src -name '*.php' -print0 | xargs -0 -n1 php -l",
"unit": "phpunit --colors=always tests",
"functional": "TERMINUS_PLUGINS_DIR=.. PATH=tools/bin:$PATH bats -p -t tests/functional",
"functional": "bats -p -t tests/functional",
"install-bats": "if [ ! -f tools/bin/bats ] ; then git clone https://github.com/sstephenson/bats.git tools/bats; tools/bats/install.sh tools; fi",
"install-tools": [
"@install-bats"
Expand Down