This repository has been archived by the owner on Dec 7, 2023. It is now read-only.
Add warning to docs #510
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/mongodb-github-action@1.8.0 | |
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 |