-
Notifications
You must be signed in to change notification settings - Fork 481
72 lines (61 loc) · 2.4 KB
/
ci_pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: CI Pipeline
on:
workflow_dispatch:
inputs:
pr_id:
description: 'Pull Request ID'
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
permissions:
contents: read
issues: write
pull-requests: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check-reviewers:
runs-on: ubuntu-latest
outputs:
has_infrastructure_reviewer: ${{ steps.check.outputs.has_infrastructure_reviewer }}
steps:
- name: Check for Infrastructure Reviewers
id: check
run: |
PR_ID=${{ github.event.inputs.pr_id }}
REVIEWERS=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/code-dot-org/code-dot-org/pulls/$PR_ID/reviewers)
if [[ $REVIEWERS == *"infrastructure"* ]]; then
echo "has_infrastructure_reviewer=true" >> $GITHUB_ENV
else
echo "has_infrastructure_reviewer=false" >> $GITHUB_ENV
fi
build-and-test:
needs: check-reviewers
runs-on: ubuntu-latest
if: needs.check-reviewers.outputs.has_infrastructure_reviewer == 'true' || github.actor == 'pablo-code-org'
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
path: code-dot-org
- 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
- name: Debugging Directories and Files in Docker as User CircleCI
run: |
echo "Searching for ui_tests.sh in /home/circleci as circleci"
docker run --user circleci code-dot-org-testing-docker-image /bin/bash -c "find /home/circleci -type f -name 'ui_tests.sh'"
echo "Displaying Environment Variables as circleci"
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') }}