Skip to content

Instantly share code, notes, and snippets.

@SomajitDey
Last active April 11, 2024 05:19
Show Gist options
  • Save SomajitDey/d14eb5dd7bcd79f3f14d1a7429b515af to your computer and use it in GitHub Desktop.
Save SomajitDey/d14eb5dd7bcd79f3f14d1a7429b515af to your computer and use it in GitHub Desktop.
How to setup Continuous Integration with GitHub Actions
name: Build
run-name: Building current project using GitHub Actions
on: [push]
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Installing fortdepend
run: sudo pip3 install fortdepend
- name: Installing ifort
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
sudo apt-get install intel-oneapi-compiler-fortran
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV
- name: Building with FC=gfortran OMP=
run: make
- name: ReBuilding with FC=ifort OMP=
run: make rebuild FC=ifort
  • Give your Personal Access Token (PAT) access to workflow.
  • Put the accompanying build.yml inside .github/workflows path inside your repository. Edit it as required. You may check the validity of the yaml file online.
  • On top of your repository's README.md, put the following badge:
[![CI Build Status](https://github.com/<OWNER>/<REPO>/actions/workflows/build.yml/badge.svg)](https://github.com/<OWNER>/<REPO>/actions/workflows/build.yml)
  • Add, Commit and Push
  • See results of GitHub Actions @ https://github.com/<OWNER>/<REPO>/actions/workflows/build.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment