-
Notifications
You must be signed in to change notification settings - Fork 3
85 lines (76 loc) · 2.48 KB
/
ci.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
78
79
80
81
82
83
84
85
on: push
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
jobs:
unit-test:
runs-on: ubuntu-latest
name: Run tests
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v2
- uses: whoan/docker-build-with-cache-action@fix-yaml-parsing
with:
username: maciejgryka
password: "${{ secrets.GITHUB_TOKEN }}"
registry: docker.pkg.github.com
image_name: regex-help-test
dockerfile: Dockerfile
build_extra_args: "--target test"
- name: Run tests
run: docker run docker.pkg.github.com/maciejgryka/regex_help/regex-help-test
qa-up:
runs-on: ubuntu-latest
name: Scale up QA
steps:
- uses: actions/checkout@v2
- uses: superfly/flyctl-actions@master
with:
args: "--config fly.qa.toml scale count 1"
# repeat, because flyctl doesn't always work as it shouild and the call is indempotent
- uses: superfly/flyctl-actions@master
with:
args: "--config fly.qa.toml scale count 1"
deploy-qa:
runs-on: ubuntu-latest
name: Deploy to QA
needs: qa-up
env:
MIX_ENV: prod
steps:
- uses: actions/checkout@v2
- uses: superfly/flyctl-actions@master
with:
args: 'deploy --remote-only --config fly.qa.toml --dockerfile Dockerfile --env HOST="regex-help-stg.fly.dev" --env GIT_SHA="${{ github.sha }}"'
test-rf:
runs-on: ubuntu-latest
name: Run Rainforest tests
needs: [deploy-qa, qa-up]
container: gcr.io/rf-public-images/rainforest-cli
steps:
- run: rainforest run --run-group-id 8873 --fail-fast --token ${{ secrets.RAINFOREST_API_TOKEN }} --description "regex.help:$GITHUB_REF" --release "$GITHUB_SHA"
qa-down:
runs-on: ubuntu-latest
name: Scale down QA
needs: test-rf
if: ${{ always() }}
steps:
- uses: actions/checkout@v2
- uses: superfly/flyctl-actions@master
with:
args: "--config fly.qa.toml scale count 0"
- uses: superfly/flyctl-actions@master
with:
args: "--config fly.qa.toml scale count 0"
deploy-prd:
runs-on: ubuntu-latest
name: Deploy to prod
env:
MIX_ENV: prod
needs: [unit-test, test-rf]
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- uses: superfly/flyctl-actions@master
with:
args: 'deploy --remote-only --config fly.toml --dockerfile Dockerfile --env HOST="regex.help" --env GIT_SHA="${{ github.sha }}"'