-
Notifications
You must be signed in to change notification settings - Fork 92
77 lines (64 loc) · 2.75 KB
/
deploy.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
73
74
75
76
77
name: Deploy
on:
push:
branches:
- main
pull_request:
jobs:
deploy-staging:
# Forks and dependabot cannot access secrets so the job would fail.
# Run for non dependabot PRs or regular pushes to web-platform-tests/wpt.fyi
if: |
(github.repository == 'web-platform-tests/wpt.fyi') &&
((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'web-platform-tests/wpt.fyi' && github.actor != 'dependabot[bot]') ||
(github.event_name != 'pull_request'))
name: Deploy staging.wpt.fyi
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: webplatformtests/wpt.fyi:latest
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: secrets
run: echo "$GCLOUD_KEY_FILE_JSON" > client-secret.json
env:
GCLOUD_KEY_FILE_JSON: ${{ secrets.GCLOUD_KEY_FILE_JSON }}
- name: Set DOCKER_INSTANCE
run: echo "DOCKER_INSTANCE=wptd-dev-$(echo $RANDOM)" >> $GITHUB_ENV
- name: Docker config check
uses: dorny/paths-filter@v3
id: dockerchanges
with:
filters: |
dockerconf:
- 'Dockerfile'
# run only if Docker configuration was changed
- if: steps.dockerchanges.outputs.dockerconf == 'true'
name: Rebuild Docker image
run: docker build -t webplatformtests/wpt.fyi:latest .
# run only if Docker configuration was not changed
- if: steps.dockerchanges.outputs.dockerconf == 'false'
name: Fetch latest Docker image
run: docker pull "${DOCKER_IMAGE}"
- name: pre-installation
run: bash ./util/docker-dev/run.sh -d -q
- name: installation
run: docker exec -t "${DOCKER_INSTANCE}" make go_build;
# Set -f for main branch.
- name: set deployment flag
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: echo "FORCE_DEPLOYMENT=-f" >> $GITHUB_ENV
- name: deploy webapp
run: ./util/deploy-staging.sh "${FORCE_DEPLOYMENT}" webapp/web/app.staging.yaml
- name: Run go_large_test in main
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: docker exec -t "${DOCKER_INSTANCE}" make go_large_test STAGING=true
- name: build processor
run: ./util/deploy-staging.sh "${FORCE_DEPLOYMENT}" results-processor/app.staging.yaml
- name: build searchcache
run: ./util/deploy-staging.sh "${FORCE_DEPLOYMENT}" api/query/cache/service/app.staging.yaml
- name: Clean up versions in main
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: docker exec -t "${DOCKER_INSTANCE}" make cleanup_staging_versions