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

Compile for arm64 in GitHub Actions #975

Merged
merged 4 commits into from
Nov 28, 2023
Merged
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
26 changes: 0 additions & 26 deletions .dockerignore

This file was deleted.

8 changes: 0 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
version: 2
updates:
- package-ecosystem: docker
directory: "/"
schedule:
interval: daily
time: "05:30"
timezone: Europe/London
reviewers:
- "martincostello"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
31 changes: 26 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ jobs:

steps:

- name: Setup arm64 support for native AoT
if: runner.os == 'Linux'
shell: bash
run: |
sudo dpkg --add-architecture arm64
sudo bash -c 'cat > /etc/apt/sources.list.d/arm64.list <<EOF
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse
EOF'
sudo sed -i -e 's/deb http/deb [arch=amd64] http/g' /etc/apt/sources.list
sudo sed -i -e 's/deb mirror/deb [arch=amd64] mirror/g' /etc/apt/sources.list
sudo apt update
sudo apt install --yes clang llvm binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu zlib1g-dev:arm64

- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

Expand All @@ -68,11 +83,6 @@ jobs:
file: ./artifacts/coverage/coverage.cobertura.xml
flags: ${{ matrix.os_name }}

- name: Build for arm64 with Docker
if: runner.os == 'Linux'
run: |
docker build --platform linux/arm64 --output . .

- name: Publish artifacts
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
Expand All @@ -81,6 +91,7 @@ jobs:

- name: Create Lambda ZIP file
if: runner.os == 'Linux'
shell: bash
run: |
cd "./artifacts/publish/LondonTravel.Skill/release_linux-arm64" || exit
if [ -f "./bootstrap" ]
Expand Down Expand Up @@ -115,6 +126,7 @@ jobs:
steps:

- name: Set function name
shell: bash
run: |
echo "FUNCTION_NAME=${LAMBDA_FUNCTION}-dev" >> "$GITHUB_ENV"

Expand Down Expand Up @@ -143,6 +155,7 @@ jobs:
aws-region: ${{ env.AWS_REGION }}

- name: Update function code
shell: bash
run: |
aws lambda update-function-code \
--function-name "${FUNCTION_NAME}" \
Expand All @@ -151,12 +164,14 @@ jobs:
> /dev/null

- name: Wait for function code update
shell: bash
run: |
aws lambda wait function-updated-v2 \
--function-name "${FUNCTION_NAME}" \
> /dev/null

- name: Update function configuration
shell: bash
run: |
aws lambda update-function-configuration \
--function-name "${FUNCTION_NAME}" \
Expand All @@ -169,6 +184,7 @@ jobs:
> /dev/null

- name: Wait for function configuration update
shell: bash
run: |
aws lambda wait function-updated-v2 \
--function-name "${FUNCTION_NAME}" \
Expand Down Expand Up @@ -219,6 +235,7 @@ jobs:
steps:

- name: Set function name
shell: bash
run: |
echo "FUNCTION_NAME=${LAMBDA_FUNCTION}" >> "$GITHUB_ENV"

Expand Down Expand Up @@ -247,6 +264,7 @@ jobs:
aws-region: ${{ env.AWS_REGION }}

- name: Update function code
shell: bash
run: |
aws lambda update-function-code \
--function-name "${FUNCTION_NAME}" \
Expand All @@ -255,12 +273,14 @@ jobs:
> /dev/null

- name: Wait for function code update
shell: bash
run: |
aws lambda wait function-updated-v2 \
--function-name "${FUNCTION_NAME}" \
> /dev/null

- name: Update function configuration
shell: bash
run: |
aws lambda update-function-configuration \
--function-name "${FUNCTION_NAME}" \
Expand All @@ -273,6 +293,7 @@ jobs:
> /dev/null

- name: Wait for function configuration update
shell: bash
run: |
aws lambda wait function-updated-v2 \
--function-name "${FUNCTION_NAME}" \
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ jobs:
env:
ARTIFACT_PATH: ${{ steps.download-artifact.outputs.zip-path }}
STAGING_PATH: '${{ github.workspace }}/staging'
shell: bash
run: |
mkdir --parents "${STAGING_PATH}"
unzip -q "${ARTIFACT_PATH}" -d "${STAGING_PATH}"
Expand All @@ -181,6 +182,7 @@ jobs:
LAMBDA_ARTIFACT_REF: ${{ steps.download-artifact.outputs.ref }}
LAMBDA_ARTIFACT_RUN_NUMBER: ${{ steps.download-artifact.outputs.run-number }}
LAMBDA_ENVIRONMENT: ${{ steps.get-environment-name.outputs.result }}
shell: bash
run: |
environment_name="${LAMBDA_ENVIRONMENT}"
lambda_config="$(unzip -p "${LAMBDA_ARTIFACT_PATH}/${LAMBDA_FUNCTION}.zip" aws-lambda-tools-defaults.json)"
Expand Down Expand Up @@ -279,6 +281,7 @@ jobs:
aws-region: ${{ env.AWS_REGION }}

- name: Update function code
shell: bash
run: |
aws lambda update-function-code \
--function-name "${FUNCTION_NAME}" \
Expand All @@ -287,12 +290,14 @@ jobs:
> /dev/null

- name: Wait for function code update
shell: bash
run: |
aws lambda wait function-updated-v2 \
--function-name "${FUNCTION_NAME}" \
> /dev/null

- name: Update function configuration
shell: bash
run: |
aws lambda update-function-configuration \
--function-name "${FUNCTION_NAME}" \
Expand All @@ -305,6 +310,7 @@ jobs:
> /dev/null

- name: Wait for function configuration update
shell: bash
run: |
aws lambda wait function-updated-v2 \
--function-name "${FUNCTION_NAME}" \
Expand Down
18 changes: 0 additions & 18 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function DotNetPublish {

if ($IsLinux -And (-Not $UseManagedRuntime)) {
$additionalArgs += "--runtime"
$additionalArgs += "linux-x64"
$additionalArgs += "linux-arm64"
$additionalArgs += "--self-contained"
$additionalArgs += "true"
$additionalArgs += "/p:AssemblyName=bootstrap"
Expand Down