Merge branch 'develop' into feat/nx-cloud/setup #105
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
on: | |
push: | |
paths: ['apps/api/**', '.github/workflows/api.yaml'] | |
pull_request: | |
paths: ['apps/api/**'] | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
name: Validate | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install packages | |
run: | | |
pnpm i | |
- name: Lint | |
run: | | |
pnpm run lint:api | |
- name: Unit tests | |
run: | | |
pnpm run db:generate-types | |
pnpm run test:api | |
- name: E2E tests | |
env: | |
GITHUB_CLIENT_ID: dummy | |
GITHUB_CLIENT_SECRET: dummy | |
GITHUB_CALLBACK_URL: dummy | |
run: | | |
docker compose up -d | |
pnpm run e2e:api | |
docker compose down | |
build-api-alpha: | |
needs: validate | |
runs-on: ubuntu-latest | |
name: Build and push API docker image for alpha | |
if: ${{ startsWith(github.ref , 'refs/tags/') && contains(github.ref, 'alpha') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build Docker image | |
run: docker build -t keyshade/keyshade-api:${{ github.ref_name }} keyshade/keyshade-api:alpha-latest -f ./apps/api/Dockerfile . | |
- name: Push Docker image | |
run: docker push keyshade/keyshade-api | |
build-api-release: | |
needs: validate | |
runs-on: ubuntu-latest | |
name: Build and push API docker image for release | |
if: ${{ startsWith(github.ref , 'refs/tags/') && !contains(github.ref, 'alpha') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build Docker image | |
run: docker build -t keyshade/keyshade-api:${{ github.ref_name }} keyshade/keyshade-api:latest -f ./apps/api/Dockerfile . | |
- name: Push Docker image | |
run: docker push keyshade/keyshade-api |