-
Notifications
You must be signed in to change notification settings - Fork 11
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
Enhancement: Add a simple workflow to get started with GitHub Actions #27
Conversation
63955b9
to
7421db8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you can see in the Checks tab, a workflow has not been triggered.
This is because the workflow was added from a fork, and a workflow does not exist in the repository yet.
In case you accept this pull request, a workflow will run on the merge commit. Subsequent changes to the workflow will have an effect once the workflow is available in the default branch.
You can see the workflow running in my fork.
@@ -1,5 +1,6 @@ | |||
/.github export-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding .github
here because users of this package probably do not need the contents of the .github
directory.
@@ -0,0 +1,19 @@ | |||
# https://docs.github.com/en/actions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a reference to the GitHub Actions documentation here so anyone making changes to the workflow file can easily look it up.
@@ -0,0 +1,19 @@ | |||
# https://docs.github.com/en/actions | |||
|
|||
name: Build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the name of the workflow as it will appear in the GitHub UI:
-
in the Actions tab of the repository
-
in the Checks tab for the pull request
-
in the list of status checks for a pull request
The name used here will also need to be used when linking to a status badge (see README.md
below).
πββοΈ For reference, see
|
||
name: Build | ||
|
||
on: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using on
we can configure a list of events that can trigger a workflow.
πββοΈ For reference, see
name: Build | ||
|
||
on: | ||
pull_request: null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Listing pull_request
here so we run the workflow on default pull_request
events.
These events include:
opened
(a pull request was opened)reopened
(a pull request was reopened)synchronize
(one or more commits have been pushed into the corresponding branch)
πββοΈ For reference, see
hello: | ||
name: Hello | ||
|
||
runs-on: ubuntu-latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using runs-on
we can specify the system on which the job should run.
The system can be one of:
ubuntu-16.04
ubuntu-18.04
(orΒubuntu-latest
)ubuntu-20.04
ubuntu-latest
(orΒubuntu-18.04
)macos-10.15
Β (orΒmacos-latest
)macos-latest
Β (orΒmacos-10.15
)windows-2019
(orwindows-latest
)windows-latest
(orwindows-2019
)
πββοΈ For reference, see
|
||
runs-on: ubuntu-latest | ||
|
||
steps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each job consists of a series of steps. Every job needs to have at least one step.
πββοΈ For reference, see
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Echo a greeting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A job can have a name, which will then be displayed in the output of the workflow run. The name can be omitted.
It is possible to use variables in the name, they will then be expanded (more on that later).
πββοΈ For reference, see
|
||
steps: | ||
- name: Echo a greeting | ||
run: echo 'Hello, GitHub Actions!' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A job can have a run
or a uses
directive.
With the run
directive we can configure one or more commands to run on the command line.
πββοΈ For reference, see
@@ -1,6 +1,7 @@ | |||
# Version | |||
|
|||
[![Build Status](https://travis-ci.com/nikolaposa/version.svg?branch=master)](https://travis-ci.com/nikolaposa/version) | |||
[![Build](/~https://github.com/nikolaposa/version/workflows/Build/badge.svg?branch=master)](/~https://github.com/nikolaposa/version/actions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a badge here.
Note that Build
in the URL refers to the name of the workflow. When the name of the workflow contained spaces, they would need to be URL-encoded.
For example:
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 958cb47..aa1a9dc 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -1,6 +1,6 @@
# https://docs.github.com/en/actions
-name: Build
+name: Continuous Integration
on:
pull_request: null
diff --git a/README.md b/README.md
index 7ed172e..f4d7ca8 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# Version
[![Build Status](https://travis-ci.com/nikolaposa/version.svg?branch=master)](https://travis-ci.com/nikolaposa/version)
-[![Build](/~https://github.com/nikolaposa/version/workflows/Build/badge.svg?branch=master)](/~https://github.com/nikolaposa/version/actions)
+[![Build](/~https://github.com/nikolaposa/version/workflows/Continous%20Integration/badge.svg?branch=master)](/~https://github.com/nikolaposa/version/actions)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nikolaposa/version/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/nikolaposa/version/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/nikolaposa/version/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/nikolaposa/version/?branch=master)
[![Latest Stable Version](https://poser.pugx.org/nikolaposa/version/v/stable)](https://packagist.org/packages/nikolaposa/version)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like where this is going, thank you very much for willing to contribute and putting effort into this work. π I can already see benefits of moving to GitHub Actions, the most obvious is more natural "Checks" tab.
I am glad you like it! I'm prepared to follow up, as promised! π€ |
@localheinz Thanks! So what do you think should be the next steps? I suppose this was a PR with demonstrative purposes, do you think we should merge it anyway? |
π Let's merge it, and then I will follow up! |
Thank you, @nikolaposa! |
This PR
πββοΈ This is part 1 of a series of pull requests, as suggested here: