Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/go_modules/github.com/promethe…
Browse files Browse the repository at this point in the history
…us/client_golang-1.19.0
  • Loading branch information
euskadi31 committed Mar 9, 2024
2 parents dd64607 + 5701aef commit 805a74a
Show file tree
Hide file tree
Showing 9 changed files with 347 additions and 196 deletions.
323 changes: 160 additions & 163 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,182 +2,179 @@ name: Go

on:
push:
branches: [ develop, master ]
branches: [develop, master]
pull_request:
branches: [ develop ]
branches: [develop]

jobs:

build:
strategy:
matrix:
libvips: ["8.12.2"]
name: Build
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: "1.x"
id: go

- name: Install deps
run: |
sudo apt-get update
sudo apt-get install -y build-essential unzip wget gobject-introspection gtk-doc-tools libcfitsio-dev libfftw3-dev libgif-dev libgs-dev libgsf-1-dev libmatio-dev libopenslide-dev liborc-0.4-dev libpango1.0-dev libpoppler-glib-dev libwebp-dev libjpeg-turbo8-dev libtiff5-dev libexif-dev librsvg2-dev libimagequant-dev libheif-dev
- name: Cache libvips
uses: actions/cache@v4
with:
path: |
~/libvips-${{ matrix.libvips }}
key: ${{ runner.os }}-${{ matrix.libvips }}

- uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Install vips
shell: bash
run: .github/install_libvips.sh ${{ matrix.libvips }}

- name: Build
run: go build -race -v ./...

- name: Test
run: go test -race -cover -coverprofile ./coverage.out ./...

- name: Coverage
id: coverage
run: |
go tool cover -func ./coverage.out | tee -a coverage.txt
echo "COVERAGE_CONTENT<<EOF" >> $GITHUB_ENV
cat coverage.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- uses: actions/github-script@v4
if: github.event_name == 'pull_request'
continue-on-error: true
env:
COVERAGE_CONTENT: "${{ env.COVERAGE_CONTENT }}"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `Code Coverage\n
\`\`\`\n
${process.env.COVERAGE_CONTENT}
\`\`\`
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Workflow: \`${{ github.workflow }}\`*`;
const response = await github.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
var comments = response.data;
console.log(comments);
if (comments.length > 0) {
comments = comments.filter(comment => comment.body.includes('Code Coverage') && comment.user.type === 'Bot');
}
if (comments.length > 0) {
const comment = comments.shift();
github.issues.updateComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id,
body: output
})
} else {
github.issues.createComment({
issue_number: context.issue.number,
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: "1.x"
id: go

- name: Install deps
run: |
sudo apt-get update
sudo apt-get install -y build-essential unzip wget gobject-introspection gtk-doc-tools libcfitsio-dev libfftw3-dev libgif-dev libgs-dev libgsf-1-dev libmatio-dev libopenslide-dev liborc-0.4-dev libpango1.0-dev libpoppler-glib-dev libwebp-dev libjpeg-turbo8-dev libtiff5-dev libexif-dev librsvg2-dev libimagequant-dev libheif-dev
- name: Cache libvips
uses: actions/cache@v4
with:
path: |
~/libvips-${{ matrix.libvips }}
key: ${{ runner.os }}-${{ matrix.libvips }}

- uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Install vips
shell: bash
run: .github/install_libvips.sh ${{ matrix.libvips }}

- name: Build
run: go build -race -v ./...

- name: Test
run: go test -race -cover -coverprofile ./coverage.out ./...

- name: Coverage
id: coverage
run: |
go tool cover -func ./coverage.out | tee -a coverage.txt
echo "COVERAGE_CONTENT<<EOF" >> $GITHUB_ENV
cat coverage.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- uses: actions/github-script@v4
if: github.event_name == 'pull_request'
continue-on-error: true
env:
COVERAGE_CONTENT: "${{ env.COVERAGE_CONTENT }}"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `Code Coverage\n
\`\`\`\n
${process.env.COVERAGE_CONTENT}
\`\`\`
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Workflow: \`${{ github.workflow }}\`*`;
const response = await github.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
}
- name: Benchmark
id: benchmark
run: |
go test -benchmem -bench . | tee -a benchmark.txt
echo "BENCHMARK_CONTENT<<EOF" >> $GITHUB_ENV
cat benchmark.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- uses: actions/github-script@v4
if: github.event_name == 'pull_request'
continue-on-error: true
env:
BENCHMARK_CONTENT: "${{ env.BENCHMARK_CONTENT }}"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `Benchmark\n
\`\`\`\n
${process.env.BENCHMARK_CONTENT}
\`\`\`
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Workflow: \`${{ github.workflow }}\`*`;
const response = await github.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
var comments = response.data;
console.log(comments);
if (comments.length > 0) {
comments = comments.filter(comment => comment.body.includes('Benchmark') && comment.user.type === 'Bot');
}
if (comments.length > 0) {
const comment = comments.shift();
github.issues.updateComment({
issue_number: context.issue.number,
});
var comments = response.data;
console.log(comments);
if (comments.length > 0) {
comments = comments.filter(comment => comment.body.includes('Code Coverage') && comment.user.type === 'Bot');
}
if (comments.length > 0) {
const comment = comments.shift();
github.issues.updateComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id,
body: output
})
} else {
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
}
- name: Benchmark
id: benchmark
run: |
go test -benchmem -bench . | tee -a benchmark.txt
echo "BENCHMARK_CONTENT<<EOF" >> $GITHUB_ENV
cat benchmark.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- uses: actions/github-script@v4
if: github.event_name == 'pull_request'
continue-on-error: true
env:
BENCHMARK_CONTENT: "${{ env.BENCHMARK_CONTENT }}"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `Benchmark\n
\`\`\`\n
${process.env.BENCHMARK_CONTENT}
\`\`\`
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Workflow: \`${{ github.workflow }}\`*`;
const response = await github.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id,
body: output
})
} else {
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
}
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4.0.0
with:
version: v1.52.2
skip-pkg-cache: true

- name: Coveralls
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out
});
var comments = response.data;
console.log(comments);
if (comments.length > 0) {
comments = comments.filter(comment => comment.body.includes('Benchmark') && comment.user.type === 'Bot');
}
if (comments.length > 0) {
const comment = comments.shift();
github.issues.updateComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id,
body: output
})
} else {
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
}
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4.0.0
with:
version: v1.55.2
skip-pkg-cache: true

- name: Coveralls
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out
Loading

0 comments on commit 805a74a

Please sign in to comment.