-
Notifications
You must be signed in to change notification settings - Fork 17
53 lines (43 loc) · 1.87 KB
/
test.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
name: Test
on: [push]
jobs:
test:
runs-on: ubuntu-latest
env:
# Environments to connect to GCS.
DOT_BOTO_OAUTH: ${{ secrets.DOT_BOTO_OAUTH }}
GCP_ACCESS_KEY_ID: ${{ secrets.GCP_ACCESS_KEY_ID }}
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
GCP_SECRET_ACCESS_KEY: ${{ secrets.GCP_SECRET_ACCESS_KEY }}
TARGET_BUCKET_URL_PREFIX: gs://staging.mongodb-awesome-backup.appspot.com/test
# Match with the time zone of the mongodb-awesome-backup container.
TZ: Asia/Tokyo
# Slack notification
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
NOTIFY_MESSAGE: '${{ github.repository }} (${{ github.workflow }}): `${{ github.ref }}`@${{ github.actor }}'
steps:
- uses: actions/checkout@v2
- name: Set service account key path
run: |
echo "GCP_SERVICE_ACCOUNT_KEY_JSON_PATH=$(pwd)/tmp/key.json" >> $GITHUB_ENV
- name: Run integration tests
run: |
# Create a temporary service account key file
mkdir -p $(dirname ${GCP_SERVICE_ACCOUNT_KEY_JSON_PATH})
echo '${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}' > ${GCP_SERVICE_ACCOUNT_KEY_JSON_PATH}
# Set environment for integration tests
BUCKET_NAME_PREFIX=`echo $GITHUB_REPOSITORY | tr '/' '_'`
export TARGET_BUCKET_URL="${TARGET_BUCKET_URL_PREFIX}/${BUCKET_NAME_PREFIX}_${GITHUB_RUN_ID}/"
test/all.sh
- name: Remove the temporary service account key file
run: |
rm -f ${GCP_SERVICE_ACCOUNT_KEY_JSON_PATH}
- name: Slack Notification
if: always()
uses: innocarpe/actions-slack@v1
with:
status: ${{ job.status }} # Required
success_text: '*Success* ${{ env.NOTIFY_MESSAGE }}'
failure_text: '*Fail* ${{ env.NOTIFY_MESSAGE }}'
cancelled_text: '*Cancelled* ${{ env.NOTIFY_MESSAGE }}'