forked from kolesa-team/goexiv
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (76 loc) · 2.52 KB
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Build & Test
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
EXIV2_VERSION: 0.27.6
jobs:
build_test:
name: Build & Test
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.17', '1.18', '1.19' ]
steps:
- name: Install exiv2 dependencies
run: |
sudo cp /etc/apt/sources.list /etc/apt/sources.list~
sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
sudo apt update -y
sudo apt install -y curl subversion make cmake autoconf pkg-config g++ exifprobe libcurl4-openssl-dev libssh-dev
sudo apt build-dep -y exiv2
- name: Define exiv2 cache
id: cache-exiv2
uses: actions/cache@v3
env:
cache-name: cache-exiv2-v${{ env.EXIV2_VERSION }}
with:
path: ~/gnu/exiv2
key: ${{ runner.os }}-exiv2-build-${{ env.cache-name }}
restore-keys: |
${{ runner.os }}-exiv2-build-
- name: Build exiv2 or get it from cache
if: ${{ steps.cache-exiv2.outputs.cache-hit != 'true' }}
run: |
mkdir -p ~/gnu/exiv2
cd ~/gnu/exiv2
curl -L -O https://github.com/Exiv2/exiv2/releases/download/v${EXIV2_VERSION}/exiv2-${EXIV2_VERSION}-Source.tar.gz
tar xzf exiv2-${EXIV2_VERSION}-Source.tar.gz
cd exiv2-${EXIV2_VERSION}-Source
mkdir build
cd build
cmake ..
make
- name: Install exiv2
run: |
cd ~/gnu/exiv2/exiv2-${EXIV2_VERSION}-Source/build
sudo make install
sudo ldconfig
- name: Checkout the code
uses: actions/checkout@v3
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Install project dependencies
run: go get .
- name: Build project
run: go build -v ./...
- name: Test project
run: go test -v ./...
- name: Run test/coverage
run: |
go test -v ./... -covermode=atomic -coverprofile cover.out
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: cover.out
flags: unittests
fail_ci_if_error: true
verbose: true