-
Notifications
You must be signed in to change notification settings - Fork 1
134 lines (113 loc) · 3.72 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
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
name: Test and Deploy
on:
push:
branches:
- "main"
- "development"
pull_request:
jobs:
test:
name: Tests
runs-on: ubuntu-latest
concurrency:
group: flow-test-${{ github.ref }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
php: ["8.2"]
composer: ["v2"]
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: true
- name: Checkout Discord Service
uses: actions/checkout@v4
with:
repository: ecfmp/discord
path: ecfmp-discord
- name: Move Discord Service
run: mv ecfmp-discord ../ecfmp-discord
- name: Build Protobuf
run: (cd protobuf && make pull_builder && make discord_proto)
- name: Configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: pcov
tools: composer:${{ matrix.composer }}
extensions: grpc
# Setting up composer dependencies
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Restore Composer Cache
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer Dependencies
run: composer install --prefer-dist --no-interaction --optimize-autoloader --no-suggest
# Setting up NPM dependencies
- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v3
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: NPM Build
run: |
npm ci
npm run build
cat public/build/manifest.json # See asset versions in log
- name: Copy Env
run: cp .env.example .env
- name: Cache Docker Images
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ hashFiles('docker-compose.yml', '.env.example') }}
- name: Build and Start Containers
run: ./vendor/bin/sail up -d
- name: Generate Application Key
run: ./vendor/bin/sail artisan key:generate
- name: Migrate Database
run: ./vendor/bin/sail artisan migrate
- name: Run Tests
run: ./vendor/bin/sail artisan test
release:
name: "Release"
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main')
needs: [ test ]
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Semantic Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
update-deploy-reference:
name: "Trigger Docker Build"
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/development' || github.ref == 'refs/heads/main')
needs: [ test ]
steps:
- name: Dispatch
uses: benc-uk/workflow-dispatch@v1
with:
workflow: build.yml
repo: ECFMP/flow_docker
token: ${{ secrets.DOCKER_WORKFLOW_TOKEN }}