Update github-actions #199
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: Crypto | |
on: | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: step-security/harden-runner@9ff9d14760a73102d9fa2f47131624137f50ead8 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
github.com:443 | |
objects.githubusercontent.com:443 | |
proxy.golang.org:443 | |
raw.githubusercontent.com:443 | |
- name: Checkout repo | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b | |
with: | |
fetch-depth: 0 | |
- name: Setup Go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 | |
with: | |
go-version-file: ./go.mod | |
# Linting | |
- name: Linting | |
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 | |
with: | |
version: latest | |
args: --config=./.github/.golangci.yml ./... | |
only-new-issues: true | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
go: [ '1.22', '1.21' ] | |
steps: | |
- uses: step-security/harden-runner@9ff9d14760a73102d9fa2f47131624137f50ead8 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
github.com:443 | |
proxy.golang.org:443 | |
storage.googleapis.com:443 | |
sum.golang.org:443 | |
- name: Checkout repo | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b | |
with: | |
fetch-depth: 0 | |
- name: Setup Go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 | |
with: | |
go-version: ${{ matrix.go }} | |
# Test | |
- name: Run Tests | |
run: cd .github && make test | |
analyze: | |
name: Analyze | |
runs-on: ubuntu-latest | |
steps: | |
- uses: step-security/harden-runner@9ff9d14760a73102d9fa2f47131624137f50ead8 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
api.codecov.io:443 | |
api.github.com:443 | |
cli.codecov.io:443 | |
ea6ne4j2sb.execute-api.eu-central-1.amazonaws.com:443 | |
github.com:443 | |
objects.githubusercontent.com:443 | |
proxy.golang.org:443 | |
scanner.sonarcloud.io:443 | |
sonarcloud.io:443 | |
storage.googleapis.com:443 | |
- name: Checkout repo | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b | |
with: | |
fetch-depth: 0 | |
- name: Setup Go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 | |
with: | |
go-version-file: ./go.mod | |
# Coverage | |
- name: Run coverage | |
run: cd .github && make cover | |
# Codecov | |
- name: Codecov | |
uses: codecov/codecov-action@f691d469fbba7b31a1cb026e3a2f86e28c9dcdb6 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
file: .github/coverage.out | |
# Sonar | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@19888635fa64d24e533d388efe8264402dfd721b | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
with: | |
args: > | |
-Dsonar.projectKey=bytemare_crypto | |
-Dsonar.organization=bytemare-github | |
-Dsonar.go.coverage.reportPaths=.github/coverage.out | |
-Dsonar.sources=. | |
-Dsonar.test.exclusions=tests/** | |
-Dsonar.coverage.exclusions=tests/** | |
-Dsonar.tests=tests/ | |
-Dsonar.verbose=true |