-
Notifications
You must be signed in to change notification settings - Fork 44
117 lines (99 loc) Β· 3.88 KB
/
main.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
name: CI
on:
push: {}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.1.0/bazelisk-linux-amd64"
mkdir -p "${GITHUB_WORKSPACE}/bin/"
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
- name: Enable CI settings
run: |
cat <<EOF >>.bazelrc
common --config=ci
EOF
- name: Add bazel cache secret
if: ${{ github.actor != 'dependabot[bot]' }}
run: |
echo "$GCS_SA_KEY" > key.json
cat <<EOF >>.bazelrc
build:ci --remote_cache=https://storage.googleapis.com/airy-ci-cache
build:ci --google_credentials=key.json
EOF
env:
GCS_SA_KEY: ${{secrets.GCS_SA_KEY}}
- name: Install dependencies
run: yarn install
- name: Run unit testing
run: yarn jest --coverage
- name: Lint
run: |
sudo apt-get install -y shellcheck
./scripts/lint.sh
- name: Test
run: |
bazel test --test_tag_filters=-lint //...
- name: Cleanup space
run: |
df -h
sudo apt-get autoremove -y
sudo apt-get clean
docker images prune -a
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /opt/hostedtoolcache
df -h
- name: Build all artifacts
run: |
bazel build //...
- name: Push images
if: startsWith(github.ref, 'refs/heads/release') || startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/develop')
run: |
echo ${{ secrets.PAT }} | docker login ghcr.io -u airydevci --password-stdin
./scripts/push-images.sh
- name: Upload airy binary to S3
if: ${{ github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/release') || github.ref == 'refs/heads/main' }}
run: |
./scripts/upload-cli-binaries.sh
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
GITHUB_BRANCH: ${{ github.ref }}
- name: Publish helm charts
if: startsWith(github.ref, 'refs/heads/release') || startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/develop')
run: |
./scripts/push-helm-charts.sh
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION : ${{ secrets.AWS_REGION }}
GITHUB_BRANCH: ${{ github.ref }}
HELM_REPO_USERNAME: ${{ secrets.HELM_REPO_USERNAME }}
HELM_REPO_PASSWORD: ${{ secrets.HELM_REPO_PASSWORD }}
- name: Publish http-client library to npm
if: ${{ startsWith(github.ref, 'refs/heads/main') }}
run: |
sudo apt-get install -y expect
bazel run //lib/typescript/httpclient:publish-npm release
env:
DEPLOY_NPM_USERNAME: ${{ secrets.DEPLOY_NPM_USERNAME }}
DEPLOY_NPM_TOKEN: ${{ secrets.DEPLOY_NPM_TOKEN }}
DEPLOY_NPM_EMAIL: ${{ secrets.DEPLOY_NPM_EMAIL }}
- name: Publish chat-plugin library to npm
if: ${{ startsWith(github.ref, 'refs/heads/main') }}
run: |
sudo apt-get install -y expect
bazel run //frontend/chat-plugin/lib:publish-npm release
env:
DEPLOY_NPM_USERNAME: ${{ secrets.DEPLOY_NPM_USERNAME }}
DEPLOY_NPM_TOKEN: ${{ secrets.DEPLOY_NPM_TOKEN }}
DEPLOY_NPM_EMAIL: ${{ secrets.DEPLOY_NPM_EMAIL }}