Skip to content

Commit

Permalink
fix(ci): workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Apr 16, 2023
1 parent adb91ff commit bfe5879
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@ jobs:
strategy:
matrix:
go-version: ["^1", "1.18"]
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest] #windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- run: |
diff --version
patch --version
- if: "${{ matrix.os == 'windows-latest' }}"
run: |
git config --global core.autocrlf input
git config --global core.eol lf
- run: go build -v ./...
- run: go test -v ./...
- run: go test -v -fuzz=FuzzRoundTrip -fuzztime=1m .
Expand Down
23 changes: 9 additions & 14 deletions .github/workflows/import.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: import upstream

on:
schedule:
- "0 0 * * 0"
- cron: "0 0 * * 0"
workflow_dispatch:

jobs:
Expand All @@ -13,22 +13,22 @@ jobs:
- run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- run: |
- id: tools
run: |
# Clone the repository to a temporary directory.
tmpdir=$(mktemp -d)
tools=$(tmpdir)/tools
tools=$(mktemp -d)/tools
git clone --depth 1 "https://github.com/golang/tools" "$tools"
echo "tools=$tools" >> $GITHUB_ENV)"
echo "tools=$tools" >> $GITHUB_ENV
# Copy the diff package to the current directory.
cp -r "$tmpdir/tools/internal/diff/"* .
cp -r "$tools/internal/diff/"* .
# Replace the import path.
find . -type f -name '*.go' -exec sed -i '' 's|golang.org/x/tools/internal/diff/|github.com/aymanbagabas/go-udiff/|g' {} +
find . -type f -name '*.go' -exec sed -i '' 's|"golang.org/x/tools/internal/diff|diff "github.com/aymanbagabas/go-udiff|g' {} +
find . -type f -name '*.go' -exec sed -i'' 's|golang.org/x/tools/internal/diff/|github.com/aymanbagabas/go-udiff/|g' {} +
find . -type f -name '*.go' -exec sed -i'' 's|"golang.org/x/tools/internal/diff|diff "github.com/aymanbagabas/go-udiff|g' {} +
# Change package name to udiff.
sed -i '' 's|package diff|package udiff|g' *.go
sed -i'' 's|package diff|package udiff|g' *.go
# Apply patches
git apply _patches/0001-fix-remove-testenv.patch
Expand All @@ -44,11 +44,6 @@ jobs:
if ! git update-index --refresh || ! git diff-index --quiet HEAD --; then
echo "$commit" > .github/UPSTREAM
fi
id: tools
- run: |
id: base
- run: |
id: commit
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v5
Expand Down

0 comments on commit bfe5879

Please sign in to comment.