Watch the YouTube video:
First make the directory
mkdir -p .github/workflows/
Add the workflow that runs a single job:
To test multiple versions of Ruby, update the workflow:
The Ruby workflow is inspired by the template.
Here’s a breakdown of what each YAML field does.
name is the workflow name. It’s optional and you can name it whatever you like:
on is the event that triggers the workflow. In our example, git
push triggers our workflow.
To add the
Which is the same thing as:
jobs are the jobs that the workflow runs. In our example, we have a single job named
runs-on is the environment that the workflow runs on. To specify an OS version:
strategy.matrix is the build matrix. In our example, we’re running a job for a single ruby version. To define jobs for multiple ruby versions:
steps are the tasks of a job. In our example, we’re using the GitHub Actions:
actions/checkout checks out the repository and
ruby/setup-ruby sets up the Ruby environment:
Although Travis CI sets default environment variables, we don’t have to set
CI=true for our job since
actions/checkout@v2 does it for us: