Skip to content

Commit

Permalink
Merge pull request #43 from adrg/update-github-actions
Browse files Browse the repository at this point in the history
Update GitHub Actions workflows
  • Loading branch information
adrg authored Mar 20, 2024
2 parents f96adea + e92c206 commit bffe07f
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 69 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Analyze

on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
- cron: "0 6 * * 1"

permissions:
actions: read
contents: read
security-events: write

jobs:
analyze:
runs-on: ubuntu-latest

steps:
- name: Prerequisites
run: |
sudo apt-get update
sudo apt-get -y install xfonts-75dpi xfonts-base
curl --silent --show-error --location --max-redirs 3 --fail --retry 3 --output wkhtmltopdf-linux-amd64.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
sudo dpkg -i wkhtmltopdf-linux-amd64.deb
sudo ldconfig
rm wkhtmltopdf-linux-amd64.deb
- name: Checkout
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: go
queries: security-and-quality

- name: Run CodeQL analysis
uses: github/codeql-action/analyze@v3
47 changes: 0 additions & 47 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Lint

on:
push:
branches: [master]
pull_request:

permissions:
contents: read

jobs:
lint:
strategy:
matrix:
go: ['1.21']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Setup
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

- name: Prerequisites
run: |
sudo apt-get update
sudo apt-get -y install xfonts-75dpi xfonts-base
curl --silent --show-error --location --max-redirs 3 --fail --retry 3 --output wkhtmltopdf-linux-amd64.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
sudo dpkg -i wkhtmltopdf-linux-amd64.deb
sudo ldconfig
rm wkhtmltopdf-linux-amd64.deb
- name: Prepare checkout
run: git config --global core.autocrlf false

- name: Checkout
uses: actions/checkout@v4

- name: Lint
uses: golangci/golangci-lint-action@v4.0.0
with:
version: "v1.54"
args: --timeout=5m
33 changes: 14 additions & 19 deletions .github/workflows/ci.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
name: CI
name: Test

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

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
test:
strategy:
matrix:
go: ['1.16']
go: ['1.21']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Setup
uses: actions/setup-go@v5
Expand All @@ -26,23 +30,14 @@ jobs:
sudo ldconfig
rm wkhtmltopdf-linux-amd64.deb
- name: Prepare checkout
run: git config --global core.autocrlf false

- name: Checkout
uses: actions/checkout@v4

- name: Dependencies
run: |
go version
go get -v -t -d ./...
go get -u golang.org/x/lint/golint
- name: Lint
run: golint -set_exit_status=1 ./...

- name: Vet
run: go vet ./...

- name: Test
run: go test -v -coverprofile=coverage.txt -covermode=atomic ./...
run: go test -v -coverprofile coverage.txt -covermode atomic ./...

- name: Coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/adrg/go-wkhtmltopdf

go 1.14
go 1.19
3 changes: 1 addition & 2 deletions object.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"strings"
"unsafe"
Expand Down Expand Up @@ -283,7 +282,7 @@ func NewObjectWithOpts(opts *ObjectOpts) (*Object, error) {
// The object is configured using sensible defaults. See NewObjectOpts for
// the default options.
func NewObjectFromReader(r io.Reader) (*Object, error) {
file, err := ioutil.TempFile("", "pdf-")
file, err := os.CreateTemp("", "pdf-")
if err != nil {
return nil, err
}
Expand Down

0 comments on commit bffe07f

Please sign in to comment.