Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Github Actions CI functionality #1

Open
wants to merge 41 commits into
base: master
Choose a base branch
from

Conversation

vreshniak
Copy link
Member

@vreshniak vreshniak commented Oct 2, 2020

This PR sets this repository to perform CI testing for the xsdk-project/spack-xsdk repo. As Github requires all CI workflow files to be present in the .github directory of the default branch of the repository, this separation allows to avoid stomping on spack's CI settings.
However, this approach only allows to trigger tests manually (Manually running workflow) or on schedule.

Several files are added:

  1. .github/workflows/github-linux.yaml is an example of the workflow file to build xsdk on GitHub hosted linux runner
  2. .github/workflows/github-macos.yaml is an example of the workflow file to build xsdk on GitHub hosted osx runner
  3. action.yml is the action script which provides functionality of the test
  4. README.md shows badges for build status of each workflow

Additional workflow files should be added when needed.

In GitHub, each workflow is a combination of jobs, jobs contain steps, steps can run actions.

To add new tests:

  • one should create a new workflow file for each new (self-hosted) runner and add new job(s). Example of the workflow file:
name: github-linux

env:
  xsdk-repo: xsdk-project/spack-xsdk
  xsdk-branch: xsdk-0.6.0 #develop


# Controls when the action will run
on:
  # trigger the workflow manually
  workflow_dispatch:
  # # trigger the workflow on schedule
  # # https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#scheduled-events
  # schedule:
  #   - cron:  '* * * * *'

  github-ubuntu: # job name
    runs-on: ${{ matrix.runner }}
    continue-on-error: false
    strategy:
      matrix:
        runner: [ubuntu-latest] # tags for the runner, machine name is a good option
        compiler: [gcc] # list of compilers to test
    steps:
      - uses: actions/checkout@v2
        with:
          repository: ${{ env.xsdk-repo }}
          ref: ${{ env.xsdk-branch }}
      - uses: xsdk-project/xsdk-ci-test@master
        with:
          cmd: './bin/spack install xsdk%${{ matrix.compiler }}'
  • Each job can generate a job matrix with different build parameters
    strategy:
      matrix:
        runner: [ubuntu-latest] # tags for the runner, machine name is a good option
        compiler: [gcc] # list of compilers to test
  • Besides the optional job matrix, it is only required to specify the build command for the job
cmd: './bin/spack install xsdk%${{ matrix.compiler }}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant