65 lines
2.2 KiB
YAML
65 lines
2.2 KiB
YAML
name: Declarative Tests
|
|
run-name: ${{ gitea.actor }} testing
|
|
on:
|
|
- push
|
|
- workflow_dispatch
|
|
- issue_comment
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: registry.cv.mazarbul.net/declarative/build-golang:1.22.1-alpine-x86_64
|
|
env:
|
|
GOPATH: /
|
|
SSH_AUTH_SOCK: /tmp/ssh.sock
|
|
ENVIRONMENT: dev
|
|
valid_volumes:
|
|
- ${{ vars.BUILDER_VOLUME_HOME }}/.ssh/known_hosts
|
|
- ${{ env.SSH_AUTH_SOCK }}
|
|
- /etc/gitconfig:/etc/gitconfig
|
|
- ${{ vars.BUILDER_VOLUME_HOME }}/.gitconfig
|
|
- ${{ vars.BUILDER_VOLUME_HOME }}/.git-credentials
|
|
- /etc/ssl/certs
|
|
- ${{ vars.GITEA_WORKSPACE }}
|
|
volumes:
|
|
- ${{ vars.BUILDER_VOLUME_HOME }}/.ssh/known_hosts:/root/.ssh/known_hosts
|
|
- ${{ env.SSH_AUTH_SOCK }}:/tmp/ssh.sock
|
|
- /etc/gitconfig:/etc/gitconfig
|
|
- ${{ vars.BUILDER_VOLUME_HOME }}/.gitconfig:/root/.gitconfig
|
|
- ${{ vars.BUILDER_VOLUME_HOME }}/.git-credentials:/root/.git-credentials
|
|
- /etc/ssl/certs:/etc/ssl/certs
|
|
- ${{ vars.GITEA_WORKSPACE }}:/go/src
|
|
options: --cpus 1
|
|
steps:
|
|
- run: apk add --no-cache nodejs
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v3
|
|
- run: echo "The ${{ gitea.repository }} repository has been cloned to the runner."
|
|
- run: echo "The workflow is now ready to test your code on the runner."
|
|
- name: Run tests
|
|
run: |
|
|
go test -coverprofile=artifacts/coverage.profile ./...
|
|
- name: Run build
|
|
run: |
|
|
make build
|
|
- name: cli tests
|
|
run: |
|
|
go test
|
|
- run: echo "This job's status is ${{ job.status }}."
|
|
- run: echo "This job's status is ${{ job.status }}."
|
|
- name: coverage report
|
|
run: |
|
|
go tool cover -html=artifacts/coverage.profile -o artifacts/code-coverage.html
|
|
- name: Archive code coverage results
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: code-coverage-report
|
|
path: artifacts/code-coverage.html
|
|
- name: Archive binary
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: decl
|
|
path: decl
|
|
- run: echo "This job's status is ${{ job.status }}."
|