Skip to content

Commit

Permalink
Merge pull request #2 from DragonFlyBSD/feat-add-build-workflows
Browse files Browse the repository at this point in the history
Add actions workflows to test the build
  • Loading branch information
tuxillo authored Mar 28, 2023
2 parents 9b932a3 + 853471e commit 74faf39
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 2 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: pull-request

on:
pull_request:
types: [opened,reopened,synchronize]
branches: [master]

jobs:
pr_run_dfly:
runs-on: macos-12
name: Pull requests DragonFly BSD
steps:
- uses: actions/checkout@v3
- name: Build and test in DragonFly BSD
id: build-test-dfly
uses: vmactions/dragonflybsd-vm@v0
with:
mem: 4096
usesh: true
prepare: |
pkg install -y go curl
run: |
make
make test
pr_run_linux:
runs-on: [ubuntu-latest]
name: Pull requests Linux
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Build mirrorselect
run: make
- name: Tests
run: make test
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: release

on:
push:
branches: [master]

jobs:
build_dfly:
runs-on: macos-12
name: Release build and tests on dfly
steps:
- uses: actions/checkout@v3
- name: Build and test in DragonFly BSD
id: build-test-dfly
uses: vmactions/dragonflybsd-vm@v0
with:
mem: 4096
usesh: true
prepare: |
pkg install -y go curl
run: |
make
make test
release:
runs-on: [ubuntu-latest]
needs: build_dfly
name: Release
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GH_TOKEN }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
all:
go build -o mirrorselect main.go
GOOS=dragonfly GOARCH=amd64 go build -o mirrorselect main.go
GOOS=freebsd GOARCH=amd64 go build -o mirrorselect main.go

test: dbip
go test -v ./common ./geoip ./monitor ./workerpool

clean:
rm -f mirrorselect

dbip: testdata/dbip-city-lite-2021-02.mmdb
testdata/dbip-city-lite-2021-02.mmdb:
curl https://download.db-ip.com/free/dbip-city-lite-2021-02.mmdb.gz | \
curl https://download.db-ip.com/free/dbip-city-lite-2023-03.mmdb.gz | \
gunzip > $@

0 comments on commit 74faf39

Please sign in to comment.