-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: unify gh workflows with docker build and argo deploy
- Loading branch information
Showing
2 changed files
with
69 additions
and
55 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,32 +4,90 @@ on: | |
push: | ||
branches: | ||
- develop | ||
|
||
pull_request: | ||
|
||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
runs-on: 'ubuntu-latest' | ||
# build docker image and push to registry | ||
deploy: | ||
runs-on: ubuntu-latest | ||
if: github.ref_name == 'develop' | ||
needs: docker | ||
steps: | ||
- name: Ping ArgoCD | ||
run: | | ||
some curl command | ||
docker: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
steps: | ||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v3 | ||
- name: 'Checkout Project' | ||
uses: 'actions/checkout@v3' | ||
with: | ||
node-version: '16.15' | ||
fetch-depth: 1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
vnguyen/openbeta-graph-api | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=ref,event=pr | ||
type=sha | ||
- name: Build docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
builder: ${{ steps.buildx.outputs.name }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
|
||
# setup basic machine to run all kinds of tests: lint, unit, integration, types | ||
test: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- name: 'Checkout Project' | ||
uses: 'actions/checkout@v3' | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Install Dependencies and lint code | ||
run: yarn install && yarn lint | ||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16.15' | ||
cache: 'yarn' | ||
|
||
- name: Start MongoDB | ||
uses: supercharge/[email protected] | ||
with: | ||
mongodb-version: 5 | ||
mongodb-replica-set: rs0 | ||
|
||
- name: Install dependencies | ||
run: yarn install --immutable | ||
|
||
- name: Lint code | ||
run: yarn lint | ||
|
||
- name: Wait for the database to start | ||
run: wget -qO- https://raw.githubusercontent.com/eficode/wait-for/$WAIT_FOR_VERSION/wait-for | sh -s -- localhost:27017 -- echo "Database is up" | ||
env: | ||
|
@@ -44,8 +102,8 @@ jobs: | |
run: | | ||
docker container restart mongodb | ||
- name: Build and run tests | ||
run: yarn test | ||
env: | ||
NODE_OPTIONS: --experimental-vm-modules | ||
- name: Run tests | ||
run: yarn test --ci | ||
|
||
- name: Build sources | ||
run: yarn build-release --noEmit |