/ci-action

Continious Integration action for go- and node- projects

Primary LanguageJavaScriptMIT LicenseMIT

ci-action

Continious Integration action for go- and node- projects

  • Reject ".*" folders
  • Reject sources which do not have "Copyright" word in first comment
  • Reject sources which have LICENSE word in first comment but LICENSE file does not exist
  • Reject go.mod with local replaces
  • For Go projects
    • Run go build ./... and go test ./...
  • For Node.js projects
    • Run npm install, npm run build --if-present and npm test
  • Publish Release (only for "master" branch if publish-asset property is set)

Usage

- uses: untillpro/ci-action@master
  with:
    # Folders and files that will be ignored when checking (comma separated)
    ignore: ''

    # The name of the organization on GitHub containing private repositories
    organization: 'untillpro'

    # Auth token used to fetch dependencies from private repositories
    token: ''

    # Codecov token
    codecov_token: ''

    # File / dir name to publish
    publish-asset: ''

    # Auth token used to publish
    publish-token: ${{ github.token }}

    # Number of kept releases (0 - all)
    publish-keep: 8

    # Repository name with owner. For example, untillpro/ci-action
    repository: ${{ github.repository }}

Scenarios

Go project

  • If private modules are used:
  • For automatic uploading reports to [Codecov] Codecov
    • Create secret with Codecov token named "CODECOV_TOKEN"
  • Create action workflow "ci.yml" with the following contents:
name: CI-Go
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Set up Go 1.13
      uses: actions/setup-go@v1
      with:
        go-version: 1.13
    - name: Checkout
      uses: actions/checkout@v2
    - name: Cache Go - Modules
      uses: actions/cache@v1
      with:
        path: ~/go/pkg/mod
        key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
        restore-keys: |
          ${{ runner.os }}-go-
    - name: CI
      uses: untillpro/ci-action@master
      with:
        token: ${{ secrets.REPOREADING_TOKEN }}
        codecov-token: ${{ secrets.CODECOV_TOKEN }}

Node.js project

  • For automatic uploading reports to [Codecov] Codecov
    • Create secret with Codecov token named "CODECOV_TOKEN"
  • Create action workflow "ci.yml" with the following contents:
name: CI-Node.js
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Set up Node.js 12.x
      uses: actions/setup-node@v1
      with:
        node-version: '12.x'
    - name: Checkout
      uses: actions/checkout@v2
    - name: Cache Node - npm
      uses: actions/cache@v1
      with:
        path: ~/.npm
        key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
        restore-keys: |
          ${{ runner.os }}-node-
    - name: CI
      uses: untillpro/ci-action@master
      with:
        codecov-token: ${{ secrets.CODECOV_TOKEN }}

Development

Install the dependencies

npm install

Run the tests

npm test

Run package

npm run package

License

The scripts and documentation in this project are released under the MIT License