Skip to content

Commit

Permalink
Merge pull request #2 from im-juma-training-sb/jumainfomagnus-patch-2
Browse files Browse the repository at this point in the history
Update ci.yaml
  • Loading branch information
jumainfomagnus authored Oct 4, 2024
2 parents 0a1882c + afddd03 commit 8a557fd
Showing 1 changed file with 40 additions and 37 deletions.
77 changes: 40 additions & 37 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,52 @@
name: CI Workflow Demo
name: 07-1. CI Workflow

on:
push:

# Trigger CI for every PR event, when PR has target branch = main
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
# The first job lints the code base
lint:
uses: githubabcs/gh-abcs-actions/.github/workflows/super-linter.yml@main

# CI job to run a test suite on the code base
ci:
name: CI
runs-on: ${{ matrix.os }}
# We want to test across mutiple OSs, defined by our matrix
runs-on: ${{ matrix.os }}
needs: lint
strategy:
fail-fast: true
# Cancel all matrix jobs if one of them fails
fail-fast: true
matrix:
node-version: [12, 14, 16]
os: [macos-latest, windows-latest, ubuntu-latest]
# our matrix for testing across node versions and OSs
node-version: [12, 14]
os: [windows-2019, ubuntu-20.04, ubuntu-22.04]

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

# Configure our node environment according to matrix
- name: Setup node ${{ matrix.node-version }} on ${{ matrix.os }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Setup node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Run test suite
run: |
echo npm ci
echo npm run build --if-present
echo npm test
- name: Run test suite
run: |
echo npm ci
echo npm run build --if-present
echo npm test
# Add here the upload-artifact action

- shell: bash
run: |
echo 'Test upload artifact' > output.log
- name: Upload output file
uses: actions/upload-artifact@v4
with:
name: output-log-file
path: output.log


# If both linting and CI succeeds we want to deploy the code to a test environment
deploy-test:
name: Deploy to test env
runs-on: ubuntu-latest
Expand All @@ -53,13 +58,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: output-log-file


# Add here the download-artifact step





# Placeholder - this step would be some action or run commands that deploys the code
- name: Deploy to test env
if: ${{ success() }}
run: |
echo "Deploying to test environment"

0 comments on commit 8a557fd

Please sign in to comment.