Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #157 from ipfs/web3-bot/sync
Browse files Browse the repository at this point in the history
sync: update CI config files
  • Loading branch information
galargh committed Oct 1, 2022
2 parents 07b4d72 + ae51e48 commit 171fcd5
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 109 deletions.
6 changes: 3 additions & 3 deletions .github/actions/go-test-setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: installipfs
description: install go-ipfs
description: install kubo

runs:
using: "composite"
steps:
- name: Install go-ipfs
- name: Install kubo
shell: bash
run: (cd /tmp && go install github.com/ipfs/go-ipfs/cmd/ipfs@master)
run: (cd /tmp && go install github.com/ipfs/kubo/cmd/ipfs@master)
50 changes: 4 additions & 46 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,11 @@
# File managed by web3-bot. DO NOT EDIT.
# See https://github.com/protocol/.github/ for details.

# Automatically merge pull requests opened by web3-bot, as soon as (and only if) all tests pass.
# This reduces the friction associated with updating with our workflows.

on: [ pull_request ]
name: Automerge
on: [ pull_request ]

jobs:
automerge-check:
if: github.event.pull_request.user.login == 'web3-bot'
runs-on: ubuntu-latest
outputs:
status: ${{ steps.should-automerge.outputs.status }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check if we should automerge
id: should-automerge
run: |
for commit in $(git rev-list --first-parent origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }}); do
committer=$(git show --format=$'%ce' -s $commit)
echo "Committer: $committer"
if [[ "$committer" != "web3-bot@users.noreply.github.com" ]]; then
echo "Commit $commit wasn't committed by web3-bot, but by $committer."
echo "::set-output name=status::false"
exit
fi
done
echo "::set-output name=status::true"
automerge:
needs: automerge-check
runs-on: ubuntu-latest
# The check for the user is redundant here, as this job depends on the automerge-check job,
# but it prevents this job from spinning up, just to be skipped shortly after.
if: github.event.pull_request.user.login == 'web3-bot' && needs.automerge-check.outputs.status == 'true'
steps:
- name: Wait on tests
uses: lewagon/wait-on-check-action@bafe56a6863672c681c3cf671f5e10b20abf2eaa # v0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
running-workflow-name: 'automerge' # the name of this job
- name: Merge PR
uses: pascalgn/automerge-action@741c311a47881be9625932b0a0de1b0937aab1ae # v0.13.1
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: ""
MERGE_METHOD: "squash"
MERGE_DELETE_BRANCH: true
uses: protocol/.github/.github/workflows/automerge.yml@master
with:
job: 'automerge'
9 changes: 4 additions & 5 deletions .github/workflows/go-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
env:
RUNGOGENERATE: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
go-version: "1.17.x"
go-version: "1.19.x"
- name: Run repo-specific setup
uses: ./.github/actions/go-check-setup
if: hashFiles('./.github/actions/go-check-setup') != ''
Expand All @@ -27,7 +27,7 @@ jobs:
echo "RUNGOGENERATE=true" >> $GITHUB_ENV
fi
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@c8caa92bad8c27ae734c6725b8a04932d54a147b # 2021.1.2 (v0.2.2)
run: go install honnef.co/go/tools/cmd/staticcheck@376210a89477dedbe6fdc4484b233998650d7b3c # 2022.1.3 (v0.3.3)
- name: Check that go.mod is tidy
uses: protocol/multiple-go-modules@v1.2
with:
Expand Down Expand Up @@ -71,4 +71,3 @@ jobs:
git status --short
exit 1
fi
18 changes: 10 additions & 8 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ jobs:
fail-fast: false
matrix:
os: [ "ubuntu", "windows", "macos" ]
go: [ "1.17.x", "1.18.x" ]
go: [ "1.18.x", "1.19.x" ]
env:
COVERAGES: ""
runs-on: ${{ matrix.os }}-latest
name: ${{ matrix.os}} (go ${{ matrix.go }})
runs-on: ${{ format('{0}-latest', matrix.os) }}
name: ${{ matrix.os }} (go ${{ matrix.go }})
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Go information
Expand All @@ -43,14 +43,16 @@ jobs:
# Use -coverpkg=./..., so that we include cross-package coverage.
# If package ./A imports ./B, and ./A's tests also cover ./B,
# this means ./B's coverage will be significantly higher than 0%.
run: go test -v -coverprofile=module-coverage.txt -coverpkg=./... ./...
run: go test -v -shuffle=on -coverprofile=module-coverage.txt -coverpkg=./... ./...
- name: Run tests (32 bit)
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
uses: protocol/multiple-go-modules@v1.2
env:
GOARCH: 386
with:
run: go test -v ./...
run: |
export "PATH=${{ env.PATH_386 }}:$PATH"
go test -v -shuffle=on ./...
- name: Run tests with race detector
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
uses: protocol/multiple-go-modules@v1.2
Expand All @@ -60,7 +62,7 @@ jobs:
shell: bash
run: echo "COVERAGES=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
- name: Upload coverage to Codecov
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0
with:
files: '${{ env.COVERAGES }}'
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}
3 changes: 1 addition & 2 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package httpapi
import (
"errors"
"fmt"
"io/ioutil"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -74,7 +73,7 @@ func ApiAddr(ipfspath string) (ma.Multiaddr, error) {

apiFile := filepath.Join(baseDir, DefaultApiFile)

api, err := ioutil.ReadFile(apiFile)
api, err := os.ReadFile(apiFile)
if err != nil {
return nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package httpapi

import (
"context"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
Expand Down Expand Up @@ -92,7 +91,7 @@ func (np *NodeProvider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n i

func (NodeProvider) makeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]iface.CoreAPI, error) {

dir, err := ioutil.TempDir("", "httpapi-tb-")
dir, err := os.MkdirTemp("", "httpapi-tb-")
if err != nil {
return nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions apifile.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"

"github.com/ipfs/go-cid"
files "github.com/ipfs/go-ipfs-files"
Expand Down Expand Up @@ -113,7 +112,7 @@ func (f *apiFile) Seek(offset int64, whence int) (int64, error) {
}

if f.at < offset && offset-f.at < forwardSeekLimit { //forward skip
r, err := io.CopyN(ioutil.Discard, f.r.Output, offset-f.at)
r, err := io.CopyN(io.Discard, f.r.Output, offset-f.at)

f.at += r
return f.at, err
Expand Down
4 changes: 2 additions & 2 deletions dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"context"
"fmt"
"io/ioutil"
"io"

blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
Expand All @@ -24,7 +24,7 @@ func (api *HttpDagServ) Get(ctx context.Context, c cid.Cid) (format.Node, error)
return nil, err
}

data, err := ioutil.ReadAll(r)
data, err := io.ReadAll(r)
if err != nil {
return nil, err
}
Expand Down
3 changes: 0 additions & 3 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func parseErrNotFoundWithFallbackToError(msg error) error {
return msg
}

//lint:ignore ST1008 this function is not using the error as a mean to return failure but it massages it to return the correct type
func parseErrNotFound(msg string) (error, bool) {
if msg == "" {
return nil, true // Fast path
Expand All @@ -72,7 +71,6 @@ func parseErrNotFound(msg string) (error, bool) {
// - Double Quotes: "\"" this is for parsing %q and %#v formating
const cidBreakSet = " \t\n\r\v\f;\""

//lint:ignore ST1008 using error as values
func parseIPLDErrNotFound(msg string) (error, bool) {
// The patern we search for is:
const ipldErrNotFoundKey = "ipld: could not find " /*CID*/
Expand Down Expand Up @@ -159,7 +157,6 @@ func (e blockstoreNotFoundMatchingIPLDErrNotFound) Is(err error) bool {
return ok
}

//lint:ignore ST1008 using error as values
func parseBlockstoreNotFound(msg string) (error, bool) {
if !strings.Contains(msg, "blockstore: block not found") {
return nil, false
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ require (
lukechampine.com/blake3 v1.1.6 // indirect
)

go 1.17
go 1.18

0 comments on commit 171fcd5

Please sign in to comment.