Skip to content

Commit d540a91

Browse files
authored
Merge pull request #3632 from ActiveState/mitchell/dx-3211
Start building on and for ARM.
2 parents 8193d1f + 2099197 commit d540a91

File tree

14 files changed

+70
-66
lines changed

14 files changed

+70
-66
lines changed
24.6 MB
Binary file not shown.
File renamed without changes.

.github/workflows/build.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
- {os: ubuntu-latest}
4242
- {os: macos-13, shell: zsh}
4343
- {os: windows-2019}
44+
- {os: ubuntu-24.04-arm}
4445
fail-fast: false
4546
runs-on: ${{ matrix.sys.os }}
4647
env:
@@ -74,19 +75,30 @@ jobs:
7475

7576
# === Install gotestfmt ===
7677
- name: Set up gotestfmt
77-
uses: gotesttools/gotestfmt-action@v2
78-
with:
79-
token: ${{ secrets.GITHUB_TOKEN }}
78+
shell: bash
79+
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
8080

8181
- # === Install State Tool ===
8282
name: Install State Tool
8383
uses: ActiveState/setup-state-tool@v1
84+
if: "!contains(matrix.sys.os, 'arm')"
85+
86+
- # === Install State Tool (ARM64) ===
87+
name: Install State Tool (ARM64)
88+
if: contains(matrix.sys.os, 'arm')
89+
shell: bash
90+
run: |
91+
./installers/install.sh -b beta
92+
echo "$HOME/.local/ActiveState/StateTool/beta/bin" >> $GITHUB_PATH
93+
"$HOME/.local/ActiveState/StateTool/beta/bin/state" config set optin.unstable true
8494
8595
- # === Setup ===
8696
name: Setup
8797
shell: bash
8898
run: |
89-
bin=$(pwd)/.github/deps/${{ runner.os }}/bin
99+
arch="amd64"
100+
if [[ ${{ contains(matrix.sys.os, 'arm') }} = true ]]; then arch="arm64"; fi
101+
bin=$(pwd)/.github/deps/${{ runner.os }}/$arch/bin
90102
echo "Adding $bin to PATH"
91103
echo "$bin" >> $GITHUB_PATH
92104
@@ -125,7 +137,6 @@ jobs:
125137
shell: bash
126138
timeout-minutes: 15
127139
run: |
128-
export PATH="$(pwd)/.github/deps/${{ runner.os }}/bin:$PATH"
129140
parallelize "$(cat <<'EOF'
130141
[
131142
{
@@ -262,7 +273,7 @@ jobs:
262273

263274
- # === Configure AWS credentials ==
264275
name: Configure AWS credentials
265-
uses: aws-actions/configure-aws-credentials@v2
276+
uses: aws-actions/configure-aws-credentials@v4
266277
with:
267278
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
268279
role-session-name: ${{ env.AWS_ROLE_SESSION_NAME }}
@@ -325,6 +336,10 @@ jobs:
325336
fi
326337
else
327338
TEST_SUITE_TAGS="all"
339+
if [[ ${{ contains(matrix.sys.os, 'arm') }} = true ]]; then
340+
echo "Skipping integration tests on ARM"
341+
exit 0
342+
fi
328343
fi
329344
330345
echo "Running integration tests with tags: $TEST_SUITE_TAGS (empty means every test not specifically tagged)"
@@ -483,7 +498,7 @@ jobs:
483498

484499
- # === Configure AWS credentials ==
485500
name: Configure AWS credentials
486-
uses: aws-actions/configure-aws-credentials@v2
501+
uses: aws-actions/configure-aws-credentials@v4
487502
with:
488503
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
489504
role-session-name: ${{ env.AWS_ROLE_SESSION_NAME }}
@@ -511,3 +526,4 @@ jobs:
511526
session-build-ubuntu-20.04
512527
session-build-macos-11
513528
session-build-windows-2019
529+
session-build-ubuntu-24.04-arm

activestate.generators.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
scripts:
22
- name: generate-api-client
33
language: bash
4+
standalone: true
45
description: Generates the mono-api client files
56
value: |
67
echo "IMPORTANT!!! mono API and inventory API have to be in sync. Consider running state run generate-inventory-client"
@@ -10,6 +11,7 @@ scripts:
1011
popd
1112
- name: generate-secrets-client
1213
language: bash
14+
standalone: true
1315
description: Generates the secrets-api client files
1416
value: |
1517
WD=$(pwd)
@@ -18,6 +20,7 @@ scripts:
1820
popd
1921
- name: generate-headchef-client
2022
language: bash
23+
standalone: true
2124
description: Generates the headchef-api client files
2225
value: |
2326
WD=$(pwd)
@@ -26,6 +29,7 @@ scripts:
2629
popd
2730
- name: generate-logstreamer-client
2831
language: bash
32+
standalone: true
2933
description: Generates the buildlog-streamer client files
3034
value: |
3135
WD=$(pwd)
@@ -34,6 +38,7 @@ scripts:
3438
popd
3539
- name: generate-inventory-client
3640
language: bash
41+
standalone: true
3742
description: Generates the inventory-api client files
3843
value: |
3944
echo "IMPORTANT!!! mono API and inventory API have to be in sync. Consider running state run generate-api-client"
@@ -43,6 +48,7 @@ scripts:
4348
popd
4449
- name: generate-clients
4550
language: bash
51+
standalone: true
4652
description: Generates all api clients
4753
value: |
4854
$scripts.generate-api-client.path()
@@ -55,6 +61,7 @@ scripts:
5561
value: python3 scripts/locale-generator.py
5662
- name: generate-payload
5763
language: bash
64+
standalone: true
5865
description: Generate payload for installer / update archives
5966
value: |
6067
set -e
@@ -64,10 +71,10 @@ scripts:
6471
go run ./scripts/ci/payload-generator/main.go "$@"
6572
- name: generate-update
6673
language: bash
74+
standalone: true
6775
description: Generate update files
6876
value: |
6977
set -e
70-
export GOARCH=${1:-amd64}
7178
$constants.SET_ENV
7279
7380
$scripts.generate-payload.path()
@@ -79,9 +86,11 @@ scripts:
7986
go run scripts/ci/update-generator/main.go -o ./build/update
8087
- name: generate-remote-install-deployment
8188
language: bash
89+
standalone: true
8290
value: go run scripts/ci/deploy-generator/remote-installer/main.go "$@"
8391
- name: generate-graph
8492
language: bash
93+
standalone: true
8594
description: Generates graph server and client files
8695
value: |
8796
set -e

activestate.yaml

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,6 @@ scripts:
114114
popd > /dev/null
115115
fi
116116
go build -tags "$GO_BUILD_TAGS" -o $BUILD_TARGET_DIR/$constants.BUILD_TARGET $constants.CLI_BUILDFLAGS $constants.CLI_PKGS
117-
- name: build-for
118-
language: bash
119-
standalone: true
120-
description: Builds the project with the specified OS as the target OS. (valid values darwin, linux, windows)
121-
value: |
122-
set -e
123-
$constants.SET_ENV
124-
export GOOS=${1}
125-
export GOARCH=amd64
126-
[ -z "${2}" ] && >&2 echo "must provide output file as 2nd arg" && exit 1
127-
go build -tags "internal $GO_BUILD_TAGS" -o ${2} $constants.CLI_BUILDFLAGS $constants.CLI_PKGS
128117
- name: build-svc
129118
language: bash
130119
standalone: true
@@ -260,46 +249,10 @@ scripts:
260249
standalone: true
261250
description: Generates our github workflows
262251
value: |
263-
$scripts.build-for.path() "windows" ./.github/deps/Windows/bin/state.exe
264-
$scripts.build-for.path() "linux" ./.github/deps/Linux/bin/state
265-
$scripts.build-for.path() "darwin" ./.github/deps/macOS/bin/state
266-
267-
GOOS=windows go build -o .github/deps/Windows/bin/parallelize.exe github.com/ActiveState/cli/scripts/ci/parallelize/
268-
GOOS=linux go build -o .github/deps/Linux/bin/parallelize github.com/ActiveState/cli/scripts/ci/parallelize/
269-
GOOS=darwin go build -o .github/deps/macOS/bin/parallelize github.com/ActiveState/cli/scripts/ci/parallelize/
270-
- name: update-workflow-assets
271-
language: bash
272-
standalone: true
273-
description: Generates our github workflows
274-
value: |
275-
[ -z "${2}" ] && >&2 echo "Usage: update-workflow-assets [branch] [version]" && exit 1
276-
277-
tmpDir=$(mktemp -d)
278-
pushd $tmpDir
279-
wget https://state-tool.s3.amazonaws.com/update/state/${1}/${2}/darwin-amd64/state-darwin-amd64-${2}.tar.gz
280-
tar xzf state-darwin-amd64-${2}.tar.gz
281-
cp -Rfv state-install/bin/state $project.path()/.github/deps/macOS/bin
282-
cp -Rfv state-install/bin/state-svc $project.path()/.github/deps/macOS/bin
283-
popd
284-
rm -Rf $tmpDir
285-
286-
tmpDir=$(mktemp -d)
287-
pushd $tmpDir
288-
wget https://state-tool.s3.amazonaws.com/update/state/${1}/${2}/linux-amd64/state-linux-amd64-${2}.tar.gz
289-
tar xzf state-linux-amd64-${2}.tar.gz
290-
cp -Rfv state-install/bin/state $project.path()/.github/deps/Linux/bin
291-
cp -Rfv state-install/bin/state-svc $project.path()/.github/deps/Linux/bin
292-
popd
293-
rm -Rf $tmpDir
294-
295-
tmpDir=$(mktemp -d)
296-
pushd $tmpDir
297-
wget https://state-tool.s3.amazonaws.com/update/state/${1}/${2}/windows-amd64/state-windows-amd64-${2}.zip
298-
unzip state-windows-amd64-${2}.zip
299-
cp -Rfv state-install/bin/state.exe $project.path()/.github/deps/Windows/bin
300-
cp -Rfv state-install/bin/state-svc.exe $project.path()/.github/deps/Windows/bin
301-
popd
302-
rm -Rf $tmpDir
252+
GOOS=windows go build -o .github/deps/Windows/amd64/bin/parallelize.exe github.com/ActiveState/cli/scripts/ci/parallelize/
253+
GOOS=linux go build -o .github/deps/Linux/amd64/bin/parallelize github.com/ActiveState/cli/scripts/ci/parallelize/
254+
GOOS=linux GOARCH=arm64 go build -o .github/deps/Linux/arm64/bin/parallelize github.com/ActiveState/cli/scripts/ci/parallelize/
255+
GOOS=darwin go build -o .github/deps/macOS/amd64/bin/parallelize github.com/ActiveState/cli/scripts/ci/parallelize/
303256
- name: test
304257
language: bash
305258
standalone: true

cmd/state-installer/test/integration/installer_int_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ func (suite *InstallerIntegrationTestSuite) TestInstallNoErrorTips() {
167167
}
168168

169169
func (suite *InstallerIntegrationTestSuite) TestInstallErrorTips() {
170+
if runtime.GOARCH == "arm64" {
171+
suite.T().Skip("ARM platform projects are not supported yet")
172+
}
170173
suite.OnlyRunForTags(tagsuite.Installer, tagsuite.Critical)
171174
ts := e2e.New(suite.T(), false)
172175
defer ts.Close()

installers/install.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ error () {
6969
case `uname -s` in
7070
Linux)
7171
OS="linux"
72+
ARCH="amd64"
73+
arch="`uname -m`"
74+
if [ $arch = "arm64" -o $arch = "aarch64" ]; then ARCH="arm64"; fi
7275
DOWNLOADEXT=".tar.gz"
7376
;;
7477
*BSD)
@@ -78,11 +81,13 @@ Linux)
7881
;;
7982
Darwin)
8083
OS="darwin"
84+
ARCH="amd64"
8185
DOWNLOADEXT=".tar.gz"
8286
SHA256SUM="shasum -a 256"
8387
;;
8488
MINGW*|MSYS*)
8589
OS="windows"
90+
ARCH="amd64"
8691
DOWNLOADEXT=".zip"
8792
BINARYEXT=".exe"
8893
;;
@@ -113,18 +118,18 @@ mkdir -p "$INSTALLERTMPDIR"
113118
if [ -z "$VERSION" ]; then
114119
# If the user did not specify a version, formulate a query to fetch the JSON info of the latest
115120
# version, including where it is.
116-
JSONURL="$BASE_INFO_URL?channel=$CHANNEL&source=install&platform=$OS"
121+
JSONURL="$BASE_INFO_URL?channel=$CHANNEL&source=install&platform=$OS&arch=$ARCH"
117122
elif [ -z "`echo $VERSION | grep -o '\-SHA'`" ]; then
118123
# If the user specified a partial version (i.e. no SHA), formulate a query to fetch the JSON info
119124
# of that version's latest SHA, including where it is.
120125
VERSIONNOSHA="$VERSION"
121126
VERSION=""
122-
JSONURL="$BASE_INFO_URL?channel=$CHANNEL&source=install&platform=$OS&target-version=$VERSIONNOSHA"
127+
JSONURL="$BASE_INFO_URL?channel=$CHANNEL&source=install&platform=$OS&arch=$ARCH&target-version=$VERSIONNOSHA"
123128
else
124129
# If the user specified a full version with SHA, formulate a query to fetch the JSON info of that
125130
# version.
126131
VERSIONNOSHA="`echo $VERSION | sed 's/-SHA.*$//'`"
127-
JSONURL="$BASE_INFO_URL?channel=$CHANNEL&source=install&platform=$OS&target-version=$VERSIONNOSHA"
132+
JSONURL="$BASE_INFO_URL?channel=$CHANNEL&source=install&platform=$OS&arch=$ARCH&target-version=$VERSIONNOSHA"
128133
fi
129134

130135
# Fetch version info.
@@ -157,13 +162,13 @@ else
157162
error "Unknown version: $VERSION"
158163
exit 1
159164
fi
160-
RELURL="$CHANNEL/$VERSIONNOSHA/$OS-amd64/state-$OS-amd64-$VERSION$DOWNLOADEXT"
165+
RELURL="$CHANNEL/$VERSIONNOSHA/$OS-$ARCH/state-$OS-$ARCH-$VERSION$DOWNLOADEXT"
161166
fi
162167

163168
# Fetch the requested or latest version.
164169
progress "Preparing Installer for State Tool Package Manager version $VERSION"
165170
STATEURL="$BASE_FILE_URL/$RELURL"
166-
ARCHIVE="$OS-amd64$DOWNLOADEXT"
171+
ARCHIVE="$OS-$ARCH$DOWNLOADEXT"
167172
$FETCH $INSTALLERTMPDIR/$ARCHIVE $STATEURL
168173
# wget and curl differ on how to handle AWS' "Forbidden" result for unknown versions.
169174
# wget will exit with nonzero status. curl simply creates an XML file with the forbidden error.

internal/updater/checker.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@ func (u *Checker) CheckFor(desiredChannel, desiredVersion string) (*AvailableUpd
7272
return info, nil
7373
}
7474

75-
func (u *Checker) infoURL(tag, desiredVersion, branchName, platform string) string {
75+
func (u *Checker) infoURL(tag, desiredVersion, branchName, platform, arch string) string {
7676
v := make(url.Values)
7777
v.Set("channel", branchName)
7878
v.Set("platform", platform)
7979
v.Set("source", string(u.InvocationSource))
80+
v.Set("arch", arch)
8081

8182
if desiredVersion != "" {
8283
v.Set("target-version", desiredVersion)
@@ -91,7 +92,7 @@ func (u *Checker) infoURL(tag, desiredVersion, branchName, platform string) stri
9192

9293
func (u *Checker) getUpdateInfo(desiredChannel, desiredVersion string) (*AvailableUpdate, error) {
9394
tag := u.cfg.GetString(CfgUpdateTag)
94-
infoURL := u.infoURL(tag, desiredVersion, desiredChannel, runtime.GOOS)
95+
infoURL := u.infoURL(tag, desiredVersion, desiredChannel, runtime.GOOS, runtime.GOARCH)
9596
logging.Debug("Getting update info: %s", infoURL)
9697

9798
var info *AvailableUpdate

0 commit comments

Comments
 (0)