This repository has been archived by the owner on Dec 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
122 lines (102 loc) · 3.07 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
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
name: CI
on:
push:
branches:
- "**"
pull_request:
branches:
- staging
release:
types:
- published
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
mongodb-version: ['5.0']
env:
GO111MODULE: on
steps:
- name: checkout code
uses: actions/checkout@v2
- name: go caching
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: install go
uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: ${{ matrix.mongodb-version }}
mongodb-replica-set: test-rs
- name: check fmt
run: bash -c "[ $(make fmt | wc -l) == 0 ]"
- name: build api
run: make all
- name: run unit tests
run: make test
- name: run E2E tests
run: make integration-test
- name: upload binary
if: "github.ref == 'refs/heads/master' || github.event_name == 'release'"
uses: actions/upload-artifact@v3
with:
name: hackillinois-binary
path: bin/
deploy:
runs-on: ubuntu-20.04
needs: [build]
if: "github.ref == 'refs/heads/master' || github.event_name == 'release'"
steps:
- uses: actions/checkout@v3
- name: install python
uses: actions/setup-python@v4
with:
python-version: "3.6"
cache: "pip"
- name: install dependencies
run: pip install -r documentation/requirements.txt
- name: download hackillinois-binary
uses: actions/download-artifact@v3
with:
name: hackillinois-binary
path: bin/
- name: using release version as container tag (release build only)
if: "github.event_name == 'release'"
run: echo "CONTAINER_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
- name: build docs and docker container
run: |
make docs
make container TAG=$CONTAINER_TAG
- name: push docs to s3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: hackillinois-api-docs
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1'
SOURCE_DIR: 'documentation/site'
- name: push docker container to dockerhub
run: make container-push TAG=$CONTAINER_TAG
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
deploy-aws:
if: "github.ref == 'refs/heads/master' || github.event_name == 'release'"
needs: [deploy]
uses: "./.github/workflows/deployment.yml"
secrets: inherit