| 1 | name: Migrations & Update |
| 2 | |
| 3 | on: |
| 4 | workflow_dispatch: |
| 5 | pull_request: |
| 6 | paths: |
| 7 | # Migration implementation files |
| 8 | - 'repo/fsrepo/migrations/**' |
| 9 | - 'test/cli/migrations/**' |
| 10 | # Config and repo handling |
| 11 | - 'repo/fsrepo/**' |
| 12 | # Update command |
| 13 | - 'core/commands/update*.go' |
| 14 | - 'test/cli/update_test.go' |
| 15 | # This workflow file itself |
| 16 | - '.github/workflows/test-migrations.yml' |
| 17 | push: |
| 18 | branches: |
| 19 | - 'master' |
| 20 | - 'release-*' |
| 21 | paths: |
| 22 | - 'repo/fsrepo/migrations/**' |
| 23 | - 'test/cli/migrations/**' |
| 24 | - 'repo/fsrepo/**' |
| 25 | - 'core/commands/update*.go' |
| 26 | - 'test/cli/update_test.go' |
| 27 | - '.github/workflows/test-migrations.yml' |
| 28 | |
| 29 | concurrency: |
| 30 | group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }} |
| 31 | cancel-in-progress: true |
| 32 | |
| 33 | jobs: |
| 34 | test: |
| 35 | strategy: |
| 36 | fail-fast: false |
| 37 | matrix: |
| 38 | os: [ubuntu-latest, windows-latest, macos-latest] |
| 39 | runs-on: ${{ matrix.os }} |
| 40 | timeout-minutes: 20 |
| 41 | env: |
| 42 | TEST_VERBOSE: 1 |
| 43 | IPFS_CHECK_RCMGR_DEFAULTS: 1 |
| 44 | defaults: |
| 45 | run: |
| 46 | shell: bash |
| 47 | steps: |
| 48 | - name: Check out Kubo |
| 49 | uses: actions/checkout@v6 |
| 50 | |
| 51 | - name: Set up Go |
| 52 | uses: actions/setup-go@v6 |
| 53 | with: |
| 54 | go-version-file: 'go.mod' |
| 55 | |
| 56 | - name: Build kubo binary |
| 57 | run: | |
| 58 | make build |
| 59 | echo "Built ipfs binary at $(pwd)/cmd/ipfs/" |
| 60 | |
| 61 | - name: Add kubo to PATH |
| 62 | run: | |
| 63 | echo "$(pwd)/cmd/ipfs" >> $GITHUB_PATH |
| 64 | |
| 65 | - name: Verify ipfs in PATH |
| 66 | run: | |
| 67 | which ipfs || echo "ipfs not in PATH" |
| 68 | ipfs version || echo "Failed to run ipfs version" |
| 69 | |
| 70 | - name: Run migration unit tests |
| 71 | run: | |
| 72 | go test ./repo/fsrepo/migrations/... |
| 73 | |
| 74 | - name: Run CLI migration tests |
| 75 | env: |
| 76 | IPFS_PATH: ${{ runner.temp }}/ipfs-test |
| 77 | run: | |
| 78 | export PATH="${{ github.workspace }}/cmd/ipfs:$PATH" |
| 79 | which ipfs || echo "ipfs not found in PATH" |
| 80 | ipfs version || echo "Failed to run ipfs version" |
| 81 | go test ./test/cli/migrations/... |
| 82 | |
| 83 | # GitHub's macOS runners occasionally lose DNS for api.github.com, |
| 84 | # which breaks the real-network subtests in TestUpdate (see run |
| 85 | # 24222365595). Point the resolver at Cloudflare and Google so the |
| 86 | # runner is insulated from flaky upstream DNS. |
| 87 | - name: Configure DNS (macOS) |
| 88 | if: runner.os == 'macOS' |
| 89 | run: | |
| 90 | networksetup -listallnetworkservices | tail -n +2 | while read -r svc; do |
| 91 | sudo networksetup -setdnsservers "$svc" 1.1.1.1 8.8.8.8 || true |
| 92 | done |
| 93 | sudo dscacheutil -flushcache |
| 94 | sudo killall -HUP mDNSResponder || true |
| 95 | scutil --dns | head -20 || true |
| 96 | |
| 97 | - name: Run CLI update tests |
| 98 | env: |
| 99 | IPFS_PATH: ${{ runner.temp }}/ipfs-update-test |
| 100 | GITHUB_TOKEN: ${{ github.token }} |
| 101 | run: | |
| 102 | export PATH="${{ github.workspace }}/cmd/ipfs:$PATH" |
| 103 | go test -run "TestUpdate" ./test/cli/... |
| 104 | |
| 105 | - name: Upload test results |
| 106 | if: always() |
| 107 | uses: actions/upload-artifact@v7 |
| 108 | with: |
| 109 | name: ${{ matrix.os }}-test-results |
| 110 | path: | |
| 111 | test/**/*.log |
| 112 | ${{ runner.temp }}/ipfs-test/ |
| 113 | ${{ runner.temp }}/ipfs-update-test/ |