Skip to content

Commit

Permalink
Base builder and test file generator
Browse files Browse the repository at this point in the history
  • Loading branch information
KobeArthurScofield authored Dec 30, 2024
1 parent eaa0ee0 commit e58d1fe
Show file tree
Hide file tree
Showing 3 changed files with 252 additions and 0 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build patched Go and release

on:
workflow_dispatch:
release:
types: [published]
push:
branches:
- build
paths:
- ".github/workflows/release.yml"
pull_request:
types: [opened, synchronize, reopened]
paths:
- ".github/workflows/release.yml"

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
goos: [windows, linux]
goarch: [amd64, 386]
buildtarget: ['go1.23.4']
fail-fast: false
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
steps:
- name: Show workflow information
run: |
_NAME="$GOOS-$GOARCH"
echo "GOOS: $GOOS, GOARCH: $GOARCH, GOVER: ${{ matrix.buildtarget }}"
echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV
- name: Set-up Go
uses: actions/setup-go@v5
with:
go-version: stable
check-latest: true

- name: Download source
uses: actions/checkout@v4
with:
repository: 'golang/go'
ref: ${{ matrix.buildtarget }}

# Patches for Go 1.23.x before more minor changes introduces.
- name: Apply patch
run: |
curl https://github.com/XTLS/go-win7/commit/429f9a72007759a757c8e96a2763306c076dbb8f.diff | patch --verbose -p 1
curl https://github.com/XTLS/go-win7/commit/ca03d8ed77dab8b91b69a9d44e6e56844fbcd5d8.diff | patch --verbose -p 1
curl https://github.com/XTLS/go-win7/commit/719ab22f14443a88dd274f7a41afb86dd41628b1.diff | patch --verbose -p 1
curl https://github.com/XTLS/go-win7/commit/ac17c301268dd7835236e61c9bfefdf2b8e633d5.diff | patch --verbose -p 1
- name: Build patched Go
run: |
cd ./src
. ./all.bash
cd ..
- name: create ZIP archive
shell: bash
run: |
zip -9vr ./go-for-win7-${{ env.ASSET_NAME }}.zip .
- name: Upload package to Artifacts
uses: actions/upload-artifact@v4
with:
name: go-for-win7-${{ env.ASSET_NAME }}
path: |
./go-for-win7-${{ env.ASSET_NAME }}.zip
- name: Compute hashes for file
if: github.event_name == 'release'
run: |
FILE=./go-for-win7-${{ env.ASSET_NAME }}.zip
DGST=$FILE.dgst
for METHOD in {"md5","sha1","sha256","sha512"}
do
openssl dgst -$METHOD $FILE | sed 's/([^)]*)//g' >>$DGST
done
- name: Upload packages to release
uses: svenstaro/upload-release-action@v2
if: github.event_name == 'release'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./go-for-win7-${{ env.ASSET_NAME }}.zip*
tag: ${{ github.ref }}
file_glob: true
79 changes: 79 additions & 0 deletions .github/workflows/test-go1_23.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build patched Go 1.23 for tests

on:
workflow_dispatch:
push:
branches:
- build
- release-branch.go1.23
paths:
- ".github/workflows/test-go1_23.yml"
- "**/*.go"
pull_request:
types: [opened, synchronize, reopened]
branches:
- build
- release-branch.go1.23
paths:
- ".github/workflows/test-go1_23.yml"
- "**/*.go"

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
goos: [windows]
goarch: [amd64, 386]
buildtarget: ['release-branch.go1.23']
fail-fast: false
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
steps:
- name: Show workflow information
run: |
_NAME="$GOOS-$GOARCH"
echo "GOOS: $GOOS, GOARCH: $GOARCH, APPLY-BRANCH: ${{ matrix.buildtarget }}"
echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV
- name: Set-up Go
uses: actions/setup-go@v5
with:
go-version: stable
check-latest: true

- name: Download source
uses: actions/checkout@v4
with:
repository: 'golang/go'
ref: ${{ matrix.buildtarget }}

# Patches for Go 1.23.x before more minor changes introduces.
- name: Apply patch
run: |
curl https://github.com/XTLS/go-win7/commit/429f9a72007759a757c8e96a2763306c076dbb8f.diff | patch --verbose -p 1
curl https://github.com/XTLS/go-win7/commit/ca03d8ed77dab8b91b69a9d44e6e56844fbcd5d8.diff | patch --verbose -p 1
curl https://github.com/XTLS/go-win7/commit/719ab22f14443a88dd274f7a41afb86dd41628b1.diff | patch --verbose -p 1
curl https://github.com/XTLS/go-win7/commit/ac17c301268dd7835236e61c9bfefdf2b8e633d5.diff | patch --verbose -p 1
- name: Build patched Go
run: |
cd ./src
. ./all.bash
cd ..
- name: create ZIP archive
shell: bash
run: |
zip -9vr ./go-for-win7-${{ env.ASSET_NAME }}.zip .
- name: Upload package to Artifacts
uses: actions/upload-artifact@v4
with:
name: go-for-win7-${{ env.ASSET_NAME }}
path: |
./go-for-win7-${{ env.ASSET_NAME }}.zip
79 changes: 79 additions & 0 deletions .github/workflows/test-go1_24.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build patched Go 1.24 for tests

on:
workflow_dispatch:
push:
branches:
- build
- release-branch.go1.24
paths:
- ".github/workflows/test-go1_24.yml"
- "**/*.go"
pull_request:
types: [opened, synchronize, reopened]
branches:
- build
- release-branch.go1.24
paths:
- ".github/workflows/test-go1_24.yml"
- "**/*.go"

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
goos: [windows]
goarch: [amd64, 386]
buildtarget: ['release-branch.go1.24']
fail-fast: false
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
steps:
- name: Show workflow information
run: |
_NAME="$GOOS-$GOARCH"
echo "GOOS: $GOOS, GOARCH: $GOARCH, APPLY-BRANCH: ${{ matrix.buildtarget }}"
echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV
- name: Set-up Go
uses: actions/setup-go@v5
with:
go-version: stable
check-latest: true

- name: Download source
uses: actions/checkout@v4
with:
repository: 'golang/go'
ref: ${{ matrix.buildtarget }}

# Patches for Go 1.24.x before more minor changes introduces.
- name: Apply patch
run: |
curl https://github.com/XTLS/go-win7/commit/f429f15f6305e4432afd7309b317e903bd76a5c0.diff | patch --verbose -p 1
curl https://github.com/XTLS/go-win7/commit/41f545de980e9285b68ece40d4b4e63feef9c5a1.diff | patch --verbose -p 1
curl https://github.com/XTLS/go-win7/commit/b6c99a977f732ee5553ddc75ae0fe3b47927fc1c.diff | patch --verbose -p 1
curl https://github.com/XTLS/go-win7/commit/36d7775e030192d3bf2dc111d1f6cfa89eae5f0c.diff | patch --verbose -p 1
- name: Build patched Go
run: |
cd ./src
. ./all.bash
cd ..
- name: create ZIP archive
shell: bash
run: |
zip -9vr ./go-for-win7-${{ env.ASSET_NAME }}.zip .
- name: Upload package to Artifacts
uses: actions/upload-artifact@v4
with:
name: go-for-win7-${{ env.ASSET_NAME }}
path: |
./go-for-win7-${{ env.ASSET_NAME }}.zip

0 comments on commit e58d1fe

Please sign in to comment.