Notes for CI/CD Pipeline:
Architecture:
- Event: Events trigger workflows. Ex: push, pull-request.
- Workflow: A workflow is like a pipeline. It is composed of one or many jobs
- Runner: A physical or virtual hardware where the code for a workflow is executed. Each job can be executed on a different runner.
- Jobs: Jobs aggregate steps and define which runner to execute them on
Getting familiar with GitHub action clauses/keywords
- On: The on keyword and the lines that follow it define which types of triggers the workflow will match on and start executing
- Name: To define the name of the step or a Job
- Jobs: Composed of one or more steps
- Steps: Steps are the basic unit of execution. They consist of either invocations of predefined actions or a shell command to be run on the runner
- Uses: For pulling pre-defined actions from the internet (similar to using APIs that do the job for us).
- With: To pass parameters as an input to pre-defined action defined in the "Uses" clause
- Run: To execute shell commands
Workflow setup:
- Workflow files are written in YAML, and they must be located in the .github/workflows directory
Workflow of htsjdk-igb pipeline:
You can find the workflow file of htsjdk-igb here.
- This workflow gets triggered for push or pull-request event (The branch prefix must start with "igb-*".)
- GitHub provides an OS to execute the workflow ( look for runs-on step)
- actions/checkout@v3: pre-defined action for checking out a repo
- actions/setup-java@v3: pre-defined action to set up Java environment. This action requires input parameters, such as Java version and distribution, which are sent using the "with" clause.
- Now, the environment set-up is ready to build the project. The ./gradlew build -x test command is executed in run step
- Implemented a verification step to ensure the build/libs directory contains all jars, including Source and Java Doc.
Downloading Jars:
- After a successful build, you can able to view and download the artifact(see image).