Skip to content

Migrate packages building to nfpm and pure go build #202

Migrate packages building to nfpm and pure go build

Migrate packages building to nfpm and pure go build #202

Workflow file for this run

name: Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
tests:
env:
CGO_ENABLED: 0
name: Test code
runs-on: ubuntu-latest
strategy:
matrix:
go:
- ^1.20
- ^1.21
- ^1
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Check out code
uses: actions/checkout@v4
- name: Checkout to the latest tag
run: |
# Fetch all tags
git fetch --depth=1 --tags
# Get the latest tag
VERS=$(git tag -l | sort -Vr | head -n1)
# Fetch everything to the latest tag
git fetch --shallow-since=$(git log $VERS -1 --format=%at)
if: ${{ github.event_name == 'push' }} # only when built from master
- name: Build project
run: make
- name: Test
run: make test
env:
CGO_ENABLED: 1
- name: Test
run: make test
env:
CGO_ENABLED: 1
- name: Test (with GMT+5)
run: |
go clean -testcache
TZ=Etc/GMT+5 make test
env:
CGO_ENABLED: 1
# Some tests are broen in GMT-5
# --- FAIL: TestProm1UnpackFast (1.34s)
# prometheus_test.go:74:
# Error Trace: prometheus_test.go:74
# Error: Not equal:
# expected:
# Test: TestProm1UnpackFast
# FAIL
# FAIL github.com/lomik/carbon-clickhouse/receiver 2.515s
# - name: Test (with GMT-5)
# run: |
# go clean -testcache
# TZ=Etc/GMT-5 make test
# env:
# CGO_ENABLED: 1
- name: Check packaging
run: |
make DEVEL=1 nfpm-deb nfpm-rpm
make sum-files
- name: Artifact
id: artifact
uses: actions/upload-artifact@v4
with:
name: packages-${{ matrix.go }}
path: |
*.deb
*.rpm
sha256sum
md5sum
- name: Push packages to the autobuilds repo
if: ${{ github.event_name == 'push' && matrix.go == '^1' }} # only when built from master with latest go
run: make DEVEL=1 packagecloud-autobuilds
env:
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
integration_tests:
name: Integration tests
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ^1
- name: Integration tests
run: |
make e2e-test
./e2e-test -config tests -abort -rmi