-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #357 from bblfsh/add-workflow
chore: add github action workflow
- Loading branch information
Showing
5 changed files
with
226 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Check | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.19 | ||
|
||
- name: Test | ||
run: go test -v -coverprofile=coverage.txt -covermode=atomic ./... | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
|
||
- name: coverage | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
flags: unittests | ||
fail_ci_if_error: false # optional (default = false) | ||
verbose: false # optional (default = false) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
on: | ||
pull_request: | ||
types: closed | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Tag and prepare release | ||
id: tag_and_prepare_release | ||
uses: K-Phoen/semver-release-action@master | ||
with: | ||
release_branch: main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload release notes | ||
if: steps.tag_and_prepare_release.outputs.tag | ||
uses: Roang-zero1/github-create-release-action@v3 | ||
with: | ||
created_tag: ${{ steps.tag_and_prepare_release.outputs.tag }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build variables | ||
id: build_var | ||
run: | | ||
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/} | ||
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} | ||
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} | ||
echo ::set-output name=BUILD_DATE::$(date -u +"%Y-%m-%dT%H:%M:%SZ") | ||
echo ::set-output name=PROJECT_URL::${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} | ||
echo ::set-output name=VCS_REF::$GITHUB_SHA | ||
- name: Build and push Docker images | ||
id: docker_build | ||
uses: docker/build-push-action@v4 | ||
with: | ||
push: true | ||
build-args: | | ||
VERSION=${{ steps.tag_and_prepare_release.outputs.tag }} | ||
VCS_REF=${{ steps.build_var.outputs.VCS_REF }} | ||
BUILD_DATE=${{ steps.build_var.outputs.BUILD_DATE }} | ||
PROJECT_URL=${{ steps.build_var.outputs.PROJECT_URL }} | ||
tags: | | ||
w6dio/bblfshd:${{ steps.tag_and_prepare_release.outputs.tag }} | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Enforce PR labels | ||
|
||
on: | ||
pull_request: | ||
types: [labeled, unlabeled, opened, edited, synchronize] | ||
jobs: | ||
enforce-label: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: yogevbd/[email protected] | ||
with: | ||
REQUIRED_LABELS_ANY: "major,minor,patch" | ||
REQUIRED_LABELS_ANY_DESCRIPTION: "Select at least one label ['major','minor','patch']" | ||
BANNED_LABELS: "banned" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Release latest docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
|
||
- name: Build variables | ||
id: build_var | ||
run: | | ||
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/} | ||
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} | ||
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} | ||
echo ::set-output name=BUILD_DATE::$(date -u +"%Y-%m-%dT%H:%M:%SZ") | ||
echo ::set-output name=PROJECT_URL::${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} | ||
echo ::set-output name=VCS_REF::$GITHUB_SHA | ||
- name: Build and push Docker images | ||
id: docker_build | ||
uses: docker/build-push-action@v4 | ||
with: | ||
push: true | ||
build-args: | | ||
VERSION=${{ steps.build_var.outputs.SOURCE_BRANCH }} | ||
VCS_REF=${{ steps.build_var.outputs.VCS_REF }} | ||
BUILD_DATE=${{ steps.build_var.outputs.BUILD_DATE }} | ||
PROJECT_URL=${{ steps.build_var.outputs.PROJECT_URL }} | ||
tags: | | ||
w6dio/bblfshd:latest | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Release docker image | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build variables | ||
id: build_var | ||
run: | | ||
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/} | ||
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} | ||
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} | ||
echo ::set-output name=BUILD_DATE::$(date -u +"%Y-%m-%dT%H:%M:%SZ") | ||
echo ::set-output name=PROJECT_URL::${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} | ||
echo ::set-output name=VCS_REF::$GITHUB_SHA | ||
- name: Build and push Docker images | ||
id: docker_build | ||
uses: docker/build-push-action@v4 | ||
with: | ||
push: true | ||
build-args: | | ||
VERSION=${{ steps.build_var.outputs.SOURCE_TAG }} | ||
VCS_REF=${{ steps.build_var.outputs.VCS_REF }} | ||
BUILD_DATE=${{ steps.build_var.outputs.BUILD_DATE }} | ||
PROJECT_URL=${{ steps.build_var.outputs.PROJECT_URL }} | ||
tags: | | ||
w6dio/bblfshd:${{ steps.build_var.outputs.SOURCE_TAG }} | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |