-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (117 loc) · 4.26 KB
/
Copy pathdeploy.yml
File metadata and controls
139 lines (117 loc) · 4.26 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Test & Deploy
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PubkeyAcceptedKeyTypes=+ssh-rsa"
DOCKER_REGISTRY_IMAGE: ghcr.io/fortrabbit/testrabbit
on:
push:
jobs:
test:
runs-on: ubuntu-22.04
strategy:
matrix:
php-version: ['8.3','8.4','8.5']
steps:
- uses: actions/checkout@v3
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker image using Github Packages as cache
env:
PHP_VERSION: ${{ matrix.php-version }}
run: |
docker build \
--file docker/Dockerfile \
--build-arg PHP_VERSION=${PHP_VERSION} \
--tag $DOCKER_REGISTRY_IMAGE:${PHP_VERSION} \
.
- name: Run application tests
env:
PHP_VERSION: ${{ matrix.php-version }}
run: docker run --rm $DOCKER_REGISTRY_IMAGE:${PHP_VERSION} php artisan test
# - name: Cache vendor folder
# uses: actions/cache@v3
# with:
# path: vendor
# key: vendor-${{ matrix.php-version }}-${{ hashFiles('composer.lock') }}
# - name: Install dependencies
# run: |
# docker run --rm \
# -v $PWD:/var/www/html \
# $DOCKER_REGISTRY_IMAGE:${{ matrix.php-version }} \
# bash -c '\
# composer config -g github-oauth.github.com ${{ secrets.ACTIONS_TOKEN }} && \
# composer install --no-interaction --prefer-dist --no-scripts --no-cache'
usx:
runs-on: ubuntu-22.04
needs: test
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# fetch all history so we can push to remotes
fetch-depth: 0
- name: Setup SSH Keys and known_hosts
run: |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<EOF
${{ secrets.SSH_PRIVATE_KEY }}
EOF
ssh-add -l
- name: 'Run deployment to testrabbit-pro'
run: |
git push --force testrabbit-pro@deploy.usx.frbit.com:testrabbit-pro.git HEAD:master
- name: 'Run deployment to testrabbit-uni'
run: |
git push --force testrabbit-uni@deploy.usx.frbit.com:testrabbit-uni.git HEAD:master
eu2:
runs-on: ubuntu-22.04
needs: test
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# fetch all history so we can push to remotes
fetch-depth: 0
- name: Setup SSH Keys and known_hosts
run: |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<EOF
${{ secrets.SSH_PRIVATE_KEY }}
EOF
ssh-add -l
- name: 'Run deployment to testrabbit-pro'
run: |
git push --force testrabbit-pro@deploy.eu2.frbit.com:testrabbit-pro.git HEAD:master
#echo "slack_environment=EU2" >> $GITHUB_ENV
- name: 'Run deployment to testrabbit-uni'
run: |
git push --force testrabbit-uni@deploy.eu2.frbit.com:testrabbit-uni.git HEAD:master
us1:
runs-on: ubuntu-22.04
needs: test
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# fetch all history so we can push to remotes
fetch-depth: 0
- name: Setup SSH Keys and known_hosts
run: |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<EOF
${{ secrets.SSH_PRIVATE_KEY }}
EOF
ssh-add -l
- name: 'Run deployment to testrabbit-us1'
run: |
git push --force testrabbit-us1@deploy.us1.frbit.com:testrabbit-us1.git HEAD:master
- name: 'Run deployment to testrabbit-us1-u'
run: |
git push --force testrabbit-us1-u@deploy.us1.frbit.com:testrabbit-us1-u.git HEAD:master