Merge pull request #3 from djengua/task/add-static-check #48
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
name: CI Checks | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
needs: | |
- format-check | |
- lint | |
name: Test Application | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ^1.2 | |
- name: Check out code into hte Go module directory | |
uses: actions/checkout@v2 | |
- name: Run Test | |
run: make test | |
- name: Coverage Check | |
run: make coverage | |
- name: Generate Report | |
run: make report | |
- name: Copy Files | |
run: | | |
mkdir reports | |
cp cover.html reports/. | |
- name: Archive | |
uses: actions/upload-artifact@v2 | |
with: | |
name: reports | |
path: reports | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Lint | |
uses: golangci/golangci-lint-action@v2 | |
deliver: | |
name: Release | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Download binay | |
uses: actions/download-artifact@v2 | |
with: | |
name: api | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
body: Still in experimentation phase | |
draft: true | |
prerelease: true | |
- name: Upload Release Binary | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} | |
with: | |
upload_url: ${{steps.create_release.outputs.upload_url}} | |
asset_path: api | |
asset_name: api | |
asset_content_type: application/octet-stream | |
build: | |
needs: test | |
name: Build App | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ^1.2 | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Build | |
run: make build | |
- name: Copy files | |
run: | | |
mkdir artifacts | |
cp api artifacts/. | |
- name: Archive | |
uses: actions/upload-artifact@v2 | |
with: | |
name: api | |
path: artifacts | |
format-check: | |
name: Check formatting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ^1.2 | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Run Format Check | |
run: make check-format | |
- name: Vet | |
uses: make vet | |
# deploy-paas: | |
# name: Deploy PaaS | |
# runs-on: ubuntu-latest | |
# needs: test | |
# steps: | |
# - name: Check out cod einto the Go module directory | |
# uses: actions/checkout@v2 | |
# with: | |
# fetch-depth: 0 | |
# - id: auth | |
# uses: google-github-actions/auth@v2 | |
# with: | |
# project_id: djengua-203420 | |
# credentials_json: ${{ secrets.GCP_CREDENTIALS_2 }} | |
# export_default_credentials: true | |
# - id: deploy | |
# uses: google-github-actions/deploy-appengine@v1 | |
# with: | |
# creedentials: ${{ secrets.GCP_CREDENTIALS_2 }} | |
# - id: test | |
# run: curl "${{ steps.deploy.outputs.url }}/hello" |