Skip to content

Commit

Permalink
Clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwcarlson committed Oct 28, 2023
1 parent 14817c4 commit 4693306
Showing 1 changed file with 54 additions and 65 deletions.
119 changes: 54 additions & 65 deletions .github/workflows/project.yaml
Original file line number Diff line number Diff line change
@@ -1,78 +1,67 @@
name: Upsun Demo CI

on:
pull_request:
branches:
- main

'on':
pull_request:
branches:
- main
env:
UPSUN_CLI_NO_INTERACTION: 1
UPSUN_CLI_TOKEN: ${{secrets.DEVREL_USER_UPSUN_TOKEN}}
UPSUN_HOST_FILE: "~/.ssh/known_hosts"
UPSUN_HOST_REGION: "ca-1"
UPSUN_HOST_SUFFIX: "platform.sh"

GIT_USER_EMAIL: "[email protected]"
GIT_USER_NAME: "DevRel Team Bot"

TEST_PATH: "utils/tests"

ORG_NAME: "demo-test-org"
UPSUN_CLI_NO_INTERACTION: 1
UPSUN_CLI_TOKEN: '${{secrets.DEVREL_USER_UPSUN_TOKEN}}'

UPSUN_HOST_FILE: ~/.ssh/known_hosts
UPSUN_HOST_REGION: ca-1
UPSUN_HOST_SUFFIX: platform.sh

GIT_USER_EMAIL: [email protected]
GIT_USER_NAME: DevRel Team Bot

TEST_ORG_NAME: demo-test-org
TEST_PROJECT_TITLE: "Demo Test Run (pr-${{ github.ref_name }})"

TEST_PROJECT_REGION: "ca-1"
TEST_PROJECT_REGION_SUFFIX: "platform.sh"
TEST_PATH: utils/tests

TEST_PROJECT_REPO: "platformsh/demo-project"
TEST_PROJECT_LOCALDIR: "upsun-demo"

TEST_PROJECT_DEFAULT_BRANCH: ${{ github.event.pull_request.head.ref }}
TEST_PROJECT_STAGING_ENV: ${{ github.event.pull_request.head.ref }}-staging
ORG_NAME: demo-test-org

TEST_PROJECT_BACKEND_PATH: "api/v1/environment"

TEST_PROJECT_TITLE: 'Demo Test Run (pr-${{ github.ref_name }})'
TEST_PROJECT_REGION: ca-1
TEST_PROJECT_REGION_SUFFIX: platform.sh
TEST_PROJECT_REPO: platformsh/demo-project
TEST_PROJECT_LOCALDIR: upsun-demo
TEST_PROJECT_DEFAULT_BRANCH: '${{ github.event.pull_request.head.ref }}'
TEST_PROJECT_STAGING_ENV: '${{ github.event.pull_request.head.ref }}-staging'
TEST_PROJECT_BACKEND_PATH: api/v1/environment
jobs:
demo-runthrough:
runs-on: ubuntu-latest
steps:
################################################################################################
# A. Setup Upsun CLI.
- name: "[setup_cli] 1. Set up Homebrew."
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: "[setup_cli] 2. Install Upsun CLI."
run: |
echo "::notice::Installing Upsun CLI via HomeBrew."
brew install platformsh/tap/upsun-cli
- name: "[setup_cli] 3. Test: The Upsun CLI should be installed and executable."
run: |
echo "::notice::Verifying CLI is installed correctly."
./$TEST_PATH/command_installed.sh upsun
################################################################################################
# B. Setup authenticated Upsun CLI user.
- name: "[setup_cli_auth] 1. Authenticate Upsun CLI to allow push from workflow."
run: |
echo "::notice::Generating SSH certificate for Upsun CLI."
upsun ssh-cert:load --new -y
touch $UPSUN_HOST_FILE
chmod 644 $UPSUN_HOST_FILE
ssh-keyscan ssh.$UPSUN_HOST_REGION.$UPSUN_HOST_SUFFIX -v >> $UPSUN_HOST_FILE
ssh-keyscan git.$UPSUN_HOST_REGION.$UPSUN_HOST_SUFFIX -v >> $UPSUN_HOST_FILE
- name: "[setup_cli_auth] 2. Test: an authenticated CLI can retrieve organization info."
run: |
echo "::notice::Verifying CLI is authenticated correctly."
RESULT=$(upsun org:info -o $ORG_NAME name)
./$TEST_PATH/compare_strings $RESULT $ORG_NAME "Authenticate Upsun CLI user"
upsun auth:info username
'demo-runthrough':

runs-on: ubuntu-latest

steps:

################################################################################################
# A. Setup Upsun CLI.
- name: "[setup_cli] 1. Set up Homebrew"
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: "[setup_cli] 2. Install Upsun CLI"
run: |
echo "::notice::Installing Upsun CLI via HomeBrew."
brew install platformsh/tap/upsun-cli
- name: "[setup_cli] 3. Test: The Upsun CLI should be installed and executable."
run: |
echo "::notice::Verifying CLI is installed correctly."
./$TEST_PATH/command_installed.sh upsun
################################################################################################
# B. Setup authenticated Upsun CLI user.
- name: "[setup_cli_auth] 1. Authenticate Upsun CLI to allow push from workflow"
run: |
echo "::notice::Generating SSH certificate for Upsun CLI."
upsun ssh-cert:load --new -y
touch $UPSUN_HOST_FILE
chmod 644 $UPSUN_HOST_FILE
ssh-keyscan ssh.$UPSUN_HOST_REGION.$UPSUN_HOST_SUFFIX -v >> $UPSUN_HOST_FILE
ssh-keyscan git.$UPSUN_HOST_REGION.$UPSUN_HOST_SUFFIX -v >> $UPSUN_HOST_FILE
- name: "[setup_cli_auth] 2. Test: an authenticated CLI can retrieve organization info."
run: |
echo "::notice::Verifying CLI is authenticated correctly."
RESULT=$(upsun org:info -o $ORG_NAME name)
./$TEST_PATH/compare_strings $RESULT $ORG_NAME "Authenticate Upsun CLI user"
upsun auth:info username
# ################################################################################################
# # A. Setting up tools and authentication to test project/organization.
Expand Down

0 comments on commit 4693306

Please sign in to comment.