Add debug for docker tag selection #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 2GP Feature Test | ||
on: | ||
workflow_call: | ||
inputs: | ||
org: | ||
required: false | ||
default: feature | ||
type: string | ||
debug: | ||
required: false | ||
default: false | ||
type: boolean | ||
docker_image: | ||
required: false | ||
default: ghcr.io/muselab-d2x/d2x | ||
type: string | ||
docker_tag: | ||
required: false | ||
default: cumulusci-next | ||
type: string | ||
with_chromedriver: | ||
required: false | ||
default: false | ||
type: boolean | ||
with_playwright: | ||
required: false | ||
default: false | ||
type: boolean | ||
with_full_browser: | ||
required: false | ||
default: false | ||
type: boolean | ||
secrets: | ||
dev-hub-auth-url: | ||
required: false | ||
dev-hub-username: | ||
required: false | ||
dev-hub-client-id: | ||
required: false | ||
dev-hub-private-key: | ||
required: false | ||
gh-email: | ||
required: true | ||
github-token: | ||
required: true | ||
github-app-id: | ||
required: false | ||
github-app-key: | ||
required: false | ||
jobs: | ||
select_d2x_docker_image: | ||
name: "Select D2X Docker Image" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag_suffix: ${{ steps.set-tag-suffix.outputs.tag_suffix }} | ||
steps: | ||
- name: Calculate tag suffix | ||
id: set-tag-suffix | ||
run: | | ||
TAG_SUFFIX="" | ||
if [ "${{ inputs.with_full_browser }}" == "true" ]; then | ||
echo "tag_suffix=-full-browser" >> $GITHUB_ENV | ||
echo "Using full-browser image" >> $GITHUB_STEP_SUMMARY | ||
elif [ "${{ inputs.with_chromedriver }}" == "true" ] && [ "${{ inputs.with_playwright }}" == "true" ]; then | ||
echo "tag_suffix=-full-browser" >> $GITHUB_ENV | ||
echo "Using full-browser image" >> $GITHUB_STEP_SUMMARY | ||
elif [ "${{ inputs.with_chromedriver }}" == "true" ]; then | ||
echo "tag_suffix=-chromedriver" >> $GITHUB_ENV | ||
echo "Using chromedriver image" >> $GITHUB_STEP_SUMMARY | ||
elif [ "${{ inputs.with_playwright }}" == "true" ]; then | ||
echo "tag_suffix=-playwright" >> $GITHUB_ENV | ||
echo "Using playwright image" >> $GITHUB_STEP_SUMMARY | ||
else | ||
echo "tag_suffix=" >> $GITHUB_ENV | ||
echo "Using default image" >> $GITHUB_STEP_SUMMARY | ||
fi | ||
echo "tag_suffix=${{ env.tag_suffix }}" >> $GITHUB_ENV | ||
feature-test: | ||
name: "2GP Feature Test" | ||
runs-on: ubuntu-latest | ||
needs: select_d2x_docker_image | ||
container: | ||
image: ${{ inputs.docker_image }}:${{ inputs.docker_tag }}${{ needs.select_d2x_docker_image.outputs.tag_suffix }} | ||
options: --user root | ||
credentials: | ||
username: "${{ github.actor }}" | ||
password: "${{ secrets.github-token }}" | ||
env: | ||
DEV_HUB_AUTH_URL: "${{ secrets.dev-hub-auth-url }}" | ||
DEV_HUB_USERNAME: "${{ secrets.dev-hub-username }}" | ||
DEV_HUB_CLIENT_ID: "${{ secrets.dev-hub-client-id }}" | ||
DEV_HUB_PRIVATE_KEY: "${{ secrets.dev-hub-private-key }}" | ||
CUMULUSCI_SERVICE_github: '{ "username": "${{ github.actor }}", "token": "${{ secrets.github-token }}", "email": "${{ secrets.gh-email }}" }' | ||
GITHUB_APP_ID: "${{ secrets.github-app-id }}" | ||
GITHUB_APP_KEY: "${{ secrets.github-app-key }}" | ||
steps: | ||
- name: Debug Docker Tag | ||
run: echo "Using Docker image: ${{ inputs.docker_image }}:${{ inputs.docker_tag }}${{ needs.select_d2x_docker_image.outputs.tag_suffix }}" | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Auth to DevHub | ||
run: /usr/local/bin/devhub.sh | ||
- name: Set ${{ inputs.org }} org as default org | ||
run: cci org default ${{ inputs.org }} | ||
- name: Build Feature Test Package | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.github-token }}" | ||
run: cci flow run build_feature_test_package $([[ "${{ inputs.debug }}" == "true" ]] && echo " --debug") | tee cumulusci-flow.log | ||
shell: bash | ||
- name: Set Commit Status | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.github-token }}" | ||
run: | | ||
VERSION=$(cat cumulusci-flow.log | grep -o -E -m 1 "04t[a-zA-Z0-9]{15}") | ||
gh api \ | ||
--method POST \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
'/repos/${{ github.repository }}/statuses/${{ github.sha }}' \ | ||
-f state='success' \ | ||
-f description="version_id: $VERSION" \ | ||
-f context='Build Feature Test Package' | ||
shell: bash | ||
- name: Run Feature Test | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.github-token }}" | ||
run: cci flow run ci_feature_2gp | ||
- name: Delete Scratch Org | ||
if: ${{ always() }} | ||
run: | | ||
cci org scratch_delete feature | ||
shell: bash |