-
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (101 loc) · 3.68 KB
/
github-actions.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
name: LeetCode Trip
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Pnpm
uses: pnpm/action-setup@v2
with:
version: latest
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Execute unit tests
run: pnpm run test
- name: Pre compilation
run: pnpm run build
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./lcov.info,./clover.xml
directory: ./coverage/
verbose: true
# テスト成功時はこちらのステップが実行される
- name: Slack Notification on Success at Testing Stage
if: success()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOKS }}
SLACK_CHANNEL: github-actions
SLACK_TITLE: Test Success
SLACK_COLOR: good
SLACK_FOOTER: 'Powered by Yancey Inc. and its affiliates.'
# テスト失敗時はこちらのステップが実行される
- name: Slack Notification on Failure at Testing Stage
uses: rtCamp/action-slack-notify@v2
if: failure()
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOKS }}
SLACK_CHANNEL: github-actions
SLACK_TITLE: Test Failure
SLACK_COLOR: danger
SLACK_FOOTER: 'Powered by Yancey Inc. and its affiliates.'
deployment:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master'
steps:
- name: Copy file via ssh key
uses: easingthemes/ssh-deploy@main
with:
REMOTE_HOST: ${{ secrets.HOST }}
REMOTE_USER: ${{ secrets.USERNAME }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }}
ARGS: "-rlgoDzvc -i --delete"
SOURCE: "build/"
TARGET: /var/www/leetcode-trip
- uses: actions/checkout@v4
- name: Algoria DocSearch Crawler
uses: darrenjennings/algolia-docsearch-action@master
with:
algolia_application_id: ${{ secrets.ALGORIA_APP_ID }}
algolia_api_key: ${{ secrets.ALGORIA_API_KEY }}
file: './algolia-config.json'
# テスト成功時はこちらのステップが実行される
- name: Slack Notification on Success at Deployment Stage
if: success()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOKS }}
SLACK_CHANNEL: github-actions
SLACK_TITLE: Deploy Success
SLACK_COLOR: good
SLACK_FOOTER: 'Powered by Yancey Inc. and its affiliates.'
# テスト失敗時はこちらのステップが実行される
- name: Slack Notification on Failure at Deployment Stage
uses: rtCamp/action-slack-notify@v2
if: failure()
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOKS }}
SLACK_CHANNEL: github-actions
SLACK_TITLE: Deploy Failure
SLACK_COLOR: danger
SLACK_FOOTER: 'Powered by Yancey Inc. and its affiliates.'