Github Actions
CI

CI

What does CI mean

In written form it is Continuous Integration It checks if your code is ready for integration for test and staging environments. Those 3 steps are usually done:

  1. Dependencies are installed
  2. The code is built
  3. The tests in the code are ran

Example in practice

  1. With the on we are saying, that when something is pushed to the main branch or if a pll request is opened on github, it should start running the pipeline
  2. In jobs we say what should be executed. In future you will see more of these jobs
  3. In build job we got our steps, so everything which needs to be ran. In this case it will run on ubuntu 22.04 and it will get the code, setup node js, install dependencies, build the application and than run a ls of the folder
name: CI Refcard
 
on:
    push:
        branches:
            - main
    pull_request:
        types: [opened, reopened]
 
jobs:
    build:
        runs-on: ubuntu-22.04 ## Job machine uses specific version, as latest might cause newer ubuntu versions, which might break the code compatibility
        steps:
            - uses: actions/checkout@v4
            - name: Use Node.js
              uses: actions/setup-node@v4
              with:
                  node-version: '20.x'
            - run: npm i
            - run: npm run build
            - run: ls -la build