Bump golang.org/x/crypto from 0.30.0 to 0.31.0 #354
Workflow file for this run
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 | |
on: | |
push: | |
# Publish `master` as Docker `latest` image. | |
branches: | |
- master | |
# Publish `v1.2.3` tags as releases. | |
tags: | |
- v* | |
# Run tests for any PRs. | |
pull_request: | |
env: | |
IMAGE_NAME: goginapi | |
jobs: | |
analyze: | |
name: Analyze | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
language: [ 'go' ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- run: git checkout HEAD^2 | |
if: ${{ github.event_name == 'pull_request' }} | |
# Initializes the CodeQL tools for scanning. | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: ${{ matrix.language }} | |
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | |
- name: Autobuild | |
uses: github/codeql-action/autobuild@v3 | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 | |
CodeScan: | |
runs-on: ubuntu-latest | |
env: | |
GO111MODULE: on | |
steps: | |
- name: Checkout Source | |
uses: actions/checkout@v4 | |
- name: Self sast-scan | |
uses: AppThreat/[email protected] | |
with: | |
output: reports | |
type: go,bash | |
- name: Upload scan reports | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sast-scan-reports | |
path: reports | |
# Run tests. | |
# See also https://docs.docker.com/docker-hub/builds/automated-testing/ | |
UnitTest: | |
needs: codescan | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run unit tests | |
run: go test -v ./... | |
IntegrationTest: | |
needs: unittest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run integration tests | |
run: | | |
if [ -f docker-compose.test.yml ]; then | |
docker-compose --file docker-compose.test.yml build | |
docker-compose --file docker-compose.test.yml run sut | |
else | |
docker build . --file Dockerfile | |
fi | |
Performance_test: | |
runs-on: ubuntu-latest | |
env: | |
NR_ACCOUNTID: ${{secrets.NR_ACCOUNTID}} | |
NR_APIKEY: ${{secrets.NR_APIKEY}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup NewRelic Agent | |
run: | | |
docker run \ | |
-d --restart unless-stopped \ | |
--name newrelic-statsd \ | |
-h $(hostname) \ | |
-e NR_ACCOUNT_ID=$NR_ACCOUNTID \ | |
-e NR_API_KEY=$NR_APIKEY \ | |
-e NR_EU_REGION=true \ | |
-e NR_LOG_METRICS=true \ | |
-e TAGS="k6Test:PerformanceTest" \ | |
-p 8125:8125/udp \ | |
newrelic/nri-statsd:latest | |
- name: Docker compose application | |
run: docker-compose up -d | |
- name: Download and Installing K6_v32 ... | |
run: | | |
curl https://github.com/k6io/k6/releases/download/v0.32.0/k6-v0.32.0-linux-amd64.tar.gz -L | tar xvz --strip-components 1 | |
- name: Run Performance test | |
run: K6_STATSD_ENABLE_TAGS=true ./k6 run --out statsd performance/tests/perf_login_test.js | |
DockerPublish: | |
needs: integrationtest | |
name: DockerPublish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ^1.17 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Get dependencies | |
run: | | |
go get -v -t -d ./... | |
if [ -f Gopkg.toml ]; then | |
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | |
dep ensure | |
fi | |
- name: Publish to Registry | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
repository: dipjyotimetia/goginapi | |
dockerfile: Dockerfile | |
tags: latest | |
# Push image to GitHub Packages. | |
# See also https://docs.docker.com/docker-hub/builds/ | |
GithubPublish: | |
# Ensure test job passes before pushing image. | |
needs: integrationtest | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build image | |
run: docker build . --file Dockerfile --tag $IMAGE_NAME | |
- name: Log into registry | |
run: echo "${{ secrets.DOCKER_PACKAGE }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin | |
- name: Push image | |
run: | | |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME | |
# Change all uppercase to lowercase | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "master" ] && VERSION=latest | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION |