Skip to content

Commit

Permalink
refactor: optimize GitHub Actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
PleBea committed Oct 16, 2024
1 parent ded3034 commit ba4b74a
Showing 1 changed file with 54 additions and 54 deletions.
108 changes: 54 additions & 54 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ name: Test

on:
push:
branches: [ master, release ]
branches: [master, release]
pull_request:

env:
# Environments
NODE_ENV: ${{ vars.NODE_ENV }}

DB_HOST: ${{ vars.DB_HOST }}
DB_PORT: ${{ vars.DB_PORT }}
DB_NAME: ${{ vars.DB_NAME }}
DB_USERNAME: ${{ vars.DB_USER }}
DB_PASSWORD: ${{ vars.DB_PASSWORD }}

JWT_SECRET: ${{ vars.JWT_SECRET }}
JWT_EXPIRES_IN: ${{ vars.JWT_EXPIRES_IN }}

ACCESS_TOKEN_SECRET: ${{ vars.ACCESS_TOKEN_SECRET }}
ACCESS_TOKEN_EXPIRES_IN: ${{ vars.ACCESS_TOKEN_EXPIRES_IN }}

REFRESH_TOKEN_SECRET: ${{ vars.REFRESH_TOKEN_SECRET }}
REFRESH_TOKEN_EXPIRES_IN: ${{ vars.REFRESH_TOKEN_EXPIRES_IN }}

CORS_ORIGIN: ${{ vars.CORS_ORIGIN }}
CORS_METHODS: ${{ vars.CORS_METHODS }}

Expand All @@ -50,65 +50,65 @@ jobs:
matrix:
node-version: [14.x, 16.x, 18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn global add lerna
- run: lerna bootstrap
- run: lerna run test
- name: Archive npm failure logs
uses: actions/upload-artifact@v2
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- run: yarn global add lerna
- run: lerna bootstrap
- run: lerna run test
- name: Archive npm failure logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs
lint:
runs-on: ubuntu-latest
environment: development
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: echo $ACCESS_TOKEN_SECRET
- run: yarn global add lerna
- run: lerna bootstrap
- run: lerna run lint
- name: Archive npm failure logs
uses: actions/upload-artifact@v2
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- run: echo $ACCESS_TOKEN_SECRET
- run: yarn global add lerna
- run: lerna bootstrap
- run: lerna run lint
- name: Archive npm failure logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs

build:
needs: [ jest, lint ]
needs: [jest, lint]
runs-on: ubuntu-latest
environment: production
strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 19.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn global add lerna
- run: lerna bootstrap
- run: lerna run build
- name: Archive npm failure logs
uses: actions/upload-artifact@v2
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- run: yarn global add lerna
- run: lerna bootstrap
- run: lerna run build
- name: Archive npm failure logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: npm-logs
path: ~/.npm/_logs

0 comments on commit ba4b74a

Please sign in to comment.