Conditionalize CI steps requiring secrets (#3839)

* Conditionalize all steps that require secrets

* Run on pull_request instead of pull_request_target

* Restore old conditional syntax

* Make secrets available by tagging PRs with a certain label

Co-authored-by: Tom Morris <tfmorris@gmail.com>
This commit is contained in:
Antonin Delpeuch 2021-04-22 07:15:30 +02:00 committed by GitHub
parent ca08e27deb
commit e5f6f56060
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,13 @@
name: Continuous Integration name: Continuous Integration
on: on:
pull_request_target: pull_request:
paths-ignore: paths-ignore:
- 'docs/**' - 'docs/**'
if: !( contains( github.event.pull_request.labels.*.name, 'trusted PR') )
pull_request_target:
types: [ labeled, edited ]
if: contains( github.event.pull_request.labels.*.name, 'trusted PR')
jobs: jobs:
server_tests: server_tests:
@ -41,9 +45,17 @@ jobs:
steps: steps:
- uses: actions/checkout@v2.3.4 - uses: actions/checkout@v2.3.4
if: github.event_name == 'pull_request_target'
with: with:
ref: ${{ github.event.pull_request.head.ref }} ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }} repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: actions/checkout@v2.3.4
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Restore dependency cache - name: Restore dependency cache
uses: actions/cache@v2.1.5 uses: actions/cache@v2.1.5
@ -76,6 +88,7 @@ jobs:
run: mvn jacoco:prepare-agent test run: mvn jacoco:prepare-agent test
- name: Submit test coverage to Coveralls - name: Submit test coverage to Coveralls
if: ${{ secrets.COVERALLS_TOKEN }}
run: | run: |
mvn prepare-package -DskipTests=true mvn prepare-package -DskipTests=true
mvn jacoco:report coveralls:report -DrepoToken=${{ secrets.COVERALLS_TOKEN }} -DpullRequest=${{ github.event.number }} mvn jacoco:report coveralls:report -DrepoToken=${{ secrets.COVERALLS_TOKEN }} -DpullRequest=${{ github.event.number }}
@ -137,9 +150,12 @@ jobs:
cd ./main/tests/cypress cd ./main/tests/cypress
yarn lint yarn lint
- name: Set up Cypress dashboard project
if: {{ secrets.CYPRESS_RECORD_KEY }}
run: echo "CYPRESS_PROJECT=s5du3k" >> $GITHUB_ENV
- name: Test with Cypress on ${{ matrix.browser }} - name: Test with Cypress on ${{ matrix.browser }}
run: | run: |
echo REFINE_MIN_MEMORY=1400M >> ./refine.ini echo REFINE_MIN_MEMORY=1400M >> ./refine.ini
echo REFINE_MEMORY=4096M >> ./refine.ini echo REFINE_MEMORY=4096M >> ./refine.ini
./refine ui_test ${{ matrix.browser }} s5du3k "${{ secrets.CYPRESS_RECORD_KEY }}" ./refine ui_test ${{ matrix.browser }} "${{ env.CYPRESS_PROJECT }}" "${{ secrets.CYPRESS_RECORD_KEY }}"