summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
Diffstat (limited to '.github')
-rw-r--r--.github/ISSUE_TEMPLATE/bug-report.yml42
-rwxr-xr-x.github/ISSUE_TEMPLATE/bug_report.md38
-rw-r--r--.github/ISSUE_TEMPLATE/config.yml6
-rw-r--r--.github/ISSUE_TEMPLATE/feature-request.yml38
-rwxr-xr-x.github/ISSUE_TEMPLATE/feature_request.md23
-rw-r--r--.github/dependabot.yml5
-rw-r--r--.github/pull_request_template.md3
-rw-r--r--.github/workflows/codeql-analysis.yml45
-rw-r--r--.github/workflows/linters.yml18
-rw-r--r--.github/workflows/linux.yml77
-rw-r--r--.github/workflows/release.yml168
-rw-r--r--.github/workflows/release_grpc.yml119
-rw-r--r--.github/workflows/tests.yml157
13 files changed, 513 insertions, 226 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml
deleted file mode 100644
index 35b55737..00000000
--- a/.github/ISSUE_TEMPLATE/bug-report.yml
+++ /dev/null
@@ -1,42 +0,0 @@
-name: Bug Report
-description: 🐛 File a bug report
-title: "[🐛 BUG]: "
-labels: ["B-bug", "F-need-verification"]
-assignees:
- - rustatian
-body:
- - type: markdown
- attributes:
- value: |
- Thanks for taking the time to fill out this bug report!
-
- - type: checkboxes
- id: search-done
- attributes:
- label: No duplicates đŸĨ˛.
- options:
- - label: I have searched for a similar issue in our bug tracker and didn't find any solutions.
- required: true
- - type: textarea
- id: what-happened
- attributes:
- label: What happened?
- description: Also tell us, what did you expect to happen?
- placeholder: Tell us what you see!
- value: "A bug happened!"
- validations:
- required: true
- - type: textarea
- id: version
- attributes:
- label: Version
- description: What version of our software are you running?
- placeholder: 2.6.0
- validations:
- required: true
- - type: textarea
- id: logs
- attributes:
- label: Relevant log output
- description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
- render: shell \ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100755
index 00000000..4d69101b
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,38 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: "[BUG]"
+labels: B-bug, F-need-verification
+assignees: 48d90782
+---
+
+<!--
+ Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
+ along with any information you feel relevant to replicating the bug.
+-->
+
+I tried this code:
+
+```go
+// code
+```
+
+I expected to see this happen: *explanation*
+
+Instead, this happened: *explanation*
+
+The **version of RR** used: *explanation*
+
+The **operation system** used: *explanation*
+
+RR configuration file content:
+
+```yaml
+# Paste here your `.rr.yaml` file content
+```
+
+Errortrace, Backtrace or Panictrace:
+
+```text
+// backtrace
+```
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
deleted file mode 100644
index c8f3ef0a..00000000
--- a/.github/ISSUE_TEMPLATE/config.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-blank_issues_enabled: false
-
-contact_links:
- - name: ❓ Start a discussion or ask a question.
- url: https://github.com/spiral/roadrunner/discussions
- about: Please ask and answer questions here.
diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml
deleted file mode 100644
index e26fde19..00000000
--- a/.github/ISSUE_TEMPLATE/feature-request.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-name: Feauture request
-description: 💡 Suggest an idea for this project
-title: "[💡 FEATURE REQUEST]: "
-labels: ["C-feature-request"]
-assignees:
- - rustatian
-body:
- - type: markdown
- attributes:
- value: |
- Thanks for taking the time to share your idea!
-
- - type: dropdown
- id: plugin
- attributes:
- label: Plugin
- description: What plugin is affected?
- options:
- - GRPC
- - HTTP
- - JOBS
- - TCP
- - File server
- - Config
- - KV
- - Service
- - Server
- - Status
-
- - type: textarea
- id: idea
- attributes:
- label: I have an idea!
- description: Clear and concise description of your idea.
- placeholder: Tell us what you see!
- value: "I have an idea, listen to me!!"
- validations:
- required: true \ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100755
index 00000000..79b34409
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,23 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: "[FEATURE REQUEST]"
+labels: C-feature-request
+assignees: 48d90782, wolfy-j
+---
+
+### Is your feature request related to a problem? Please describe.
+
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+### Describe the solution you'd like
+
+A clear and concise description of what you want to happen.
+
+### Describe alternatives you've considered
+
+A clear and concise description of any alternative solutions or features you've considered.
+
+### Additional context
+
+Add any other context or screenshots about the feature request here.
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index ac2bfd0b..6271660c 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -2,11 +2,6 @@
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
-
-# To get started with Dependabot version updates, you'll need to specify which
-# package ecosystems to update and where the package manifests are located.
-# Please see the documentation for all configuration options:
-# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index c3467850..15476405 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -8,8 +8,7 @@
## License Acceptance
-By submitting this pull request, I confirm that my contribution is made under
-the terms of the MIT license.
+By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.
## PR Checklist
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 05ca036c..0a8818b2 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -1,66 +1,35 @@
-# For most projects, this workflow file will not need changing; you simply need
-# to commit it to your repository.
+# For most projects, this workflow file will not need changing; you simply need to commit it to your repository.
#
-# You may wish to alter this file to override the set of languages analyzed,
-# or to provide custom queries or build logic.
+# You may wish to alter this file to override the set of languages analyzed, or to provide custom queries or build logic.
name: "CodeQL"
on:
push:
- branches: [ master ]
+ branches: [ master, beta, stable ]
pull_request:
- # The branches below must be a subset of the branches above
- branches: [ master ]
+ branches: [ master, beta, stable ]
schedule:
- cron: '0 15 * * 6'
jobs:
analyze:
name: Analyze
- runs-on: ubuntu-latest
-
+ runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
- # Override automatic language detection by changing the below list
- # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
- language: [ 'go' ]
- # Learn more...
- # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
-
+ language: [ 'go' ] # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
- # We must fetch at least the immediate parents so that if this is
- # a pull request then we can checkout the head.
+ # We must fetch at least the immediate parents so that if this is a pull request then we can checkout the head
fetch-depth: 2
- # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- # If you wish to specify custom queries, you can do so here or in a config file.
- # By default, queries listed here will override any specified in a config file.
- # Prefix the list here with "+" to use these queries and those in the config file.
- # queries: ./path/to/local/query, your-org/your-repo/queries@main
-
- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
- # If this step fails, then you should remove it and run the build manually (see below)
- - name: Autobuild
- uses: github/codeql-action/autobuild@v1
-
- # ℹī¸ Command-line programs to run using the OS shell.
- # 📚 https://git.io/JvXDl
-
- # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines
- # and modify them (or add more) to build your code if your project
- # uses a compiled language
-
- #- run: |
- # make bootstrap
- # make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml
deleted file mode 100644
index ba6d0b9f..00000000
--- a/.github/workflows/linters.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-name: Linters
-
-on: [push, pull_request]
-
-jobs:
- golangci-lint:
- name: Golang-CI (lint)
- runs-on: ubuntu-latest
- steps:
- - name: Check out code
- uses: actions/checkout@v2
-
- - name: Run linter
- uses: golangci/golangci-lint-action@v2 # Action page: <https://github.com/golangci/golangci-lint-action>
- with:
- version: v1.43 # without patch version
- only-new-issues: false # show only new issues if it's a pull request
- args: --timeout=10m --build-tags=race
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
deleted file mode 100644
index 73d94462..00000000
--- a/.github/workflows/linux.yml
+++ /dev/null
@@ -1,77 +0,0 @@
-name: Linux
-
-on:
- push:
- branches:
- - master
- - beta
- - stable
- tags-ignore:
- - "**"
- paths-ignore:
- - "**.md"
- - "**.yaml"
- - "**.yml"
- pull_request:
- paths-ignore:
- - "**.md"
- - "**.yaml"
- - "**.yml"
-
-jobs:
- golang:
- name: Build (Go ${{ matrix.go }}, PHP ${{ matrix.php }}, OS ${{matrix.os}})
- runs-on: ${{ matrix.os }}
- timeout-minutes: 60
- strategy:
- fail-fast: true
- matrix:
- php: ["7.4", "8.0", "8.1"]
- go: ["1.17.5"]
- os: ["ubuntu-latest"]
- steps:
- - name: Set up Go ${{ matrix.go }}
- uses: actions/setup-go@v2 # action page: <https://github.com/actions/setup-go>
- with:
- go-version: ${{ matrix.go }}
-
- - name: Set up PHP ${{ matrix.php }}
- uses: shivammathur/setup-php@v2 # action page: <https://github.com/shivammathur/setup-php>
- with:
- php-version: ${{ matrix.php }}
- extensions: sockets
-
- - name: Check out code
- uses: actions/checkout@v2
-
- - name: Get Composer Cache Directory
- id: composer-cache
- run: echo "::set-output name=dir::$(composer config cache-files-dir)"
-
- - name: Init Composer Cache # Docs: <https://git.io/JfAKn#php---composer>
- uses: actions/cache@v2
- with:
- path: ${{ steps.composer-cache.outputs.dir }}
- key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
- restore-keys: ${{ runner.os }}-composer-
-
- - name: Install Composer dependencies
- run: cd tests && composer update --prefer-dist --no-progress --ansi
-
- - name: Init Go modules Cache # Docs: <https://git.io/JfAKn#go---modules>
- uses: actions/cache@v2
- with:
- path: ~/go/pkg/mod
- key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- restore-keys: ${{ runner.os }}-go-
-
- - name: Install Go dependencies
- run: go mod download
-
- - name: Run golang tests with coverage
- run: make test_coverage
-
- - uses: codecov/codecov-action@v2 # Docs: <https://github.com/codecov/codecov-action>
- with:
- file: ./coverage-ci/summary.txt
- fail_ci_if_error: false
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000..d467de71
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,168 @@
+name: release
+
+on:
+ release: # Docs: <https://help.github.com/en/articles/events-that-trigger-workflows#release-event-release>
+ types: [ published ]
+
+jobs:
+ build:
+ name: Build for ${{ matrix.os }} (${{ matrix.arch }}, ${{ matrix.compiler }})
+ runs-on: ubuntu-20.04
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ windows, darwin ] # linux, darwin, windows
+ compiler: [ gcc ] # gcc, musl-gcc
+ archiver: [ zip ] # tar, zip
+ arch: [ amd64 ] # amd64, 386
+ include:
+ - os: linux
+ compiler: gcc
+ archiver: tar
+ arch: amd64
+ - os: linux
+ compiler: gcc
+ archiver: tar
+ arch: arm64
+ - os: darwin
+ compiler: gcc
+ archiver: tar
+ arch: arm64
+ - os: ''
+ compiler: musl-gcc # more info: <https://musl.libc.org/>
+ archiver: zip
+ arch: amd64
+ steps:
+ - name: Set up Go
+ uses: actions/setup-go@v2
+ with:
+ go-version: 1.17.5
+
+ - name: Check out code
+ uses: actions/checkout@v2
+
+ - name: Install musl
+ if: matrix.compiler == 'musl-gcc'
+ run: sudo apt-get install -y musl-tools
+
+ - name: Download dependencies
+ run: go mod download # `-x` means "verbose" mode
+
+ - name: Generate builder values
+ id: values
+ run: |
+ echo "::set-output name=version::`echo ${GITHUB_REF##*/} | sed -e 's/^[vV ]*//'`"
+ echo "::set-output name=timestamp::`date +%FT%T%z`"
+ echo "::set-output name=binary-name::rr`[ ${{ matrix.os }} = 'windows' ] && echo '.exe'`"
+
+ - name: Compile binary file
+ env:
+ GOOS: ${{ matrix.os }}
+ GOARCH: ${{ matrix.arch }}
+ CC: ${{ matrix.compiler }}
+ CGO_ENABLED: 0
+ LDFLAGS: >-
+ -s
+ -X github.com/roadrunner-server/roadrunner/v2/internal/meta.version=${{ steps.values.outputs.version }}
+ -X github.com/roadrunner-server/roadrunner/v2/internal/meta.buildTime=${{ steps.values.outputs.timestamp }}
+ run: |
+ go build -trimpath -ldflags "$LDFLAGS" -o "./${{ steps.values.outputs.binary-name }}" ./cmd/rr
+ stat "./${{ steps.values.outputs.binary-name }}"
+
+ - name: Generate distributive directory name
+ id: dist-dir
+ run: >
+ echo "::set-output name=name::roadrunner-${{ steps.values.outputs.version }}-$(
+ [ ${{ matrix.os }} != '' ] && echo '${{ matrix.os }}' || echo 'unknown'
+ )$(
+ [ ${{ matrix.compiler }} = 'musl-gcc' ] && echo '-musl'
+ )-${{ matrix.arch }}"
+
+ - name: Generate distributive archive name
+ id: dist-arch
+ run: >
+ echo "::set-output name=name::${{ steps.dist-dir.outputs.name }}.$(
+ case ${{ matrix.archiver }} in
+ zip) echo 'zip';;
+ tar) echo 'tar.gz';;
+ *) exit 10;
+ esac
+ )"
+
+ - name: Create distributive
+ run: |
+ mkdir ${{ steps.dist-dir.outputs.name }}
+ mv "./${{ steps.values.outputs.binary-name }}" ./${{ steps.dist-dir.outputs.name }}/
+ cp ./README.md ./CHANGELOG.md ./LICENSE ./${{ steps.dist-dir.outputs.name }}/
+
+ - name: Pack distributive using tar
+ if: matrix.archiver == 'tar'
+ run: tar -zcf "${{ steps.dist-arch.outputs.name }}" "${{ steps.dist-dir.outputs.name }}"
+
+ - name: Pack distributive using zip
+ if: matrix.archiver == 'zip'
+ run: zip -r -q "${{ steps.dist-arch.outputs.name }}" "${{ steps.dist-dir.outputs.name }}"
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: ${{ steps.dist-dir.outputs.name }}
+ path: ${{ steps.dist-arch.outputs.name }}
+ if-no-files-found: error
+ retention-days: 30
+
+ - name: Upload binaries to release
+ uses: svenstaro/upload-release-action@v2
+ with:
+ repo_token: ${{ secrets.GITHUB_TOKEN }}
+ file: ${{ steps.dist-arch.outputs.name }}
+ asset_name: ${{ steps.dist-arch.outputs.name }}
+ tag: ${{ github.ref }}
+
+ docker:
+ name: Build docker image
+ runs-on: ubuntu-20.04
+ steps:
+ - name: Check out code
+ uses: actions/checkout@v2
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v1 # Action page: <https://github.com/docker/setup-qemu-action>
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v1 # Action page: <https://github.com/docker/setup-buildx-action>
+
+ - name: Login to Docker Hub
+ uses: docker/login-action@v1
+ with:
+ username: ${{ secrets.DOCKER_LOGIN }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v1
+ with:
+ registry: ghcr.io
+ username: ${{ secrets.GHCR_LOGIN }}
+ password: ${{ secrets.GHCR_PASSWORD }}
+
+ - name: Generate builder values
+ id: values
+ run: |
+ echo "::set-output name=version::`echo ${GITHUB_REF##*/} | sed -e 's/^[vV ]*//'`"
+ echo "::set-output name=timestamp::`date +%FT%T%z`"
+
+ - name: Build image
+ uses: docker/build-push-action@v2 # Action page: <https://github.com/docker/build-push-action>
+ with:
+ context: .
+ file: Dockerfile
+ push: true
+ platforms: linux/amd64,linux/arm64
+ build-args: |
+ APP_VERSION=${{ steps.values.outputs.version }}
+ BUILD_TIME=${{ steps.values.outputs.timestamp }}
+ tags: |
+ spiralscout/roadrunner:latest
+ spiralscout/roadrunner:${{ steps.values.outputs.version }}
+ ghcr.io/spiral/roadrunner:latest
+ ghcr.io/spiral/roadrunner:${{ steps.values.outputs.version }}
diff --git a/.github/workflows/release_grpc.yml b/.github/workflows/release_grpc.yml
new file mode 100644
index 00000000..a8ac882e
--- /dev/null
+++ b/.github/workflows/release_grpc.yml
@@ -0,0 +1,119 @@
+name: release_grpc
+
+on:
+ release: # Docs: <https://help.github.com/en/articles/events-that-trigger-workflows#release-event-release>
+ types: [ published ]
+
+jobs:
+ build:
+ name: Build for ${{ matrix.os }} (${{ matrix.arch }}, ${{ matrix.compiler }})
+ runs-on: ubuntu-20.04
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ windows, darwin ] # linux, darwin, windows
+ compiler: [ gcc ] # gcc, musl-gcc
+ archiver: [ zip ] # tar, zip
+ arch: [ amd64 ] # amd64, 386
+ include:
+ - os: linux
+ compiler: gcc
+ archiver: tar
+ arch: amd64
+ - os: linux
+ compiler: gcc
+ archiver: tar
+ arch: arm64
+ - os: darwin
+ compiler: gcc
+ archiver: tar
+ arch: arm64
+ - os: ''
+ compiler: musl-gcc # more info: <https://musl.libc.org/>
+ archiver: zip
+ arch: amd64
+ steps:
+ - name: Set up Go
+ uses: actions/setup-go@v2
+ with:
+ go-version: 1.17.5
+
+ - name: Check out code
+ uses: actions/checkout@v2
+ with:
+ repository: 'spiral/roadrunner-plugins'
+
+ - name: Install musl
+ if: matrix.compiler == 'musl-gcc'
+ run: sudo apt-get install -y musl-tools
+
+ - name: Download dependencies
+ run: go mod download
+
+ - name: Generate builder values
+ id: values
+ run: |
+ echo "::set-output name=version::`echo ${GITHUB_REF##*/} | sed -e 's/^[vV ]*//'`"
+ echo "::set-output name=timestamp::`date +%FT%T%z`"
+ echo "::set-output name=binary-name::protoc-gen-php-grpc`[ ${{ matrix.os }} = 'windows' ] && echo '.exe'`"
+
+ - name: Compile binary file
+ env:
+ GOOS: ${{ matrix.os }}
+ GOARCH: ${{ matrix.arch }}
+ CC: ${{ matrix.compiler }}
+ CGO_ENABLED: 0
+ LDFLAGS: >-
+ -s
+ run: |
+ go build -trimpath -ldflags "$LDFLAGS" -o "./${{ steps.values.outputs.binary-name }}" grpc/protoc_plugins/protoc-gen-php-grpc/main.go
+ stat "./${{ steps.values.outputs.binary-name }}"
+
+ - name: Generate distributive directory name
+ id: dist-dir
+ run: >
+ echo "::set-output name=name::protoc-gen-php-grpc-${{ steps.values.outputs.version }}-$(
+ [ ${{ matrix.os }} != '' ] && echo '${{ matrix.os }}' || echo 'unknown'
+ )$(
+ [ ${{ matrix.compiler }} = 'musl-gcc' ] && echo '-musl'
+ )-${{ matrix.arch }}"
+
+ - name: Generate distributive archive name
+ id: dist-arch
+ run: >
+ echo "::set-output name=name::${{ steps.dist-dir.outputs.name }}.$(
+ case ${{ matrix.archiver }} in
+ zip) echo 'zip';;
+ tar) echo 'tar.gz';;
+ *) exit 10;
+ esac
+ )"
+
+ - name: Create distributive
+ run: |
+ mkdir ${{ steps.dist-dir.outputs.name }}
+ mv "./${{ steps.values.outputs.binary-name }}" ./${{ steps.dist-dir.outputs.name }}/
+
+ - name: Pack distributive using tar
+ if: matrix.archiver == 'tar'
+ run: tar -zcf "${{ steps.dist-arch.outputs.name }}" "${{ steps.dist-dir.outputs.name }}"
+
+ - name: Pack distributive using zip
+ if: matrix.archiver == 'zip'
+ run: zip -r -q "${{ steps.dist-arch.outputs.name }}" "${{ steps.dist-dir.outputs.name }}"
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: ${{ steps.dist-dir.outputs.name }}
+ path: ${{ steps.dist-arch.outputs.name }}
+ if-no-files-found: error
+ retention-days: 30
+
+ - name: Upload binaries to release
+ uses: svenstaro/upload-release-action@v2
+ with:
+ repo_token: ${{ secrets.GITHUB_TOKEN }}
+ file: ${{ steps.dist-arch.outputs.name }}
+ asset_name: ${{ steps.dist-arch.outputs.name }}
+ tag: ${{ github.ref }}
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 00000000..e93d15ad
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,157 @@
+name: tests
+
+on:
+ push:
+ branches:
+ - master
+ - beta
+ - stable
+ tags-ignore:
+ - '**'
+ paths-ignore:
+ - '**.md'
+ pull_request:
+ paths-ignore:
+ - '**.md'
+
+jobs:
+ validate-config-file:
+ name: Validate config file
+ runs-on: ubuntu-20.04
+ steps:
+ - name: Check out code
+ uses: actions/checkout@v2
+
+ - name: Setup nodejs
+ uses: actions/setup-node@v2
+ with:
+ node-version: '14'
+
+ - name: Install linter
+ run: npm install -g ajv-cli # Package page: <https://www.npmjs.com/package/ajv-cli>
+
+ - name: Run linter
+ run: ajv validate --all-errors --verbose -s ./schemas/config/2.0.schema.json -d ./.rr.yaml
+
+ golangci-lint:
+ name: Golang-CI (lint)
+ runs-on: ubuntu-20.04
+ steps:
+ - name: Check out code
+ uses: actions/checkout@v2
+
+ - name: Run linter
+ uses: golangci/golangci-lint-action@v2 # Action page: <https://github.com/golangci/golangci-lint-action>
+ with:
+ version: v1.43 # without patch version
+ only-new-issues: false # show only new issues if it's a pull request
+ args: --build-tags=safe --timeout=10m
+
+ go-test:
+ name: Unit tests
+ runs-on: ubuntu-20.04
+ steps:
+ - name: Set up Go
+ uses: actions/setup-go@v2
+ with:
+ go-version: 1.17.5
+
+ - name: Check out code
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 2 # Fixes codecov error 'Issue detecting commit SHA'
+
+ - name: Init Go modules Cache # Docs: <https://git.io/JfAKn#go---modules>
+ uses: actions/cache@v2
+ with:
+ path: ~/go/pkg/mod
+ key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
+ restore-keys: ${{ runner.os }}-go-
+
+ - name: Install Go dependencies
+ run: go mod download
+
+ - name: Run Unit tests
+ run: go test -race -covermode=atomic -coverprofile /tmp/coverage.txt ./...
+
+ - name: Upload Coverage report to CodeCov
+ continue-on-error: true
+ uses: codecov/[email protected] # https://github.com/codecov/codecov-action
+ with:
+ file: /tmp/coverage.txt
+
+ build:
+ name: Build for ${{ matrix.os }}
+ runs-on: ubuntu-20.04
+ needs: [ golangci-lint, go-test ]
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ linux, darwin, windows ]
+ steps:
+ - name: Set up Go
+ uses: actions/setup-go@v2 # action page: <https://github.com/actions/setup-go>
+ with:
+ go-version: 1.17.5
+
+ - name: Check out code
+ uses: actions/checkout@v2
+
+ - name: Init Go modules Cache # Docs: <https://git.io/JfAKn#go---modules>
+ uses: actions/cache@v2
+ with:
+ path: ~/go/pkg/mod
+ key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
+ restore-keys: ${{ runner.os }}-go-
+
+ - name: Install Go dependencies
+ run: go mod download && go mod verify
+
+ - name: Generate version value
+ id: values # for PR this value will be `merge@__hash__`, SO: <https://stackoverflow.com/a/59780579/2252921>
+ run: |
+ echo "::set-output name=version::`echo ${GITHUB_REF##*/}`@`echo ${GITHUB_SHA} | cut -c1-8`"
+ echo "::set-output name=timestamp::`date +%FT%T%z`"
+
+ - name: Compile binary file
+ env:
+ GOOS: ${{ matrix.os }}
+ GOARCH: amd64
+ CGO_ENABLED: 0
+ LDFLAGS: -s
+ -X github.com/roadrunner-server/roadrunner/v2/internal/meta.version=${{ steps.values.outputs.version }}
+ -X github.com/roadrunner-server/roadrunner/v2/internal/meta.buildTime=${{ steps.values.outputs.timestamp }}
+ run: go build -trimpath -ldflags "$LDFLAGS" -o ./rr ./cmd/rr
+
+ - name: Try to execute
+ if: matrix.os == 'linux'
+ run: ./rr -v
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: rr-${{ matrix.os }}
+ path: ./rr
+ if-no-files-found: error
+ retention-days: 90
+
+ docker-image:
+ name: Build docker image
+ runs-on: ubuntu-20.04
+ needs: [ golangci-lint, go-test ]
+ steps:
+ - name: Check out code
+ uses: actions/checkout@v2
+
+ - name: Build image
+ run: docker build -t rr:local -f ./Dockerfile .
+
+ - name: Try to execute
+ run: docker run --rm rr:local -v
+
+ - name: Scan image
+ uses: anchore/scan-action@v3 # action page: <https://github.com/anchore/scan-action>
+ with:
+ image: rr:local
+ fail-build: true
+ severity-cutoff: low # negligible, low, medium, high or critical