Abstruse uses a personal access token to communicate with GitHub. We need to create one.
Login to GitHub and navigate to Setting/Developer settings/Personal access tokens
Click on Generate new Token
. We only need access to repo
Click on Generate token
and save the token
On Abstruse navigate to the provider's page. Click on the profile picture and select Providers
Click on Add Provider
Select the GitHub provider and paste the access token to the field. Copy the generated secret that will be needed in the next step. Click Save
.
Go to Abstruse and navigate to the Repositories
page and turn on the repository
To add a webhook, login to GitHub and navigate to repository and then Settings/Webhooks
Click on Add webhook
Under Payload URL add the URL to your Abstruse and attach the /webhooks
path to it https://demo.abstruse.io/webhooks
Under Secret paste the secret from the previous step
Under Which events would you like to trigger this webhook? select Let me select individual events.
and check Branch or tag creation, Branch or tag deletion, Pull requests and Pushes
Click Add webhook
In order to protect the master branch with Abstruse, login to GitHub and navigate to the repository and then Settings/Branches
Click on Add Role
. Type in master
as the branch and check Require status checks to pass before merging and Require branches to be up to date before merging. In search field type continuous-integration and click on continuous-integration.
NOTE: If the continuous-integration checkbox is not visible, we need to manually trigger a build. Go to Abstruse and go to repository settings by clicking on the repository and then settings:
add .abstruse.yml
content from step 6. to config and click Trigger build
. Repeat step 5.
We are good to go. Here is a simple example on how to test everything. Create a PR with these two files in the root of the project:
Makefile
:
test:
@echo "testing..."
.PHONY: test
.abstruse.yml
:
image: golang:1.15
matrix:
- env: CMD=test
script:
- if [[ "$CMD" ]]; then make $CMD; fi