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

Add nightly test #30

Merged
merged 1 commit into from
Sep 28, 2022
Merged
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
28 changes: 28 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Integration test'

on:
workflow_call:
inputs:
shell-installer-url:
type: string
required: true

jobs:
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- run: |
export AUTIFY_CLI_INSTALLER_URL=${{ inputs.shell-installer-url }}
brew install bitrise
bitrise run test

ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
export AUTIFY_CLI_INSTALLER_URL=${{ inputs.shell-installer-url }}
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install bitrise
bitrise run test
11 changes: 11 additions & 0 deletions .github/workflows/nightly-beta-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 'Nightly beta test'
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

jobs:
beta:
uses: ./.github/workflows/integration-test.yml
with:
shell-installer-url: https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/beta/install-cicd.bash
11 changes: 11 additions & 0 deletions .github/workflows/nightly-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 'Nightly test'
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

jobs:
stable:
uses: ./.github/workflows/integration-test.yml
with:
shell-installer-url: https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/stable/install-cicd.bash
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'test'
on:
pull_request:
push:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: make lint

integration-test:
uses: ./.github/workflows/integration-test.yml
with:
shell-installer-url: https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/stable/install-cicd.bash
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.PHONY: lint test beta-test

lint:
shellcheck --version
shellcheck *.sh

test:
AUTIFY_CLI_INSTALLER_URL=https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/stable/install-cicd.bash bitrise run test

beta-test:
AUTIFY_CLI_INSTALLER_URL=https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/beta/install-cicd.bash bitrise run test
16 changes: 12 additions & 4 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git

app:
envs:
- AUTIFY_ACCESS_TOKEN: token
- AUTIFY_CLI_INTEGRATION_TEST_INSTALL: 1
- AUTIFY_TEST_WAIT_INTERVAL_SECOND: 0
# If you want to share this step into a StepLib
- BITRISE_STEP_ID: autify-upload
- BITRISE_STEP_VERSION: "1.0.0"
Expand All @@ -22,21 +25,24 @@ workflows:
inputs:
- path: ./_tmp
- is_create_path: true

- script:
inputs:
- content: |
#!/bin/bash
set -ex
npm i @autifyhq/autify-cli-integration-test
npx autify-mobile-generate-fake-app
export AUTIFY_CLI_INSTALL_USE_CACHE=1
curl -L "$AUTIFY_CLI_INSTALLER_URL" | bash -xe
./autify/node_modules/.bin/autify-mobile-generate-fake-app

- path::./:
title: mobile build upload --workspace-id AAA ./android.apk
inputs:
- access_token: ${AUTIFY_ACCESS_TOKEN}
- workspace_id: AAA
- build_path: ./android.apk
- autify_path: ./node_modules/.bin/autify-with-proxy
- autify_path: autify-with-proxy
- autify_cli_installer_url: ${AUTIFY_CLI_INSTALLER_URL}
- script:
inputs:
- content: |
Expand All @@ -51,7 +57,8 @@ workflows:
- access_token: ${AUTIFY_ACCESS_TOKEN}
- workspace_id: AAA
- build_path: ./ios.app
- autify_path: ./node_modules/.bin/autify-with-proxy
- autify_path: autify-with-proxy
- autify_cli_installer_url: ${AUTIFY_CLI_INSTALLER_URL}
- script:
inputs:
- content: |
Expand All @@ -67,6 +74,7 @@ workflows:
- workspace_id: AAA
- build_path: ./android.apk
- autify_path: "false"
- autify_cli_installer_url: ${AUTIFY_CLI_INSTALLER_URL}
is_skippable: true
- script:
inputs:
Expand Down
18 changes: 13 additions & 5 deletions step.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,38 @@ function exit_script() {
trap exit_script EXIT

# Install Autify CLI
curl https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/stable/install-cicd.bash | bash -xe
export PATH="$PWD/autify/bin:$PATH"
if [ -z "${autify_cli_installer_url:-}" ]; then
echo "Missing autify_cli_installer_url."
exit 1
fi
export XDG_CACHE_HOME="$PWD/.cache"
export XDG_CONFIG_HOME="$PWD/.config"
export XDG_DATA_HOME="$PWD/.data"
export AUTIFY_CLI_INSTALL_USE_CACHE=1
curl -L "${autify_cli_installer_url}" | bash -xe

while IFS= read -r line; do
export PATH="$line:$PATH"
done < "$PWD/autify/path"

# Setup autify path
AUTIFY=${autify_path:-"autify"}

# Check access token
if [ -z "${access_token}" ]; then
if [ -z "${access_token:-}" ]; then
echo "Missing access-token."
exit 1
fi

# Setup command line arguments
if [ -n "${build_path}" ]; then
if [ -n "${build_path:-}" ]; then
add_args "${build_path}"
else
echo "Missing build_path."
exit 1
fi

if [ -n "${workspace_id}" ]; then
if [ -n "${workspace_id:-}" ]; then
add_args "--workspace-id=${workspace_id}"
else
echo "Missing workspace_id."
Expand Down
4 changes: 4 additions & 0 deletions step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ inputs:
opts:
title: A path to Autify CLI
is_expand: true
- autify_cli_installer_url: https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/stable/install-cicd.bash
opts:
title: Autify CLI installer URL
is_expand: true

outputs:
- AUTIFY_BUILD_ID:
Expand Down