Skip to content

Merge pull request #632 from go-graphite/dependabot/go_modules/golang… #540

Merge pull request #632 from go-graphite/dependabot/go_modules/golang…

Merge pull request #632 from go-graphite/dependabot/go_modules/golang… #540

Workflow file for this run

name: Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
tests:
name: Test code
runs-on: ubuntu-latest
strategy:
matrix:
go: [ 1.21.x, 1.22.x, 1.23.x, tip ]
steps:
- name: Set up Go stable
if: matrix.go != 'tip'
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Set up Go tip
if: matrix.go == 'tip'
run: |
curl -o go.tar.gz -L \
https://github.com/AlekSi/golang-tip/releases/download/tip/master.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go.tar.gz
sudo ln -s /usr/local/go/bin/* /usr/local/bin/
/usr/local/bin/go version
echo "PATH=$HOME/go/bin:$HOME/sdk/gotip/bin/:$PATH" >> $GITHUB_ENV
- name: Check out code into the Go module directory
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: Check Docker images
run: |
make image
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
- name: Install packaging dependencies
run: |
gem install rake fpm package_cloud
go install github.com/mitchellh/gox@latest
- name: Check packaging
run: |
make DEVEL=1 gox-build fpm-deb fpm-rpm
make sum-files
- name: Upload Artifact
if: ${{ matrix.go == 'tip' }} # only upload artifact when built with latest go
id: artifact
uses: actions/upload-artifact@v4
with:
name: packages-${{ matrix.go }}
retention-days: 3
path: |
*.deb
*.rpm
sha256sum
md5sum
- name: Push packages to the autobuilds repo
if: ${{ github.event_name == 'push' && matrix.go == 'tip' }} # only when built from master with latest go
run: make DEVEL=1 packagecloud-autobuilds
env:
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}