Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Windows ARM64 POC #347

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ jobs:
- os: windows-2019
friendlyName: Windows
targetPlatform: win32
- os: windows-2019
friendlyName: Windows
targetPlatform: win32
arch: arm64
- os: ubuntu-18.04
friendlyName: Linux
targetPlatform: ubuntu
Expand Down Expand Up @@ -113,7 +117,7 @@ jobs:
- name: Generate release notes
run: |
npm ci
node -r ts-node/register script/generate-release-notes.ts "${{ github.workspace }}/artifacts" "${{ env.DUGITE_TAG }}" "${{ secrets.GITHUB_TOKEN }}"
node -r ts-node/register script/generate-release-notes.ts "${{ github.workspace }}/artifacts" "${{ env.DUGITE_TAG }}" "${{ secrets.GITHUB_TOKEN }}" "${{ github.repository_owner }}"
RELEASE_NOTES_FILE=script/release_notes.txt
if [[ ! -f "$RELEASE_NOTES_FILE" ]]; then
echo "$RELEASE_NOTES_FILE does not exist. Something might have gone wrong while generating the release notes."
Expand Down
9 changes: 8 additions & 1 deletion dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
"filename": "MinGit-2.29.2.3-32-bit.zip",
"url": "https://github.com/git-for-windows/git/releases/download/v2.29.2.windows.3/MinGit-2.29.2.3-32-bit.zip",
"checksum": "e2b7302b2cb013a27984ba65aeff11030b32b7e19deb228304e3e5b85b31befd"
},
{
"platform": "windows",
"arch": "arm64",
"filename": "MinGit-prerelease-2.31.0-rc1.windows.1-22-g5174918c60-20210308121614-arm64.zip",
"url": "https://github.com/dennisameling/git/releases/download/2.30.1-rc1/MinGit-prerelease-2.31.0-rc1.windows.1-22-g5174918c60-20210308121614-arm64.zip",
"checksum": "cde3d380d8031d4d5b7ce70a7c33452bc21cc980e1b60ed836f8a392a5cac584"
}
]
},
Expand All @@ -29,7 +36,7 @@
},
{
"platform": "windows",
"arch": "x86",
"arch": "386",
"name": "git-lfs-windows-386-v2.13.2.zip",
"checksum": "27d061f9fd6b14555c220758ae0b77d81ef20f64dde0179a515d55a75f5355a8"
},
Expand Down
37 changes: 23 additions & 14 deletions script/build-win32.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,31 @@ if [[ -z "${DESTINATION}" ]]; then
exit 1
fi

if [ "$TARGET_ARCH" = "64" ]; then
DEPENDENCY_ARCH="amd64"
MINGW_DIR="mingw64"
else
DEPENDENCY_ARCH="x86"
MINGW_DIR="mingw32"
fi
case $TARGET_ARCH in
64)
GIT_ARCH="amd64"
MINGW_DIR="mingw64"
GIT_LFS_ARCH="amd64"
;;
32)
GIT_ARCH="x86"
MINGW_DIR="mingw32"
GIT_LFS_ARCH="386"
;;
arm64)
GIT_ARCH="arm64"
MINGW_DIR="arm64"
GIT_LFS_ARCH="386"
;;
*)
die "Unsupported architecture: $TARGET_ARCH"
;;
esac

GIT_LFS_VERSION=$(jq --raw-output ".[\"git-lfs\"].version[1:]" dependencies.json)
GIT_LFS_CHECKSUM="$(jq --raw-output ".\"git-lfs\".files[] | select(.arch == \"$DEPENDENCY_ARCH\" and .platform == \"windows\") | .checksum" dependencies.json)"
GIT_FOR_WINDOWS_URL=$(jq --raw-output ".git.packages[] | select(.arch == \"$DEPENDENCY_ARCH\" and .platform == \"windows\") | .url" dependencies.json)
GIT_FOR_WINDOWS_CHECKSUM=$(jq --raw-output ".git.packages[] | select(.arch == \"$DEPENDENCY_ARCH\" and .platform == \"windows\") | .checksum" dependencies.json)
GIT_LFS_CHECKSUM="$(jq --raw-output ".\"git-lfs\".files[] | select(.arch == \"$GIT_LFS_ARCH\" and .platform == \"windows\") | .checksum" dependencies.json)"
GIT_FOR_WINDOWS_URL=$(jq --raw-output ".git.packages[] | select(.arch == \"$GIT_ARCH\" and .platform == \"windows\") | .url" dependencies.json)
GIT_FOR_WINDOWS_CHECKSUM=$(jq --raw-output ".git.packages[] | select(.arch == \"$GIT_ARCH\" and .platform == \"windows\") | .checksum" dependencies.json)

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# shellcheck source=script/compute-checksum.sh
Expand All @@ -47,7 +60,6 @@ if [[ "$GIT_LFS_VERSION" ]]; then
# download Git LFS, verify its the right contents, and unpack it
echo "-- Bundling Git LFS"
GIT_LFS_FILE=git-lfs.zip
if [ "$TARGET_ARCH" -eq "64" ]; then GIT_LFS_ARCH="amd64"; else GIT_LFS_ARCH="386"; fi
GIT_LFS_URL="https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/git-lfs-windows-${GIT_LFS_ARCH}-v${GIT_LFS_VERSION}.zip"
echo "-- Downloading from $GIT_LFS_URL"
curl -sL -o $GIT_LFS_FILE "$GIT_LFS_URL"
Expand Down Expand Up @@ -139,7 +151,4 @@ elif [[ -f "$DESTINATION/$MINGW_DIR/etc/gitattributes" ]]; then
rm "$DESTINATION/$MINGW_DIR/etc/gitattributes"
fi

echo "-- Removing legacy credential helpers"
rm "$DESTINATION/$MINGW_DIR/bin/git-credential-wincred.exe"

set +eu
28 changes: 22 additions & 6 deletions script/generate-release-notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class GenerateReleaseNotes {
// five targeted OS/arch combinations
// two files for each targeted OS/arch
// two checksum files for the previous
private SUCCESSFUL_RELEASE_FILE_COUNT = 4 * 2 * 2
private SUCCESSFUL_RELEASE_FILE_COUNT = 5 * 2 * 2
private args = process.argv.slice(2)
private expectedArgs = [
{
Expand All @@ -26,6 +26,11 @@ export default class GenerateReleaseNotes {
name: 'githubToken',
description: 'GitHub API token',
},
{
key: 3,
name: 'githubOwner',
description: 'GitHub repo owner',
},
]
private expectedArgsString = this.expectedArgs
.map(arg => `\${${arg.name}}`)
Expand All @@ -46,7 +51,11 @@ export default class GenerateReleaseNotes {
*/
private githubToken: string

private owner = 'desktop'
/**
* GitHub repo owner (different for forks)
*/
private githubOwner: string

private repo = 'dugite-native'

constructor() {
Expand All @@ -68,6 +77,7 @@ export default class GenerateReleaseNotes {
this.artifactsDir = this.args[0]
this.tagName = this.args[1]
this.githubToken = this.args[2]
this.githubOwner = this.args[3]

this.run()
}
Expand Down Expand Up @@ -99,7 +109,13 @@ export default class GenerateReleaseNotes {
process.exit(1)
}

const releaseEntries = await this.generateReleaseNotesEntries()
let releaseEntries = [
`You're working on a fork, where we can't reliably generate release notes. Therefore this message acts as a placeholder.`,
]

if (this.githubOwner === 'desktop') {
releaseEntries = await this.generateReleaseNotesEntries()
}
const draftReleaseNotes = this.generateDraftReleaseNotes(
releaseEntries,
shaEntries
Expand Down Expand Up @@ -130,7 +146,7 @@ export default class GenerateReleaseNotes {
async generateReleaseNotesEntries(): Promise<Array<string>> {
const octokit = new Octokit({ auth: `token ${this.githubToken}` })
const latestRelease = await octokit.repos.getLatestRelease({
owner: this.owner,
owner: this.githubOwner,
repo: this.repo,
})

Expand All @@ -141,7 +157,7 @@ export default class GenerateReleaseNotes {
)

const response = await octokit.repos.compareCommits({
owner: this.owner,
owner: this.githubOwner,
repo: this.repo,
base: latestReleaseTag,
head: this.tagName,
Expand Down Expand Up @@ -173,7 +189,7 @@ export default class GenerateReleaseNotes {

for (const pullRequestId of pullRequestIds) {
const result = await octokit.pulls.get({
owner: this.owner,
owner: this.githubOwner,
repo: this.repo,
pull_number: pullRequestId,
})
Expand Down
16 changes: 15 additions & 1 deletion script/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,28 @@ if ! [ -d "$DESTINATION" ]; then
exit 1
fi

case $TARGET_ARCH in
64)
ARCH=x64
;;
32)
ARCH=x86
;;
arm64)
ARCH=arm64
;;
*)
die "Unsupported architecture: $TARGET_ARCH"
;;
esac

if [ "$TARGET_PLATFORM" == "ubuntu" ]; then
GZIP_FILE="dugite-native-$VERSION-$BUILD_HASH-ubuntu.tar.gz"
LZMA_FILE="dugite-native-$VERSION-$BUILD_HASH-ubuntu.lzma"
elif [ "$TARGET_PLATFORM" == "macOS" ]; then
GZIP_FILE="dugite-native-$VERSION-$BUILD_HASH-macOS.tar.gz"
LZMA_FILE="dugite-native-$VERSION-$BUILD_HASH-macOS.lzma"
elif [ "$TARGET_PLATFORM" == "win32" ]; then
if [ "$TARGET_ARCH" -eq "64" ]; then ARCH="x64"; else ARCH="x86"; fi
GZIP_FILE="dugite-native-$VERSION-$BUILD_HASH-windows-$ARCH.tar.gz"
LZMA_FILE="dugite-native-$VERSION-$BUILD_HASH-windows-$ARCH.lzma"
else
Expand Down