From 89e6f2aac8b7f2649de44471ba50352fc1ad0497 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 12 May 2025 13:02:57 +1000 Subject: [PATCH] Include Rust toolchain --- .github/actions/go-common/action.yml | 61 ------------ .github/workflows/go.yml | 133 +++++---------------------- .gitmodules | 3 + storage/possum/lib | 1 + 4 files changed, 29 insertions(+), 169 deletions(-) delete mode 100644 .github/actions/go-common/action.yml create mode 100644 .gitmodules create mode 160000 storage/possum/lib diff --git a/.github/actions/go-common/action.yml b/.github/actions/go-common/action.yml deleted file mode 100644 index a0116127..00000000 --- a/.github/actions/go-common/action.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: 'Common Go' -description: 'Checks out, and handles Go setup and caching' -runs: - using: "composite" - steps: - - name: Set up Go - if: matrix.go-version != 'tip' - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - # The OS defines the directories to use, then this is specific to go. The go version could - # affect the dependencies. The job can affect what is actually downloaded, and provides - # collision resistance. Finally, the hash of the go.sum files ensures a new cache is created - # when the dependencies change. Note if this were just a mod cache, we might do this based - # on time or something. - key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ github.job }}-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go-${{ matrix.go-version }}-${{ github.job }}- - ${{ runner.os }}-go-${{ matrix.go-version }}- - ${{ runner.os }}-go- - - run: | - echo GOTIP_REVISION="`git ls-remote https://github.com/golang/go refs/heads/master | cut -f1`" >> "$GITHUB_ENV" - echo GOTIP_PATH="$HOME/gotip" >> "$GITHUB_ENV" - if: matrix.go-version == 'tip' - shell: bash - - uses: actions/cache@v3 - if: matrix.go-version == 'tip' - with: - path: | - ${{ env.GOTIP_PATH }} - # The build varies by OS (and arch, but I haven't bothered to add that yet.) We always want - # the latest snapshot that works for us, the revision is only used to store differentiate - # builds. - key: gotip-ls-remote-${{ runner.os }}-${{ env.GOTIP_REVISION }} - restore-keys: | - gotip-ls-remote-${{ runner.os }}-${{ env.GOTIP_REVISION }} - gotip-ls-remote-${{ runner.os }}- - gotip-env-home-${{ runner.os }}- - gotip-${{ runner.os }}- - - name: Install gotip - if: matrix.go-version == 'tip' - run: | - git clone --depth=1 https://github.com/golang/go "$GOTIP_PATH" || true - cd "$GOTIP_PATH" - git pull - echo "GOROOT=$GOTIP_PATH" >> "$GITHUB_ENV" - echo "$(go env GOPATH)/bin:$PATH" >> "$GITHUB_PATH" - echo "$GOTIP_PATH/bin:$PATH" >> "$GITHUB_PATH" - echo "anacrolix.built:" $(cat anacrolix.built) - [[ -x bin/go && `git rev-parse HEAD` == `cat anacrolix.built` ]] && exit - cd src - ./make.bash || exit - git rev-parse HEAD > ../anacrolix.built - env - shell: bash - diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 1cc2f601..d1d216bd 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -3,117 +3,34 @@ name: Go on: [push, pull_request] jobs: - test: - timeout-minutes: 10 runs-on: ${{ matrix.os }} strategy: matrix: - go-version: [ '1.22' ] + go-version: ["1.22", "1.23", "1.24"] os: [windows-latest, macos-latest, ubuntu-latest] - fail-fast: false - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/go-common - - run: go test -race $(go list ./... | grep -v /fs | grep -v /possum) - continue-on-error: true - - run: go test -race -timeout 1m ./fs/... - if: ${{ ! contains(matrix.os, 'windows') }} - continue-on-error: true - - test-benchmarks: - runs-on: ubuntu-latest - strategy: - matrix: - go-version: [ '1.22' ] - fail-fast: false - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/go-common - - run: go test -race -run @ -bench . -benchtime 2x $(go list ./... | grep -v /possum) - - bench: - runs-on: ubuntu-latest - strategy: - matrix: - go-version: [ '1.22' ] - fail-fast: false - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/go-common - - run: go test -run @ -bench . $(go list ./... | grep -v /possum) - - test-386: - timeout-minutes: 5 - runs-on: ubuntu-latest - strategy: - matrix: - go-version: [ '1.22' ] - fail-fast: false steps: - - uses: actions/checkout@v2 - - uses: ./.github/actions/go-common - - run: GOARCH=386 go test -run @ $(go list ./... | grep -v /possum) - - build-wasm: - runs-on: ubuntu-latest - strategy: - matrix: - go-version: [ '1.22' ] - fail-fast: false - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/go-common - - name: Some packages compile for WebAssembly - run: GOOS=js GOARCH=wasm go build . ./storage ./tracker/... - - torrentfs-linux: - continue-on-error: true - timeout-minutes: 5 - runs-on: ${{ matrix.os }} - strategy: - matrix: - go-version: [ '1.22' ] - os: [ubuntu-latest] - fail-fast: false - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/go-common - - - name: Install godo - run: | - # Need master for cross-compiling fix - go install -v -x github.com/anacrolix/godo@v1 - echo $PATH - - - name: Apt packages - run: sudo apt install pv fuse - - - name: torrentfs end-to-end test - # Test on 386 for atomic alignment and other bad 64-bit assumptions - run: GOARCH=386 fs/test.sh - - run: mount - -# Github broke FUSE on MacOS, I'm not sure what the state is. - -# torrentfs-macos: -# timeout-minutes: 15 -# runs-on: ${{ matrix.os }} -# strategy: -# matrix: -# go-version: [ '1.20' ] -# os: [macos-latest] -# fail-fast: false -# steps: -# - uses: actions/checkout@v2 -# - uses: ./.github/actions/go-common -# -# - run: brew install macfuse pv md5sha1sum bash -# -# - name: Install godo -# run: go install -v github.com/anacrolix/godo@master -# -# - name: torrentfs end-to-end test -# run: fs/test.sh -# # Pretty sure macos on GitHub CI has issues with the fuse driver now. -# continue-on-error: true + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + - uses: dtolnay/rust-toolchain@stable + - name: Build possum + run: | + cd storage/possum/lib + cargo build --lib + - run: go test -race -bench . -benchtime 2x ./... + + # Test on 386 for atomic alignment and other bad 64-bit assumptions + - run: GOARCH=386 go test -run @ ./... + - name: Some packages compile for WebAssembly + run: GOOS=js GOARCH=wasm go build . ./storage ./tracker/... + - run: | + brew install macfuse pv md5sha1sum bash + - run: | + # Need master for cross-compiling fix + go install -v -x github.com/anacrolix/godo@v1 + echo $PATH + sudo apt install pv fuse + GOARCH=386 fs/test.sh + mount diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..7831421f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "storage/possum/lib"] + path = storage/possum/lib + url = https://github.com/anacrolix/possum diff --git a/storage/possum/lib b/storage/possum/lib new file mode 160000 index 00000000..e6e74029 --- /dev/null +++ b/storage/possum/lib @@ -0,0 +1 @@ +Subproject commit e6e74029ad4bc8b7e5daa66d27c10e93471471af -- 2.51.0