Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI/CD #35

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b0f63c7
ci: add base
mibmo Jun 7, 2022
70c661f
mac-os support
mibmo Jun 10, 2022
394ade6
fix if-statements
mibmo Jun 10, 2022
39f74da
don't run brew as root
mibmo Jun 10, 2022
0ea1ffc
remove debug steps
mibmo Jun 10, 2022
2a1f555
label the 'download build tool' steps
mibmo Jun 10, 2022
a88a1ea
remove other CI configs
mibmo Jun 11, 2022
e59e91b
change go version
mibmo Jun 11, 2022
ef2ac53
windows support
mibmo Jun 11, 2022
29cfebd
use runner.os envs instead
mibmo Jun 11, 2022
8b26602
rename CI action script
mibmo Jun 11, 2022
2fd0dbb
run tests
mibmo Jun 11, 2022
ec0b7bc
use env for go version
mibmo Jun 11, 2022
91f3d2b
use proper OS names for artifacts
mibmo Jun 11, 2022
3840e5d
remove unnecessary job dependency
mibmo Jun 11, 2022
00fcfd0
add go modules
mibmo Jun 11, 2022
02b1715
run tests using dependencies from build step
mibmo Jun 11, 2022
5ce4a23
fixes building with newer versions of MSYS
mibmo Jun 17, 2022
4cd0228
run on pull request & release
mibmo Jul 14, 2022
5460658
Merge branch 'cretz:master' into ci
mibmo Apr 10, 2023
126ff1e
use caching for tests instead
mibmo Apr 10, 2023
f6451a1
make cache key dependent on submodule versions
mibmo Apr 10, 2023
afe5804
don't use deprecated set-output command
mibmo Apr 10, 2023
21824c5
better job names
mibmo Apr 10, 2023
0b83ed9
cache binary builds too
mibmo Apr 10, 2023
bd09bf3
use actual files for computing project hash
mibmo Apr 10, 2023
0b122a7
don't use legacy backticks
mibmo Apr 10, 2023
815ca9b
update go to 1.20
mibmo Apr 10, 2023
dfcc4db
install build tools on windows
mibmo Apr 11, 2023
5dd85d2
use msys2
mibmo Apr 11, 2023
744513a
debug windows' hash key
mibmo Apr 11, 2023
056abbb
typo
mibmo Apr 11, 2023
eb89253
disable caching on windows
mibmo Apr 11, 2023
5550fbd
reenable other builders
mibmo Apr 11, 2023
907f90c
use correct nomenclature
mibmo Apr 11, 2023
6448239
remove redundant comment
mibmo Apr 11, 2023
655eb6c
install dependencies for tests too
mibmo Apr 11, 2023
88b76e0
add triple to tests job name
mibmo Apr 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions .appveyor.yml

This file was deleted.

166 changes: 166 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
name: Build static binaries

on:
push:
pull_request:
release:
types: [created]

env:
GO_VERSION_SPECIFIER: '^1.20.0'

jobs:
build:
name: Build for ${{ matrix.triple }}
runs-on: ${{ matrix.runner-os}}
strategy:
fail-fast: false
matrix:
include:
- runner-os: ubuntu-latest
triple: x86_64-unknown-linux-gnu
use-caching: true
- runner-os: macos-latest
triple: x86_64-apple-darwin
use-caching: true
- runner-os: windows-latest
triple: x86_64-pc-windows-gnu
use-caching: false
steps:
- name: install build tools [linux]
if: runner.os == 'linux'
run: sudo apt-get install build-essential libtool autopoint
- name: Install build tools [mac]
if: runner.os == 'macOS'
run: brew install libtool automake gettext
- name: Install build tools [windows]
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
update: true
install:
base-devel
git
subversion
mercurial
libtool
automake
autoconf
automake-wrapper
mingw-w64-i686-toolchain
mingw-w64-x86_64-toolchain
mingw-w64-i686-cmake
mingw-w64-x86_64-cmake

- name: Checkout repository
uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION_SPECIFIER }}
- name: Compute cache key
if: matrix.use-caching
id: cache-data
run: echo "key=${{ runner.os }}-deps-$(git submodule status | sha256sum | cut -d ' ' -f1)" >> $GITHUB_OUTPUT
- name: Cache dependencies
if: matrix.use-caching
id: cache-deps
uses: actions/cache@v3
with:
key: ${{ steps.cache-data.outputs.key }}
path: |
PROJECT_HASH
libevent
openssl
tor
xz
zlib
- name: Download dependencies
if: ${{ steps.cache-deps.outputs.cache-hit != 'true' }}
run: git submodule update --init --recursive
- name: Check if rebuild needed
if: matrix.use-caching
id: check-rebuild
run: |
hash="$(sha256sum go.sum build.go build_test.go | cut -d ' ' -f1)"
rebuild="true"
[ "$(cat PROJECT_HASH)" == "$hash" ] && rebuild="false"
echo "$hash" > PROJECT_HASH
echo "rebuild_needed=$rebuild" >> $GITHUB_OUTPUT
- name: Build dependencies
if: ${{ steps.check-rebuild.outputs.rebuild_needed != 'true' }}
run: go run build.go -verbose build-all
- name: Upload tor binary
uses: actions/upload-artifact@v3
with:
name: tor-${{ runner.os }}
path:
tor/src/app/tor

test:
name: Tests ${{ matrix.triple }}
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- runner-os: ubuntu-latest
triple: x86_64-unknown-linux-gnu
use-caching: true
- runner-os: macos-latest
triple: x86_64-apple-darwin
use-caching: true
- runner-os: windows-latest
triple: x86_64-pc-windows-gnu
use-caching: false
steps:
- name: install build tools [linux]
if: runner.os == 'linux'
run: sudo apt-get install build-essential libtool autopoint
- name: Install build tools [mac]
if: runner.os == 'macOS'
run: brew install libtool automake gettext
- name: Install build tools [windows]
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
update: true
install:
base-devel
git
subversion
mercurial
libtool
automake
autoconf
automake-wrapper
mingw-w64-i686-toolchain
mingw-w64-x86_64-toolchain
mingw-w64-i686-cmake
mingw-w64-x86_64-cmake

- name: Checkout repository
uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION_SPECIFIER }}
- name: Compute cache key
if: matrix.use-caching
id: cache-data
run: echo "key=${{ runner.os }}-deps-$(git submodule status | sha256sum | cut -d ' ' -f1)" >> $GITHUB_OUTPUT
- name: Cache dependencies
if: matrix.use-caching
id: cache-deps
uses: actions/cache@v3
with:
key: ${{ steps.cache-data.outputs.key }}
path: |
libevent
openssl
tor
xz
zlib
- name: Run tests
run: go test .
50 changes: 0 additions & 50 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion build.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func validateEnvironment() error {
// Confirm it is MinGW 64
if byts, err := exec.Command("uname", "-a").CombinedOutput(); err != nil {
return fmt.Errorf("This has to be run in a MSYS or MinGW shell, uname failed: %v", err)
} else if !bytes.HasPrefix(byts, []byte("MINGW64")) && !bytes.HasPrefix(byts, []byte("MSYS2")) {
} else if !bytes.HasPrefix(byts, []byte("MINGW64")) && !bytes.HasPrefix(byts, []byte("MSYS2")) && !bytes.HasPrefix(byts, []byte("MSYS_NT")) {
return fmt.Errorf("This has to be run in a MSYS or MinGW64 shell, uname output: %v", string(byts))
}
case "linux":
Expand Down
11 changes: 11 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module github.com/cretz/tor-static

go 1.20

require github.com/cretz/bine v0.2.0

require (
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 // indirect
golang.org/x/sys v0.0.0-20210423082822-04245dca01da // indirect
)
24 changes: 24 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
github.com/cretz/bine v0.2.0 h1:8GiDRGlTgz+o8H9DSnsl+5MeBK4HsExxgl6WgzOCuZo=
github.com/cretz/bine v0.2.0/go.mod h1:WU4o9QR9wWp8AVKtTM1XD5vUHkEqnf2vVSo6dBqbetI=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 h1:wjuX4b5yYQnEQHzd+CBcrcC6OVR2J1CN6mUy0oSxIPo=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=