diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..f929d9a7e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,86 @@ +# PR Build +# Builds the PR +name: PR Build + +on: + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number }} + cancel-in-progress: true + +jobs: + # Print variables for logging and debugging purposes + checkEnv: + name: Print Env variables + runs-on: ubuntu-latest + timeout-minutes: 20 + if: ${{ github.event.pull_request.merged == false }} + steps: + - name: Print Env Vars + run: | + echo OC CLI Version: $(oc version) + echo Git Base Ref: ${{ github.base_ref }} + echo Git Change ID: ${{ github.event.number }} + echo Git Pull Request Ref: ${{ github.event.pull_request.head.sha }} + echo Git Event Name: ${{ github.event_name }} + echo Git Event Action: ${{ github.event.action }} + echo Git Branch Ref: ${{ github.head_ref }} + echo PR in Draft: ${{ github.event.pull_request.draft }} + + # Build the APP + buildAPP: + name: Build APP Image + runs-on: ubuntu-latest + timeout-minutes: 20 + if: ${{ github.event.pull_request.merged == false }} + env: + PR_NUMBER: ${{ github.event.number }} + APP_NAME: "biohub-platform-app" + steps: + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 14 + + - name: Checkout Target Branch + uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Install node modules + working-directory: app + run: npm ci + + - name: Run build + working-directory: app + run: npm run build --if-present + + # Build the API + buildAPI: + name: Build API Image + runs-on: ubuntu-latest + timeout-minutes: 20 + if: ${{ github.event.pull_request.merged == false }} + env: + PR_NUMBER: ${{ github.event.number }} + APP_NAME: "biohub-platform-api" + steps: + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 14 + + - name: Checkout Target Branch + uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Install node modules + working-directory: api + run: npm ci + + - name: Run build + working-directory: api + run: npm run build --if-present diff --git a/.github/workflows/deploy.yml b/.github/workflows/deployPr.yml similarity index 100% rename from .github/workflows/deploy.yml rename to .github/workflows/deployPr.yml diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index 88862ce00..19e81c977 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -81,7 +81,7 @@ jobs: - name: Install api dependencies working-directory: api - run: npm install + run: npm ci - name: Run api linter working-directory: api @@ -105,7 +105,7 @@ jobs: - name: Install app dependencies working-directory: app - run: npm install + run: npm ci - name: Run app linter working-directory: app @@ -129,7 +129,7 @@ jobs: - name: Install database dependencies working-directory: database - run: npm install + run: npm ci - name: Run database linter working-directory: database diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 445c7ae0b..8a42aa4cb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -84,7 +84,7 @@ jobs: - name: Install api dependencies working-directory: api - run: npm install + run: npm ci - name: Run api tests with coverage working-directory: api @@ -110,7 +110,7 @@ jobs: - name: Install app dependencies working-directory: app - run: npm install + run: npm ci - name: Run app tests with coverage working-directory: app