CI Pipeline #65
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: CI Pipeline | |
on: | |
workflow_dispatch: | |
inputs: | |
pr_id: | |
description: 'Pull Request ID (default: 55766)' | |
required: false | |
default: '55766' | |
env: | |
AWS_DEFAULT_REGION: us-east-1 | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
MYSQL_ROOT_PASSWORD: root | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
if: github.actor == 'pablo-code-org' | |
steps: | |
- name: Get Branch Name from Pull Request ID | |
id: get_branch | |
run: | | |
PR_ID=${{ github.event.inputs.pr_id }} | |
PR_DATA=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
https://api.github.com/repos/code-dot-org/code-dot-org/pulls/$PR_ID) | |
BRANCH_NAME=$(echo $PR_DATA | jq -r .head.ref) | |
echo "Branch Name: $BRANCH_NAME" | |
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
- name: Checkout Repository at Branch | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ env.BRANCH_NAME }} | |
path: code-dot-org | |
repository: code-dot-org/code-dot-org | |
token: ${{ secrets.GITHUB_TOKEN }} | |
fetch-depth: 0 | |
- name: Prepare entrypoint script | |
run: cp ./code-dot-org/docker/dockerfiles/entrypoint.sh ./code-dot-org/ | |
- name: Set up Docker Environment | |
run: docker build -t code-dot-org-testing-docker-image -f ./code-dot-org/docker/dockerfiles/Dockerfile ./code-dot-org | |
# Debugging steps running as circleci user | |
- name: Debugging / Directory as circleci User | |
run: docker run --user circleci code-dot-org-testing-docker-image /bin/bash -c "ls -la /" | |
- name: Debugging /home Directory as circleci User | |
run: docker run --user circleci code-dot-org-testing-docker-image /bin/bash -c "ls -la /home" | |
- name: Debugging /circleci Directory as circleci User | |
run: docker run --user circleci code-dot-org-testing-docker-image /bin/bash -c "ls -la /circleci" | |
- name: Debugging deeper into /circleci as circleci User | |
run: docker run --user circleci code-dot-org-testing-docker-image /bin/bash -c "ls -laR /circleci" | |
- name: Searching for ui_tests.sh in /circleci as circleci User | |
run: docker run --user circleci code-dot-org-testing-docker-image /bin/bash -c "find /circleci -type f -name 'ui_tests.sh' 2>/dev/null" | |
- name: Displaying Environment Variables as circleci User | |
run: docker run --user circleci code-dot-org-testing-docker-image /bin/bash -c "printenv" | |
- name: Update Cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} |