Merge pull request #41 from m-messiah/bump-go #37
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: [ main ] | |
tags: [ 'v*' ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.23 | |
- name: Set up environment | |
run: | | |
sudo apt-get install -y nginx tzdata cpanminus | |
sudo cpanm --quiet local::lib | |
eval $(perl -Mlocal::lib) | |
sudo cpanm --quiet --notest Test::Nginx::Socket | |
- name: Add version info | |
run: sed -i 's/const VERSION = .*/const VERSION = "'${GITHUB_REF##*/}'"/' version.go | |
- name: Build | |
run: go build -o ip2geo -v ./... | |
- name: Test version | |
run: ./ip2geo -version | |
- name: Download MaxMind | |
env: | |
MAXMIND_LICENSE_KEY: ${{ secrets.MAXMIND_LICENSE_KEY }} | |
run: wget -O maxmind.zip 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City-CSV&suffix=zip&license_key='$MAXMIND_LICENSE_KEY | |
- name: Test maxmind | |
run: | | |
./ip2geo -maxmind-filename maxmind.zip | |
TEST_NGINX_IP2GEO_DIR=$PWD prove t/nginx_geo.t | |
- name: Test nobase64 | |
run: | | |
./ip2geo -lang en -nobase64 -maxmind-filename maxmind.zip | |
TEST_NGINX_IP2GEO_DIR=$PWD prove t/nginx_geo.t | |
- name: Test ipv6 | |
run: | | |
./ip2geo -ipver 6 -maxmind-filename maxmind.zip -maxmind | |
TEST_NGINX_IP2GEO_DIR=$PWD prove t/nginx_geo_ipv6.t | |
- name: Test ipv6 for en | |
run: | | |
./ip2geo -ipver 6 -lang en -nobase64 -maxmind-filename maxmind.zip -maxmind | |
TEST_NGINX_IP2GEO_DIR=$PWD prove t/nginx_geo_ipv6.t | |
- name: Build release files | |
if: ${{ github.ref == 'refs/heads/main' }} || startsWith(github.ref, 'refs/tags/') | |
run: | | |
for goos in darwin linux freebsd openbsd; do | |
for arch in 386 arm amd64 arm64; do | |
go build -o ip2geo-$goos-$arch | |
done | |
done | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: ip2geo-* |