Skip to content

Commit

Permalink
Moved musl on arm to a seperate file
Browse files Browse the repository at this point in the history
  • Loading branch information
avifenesh committed May 21, 2024
1 parent 4c27740 commit 3f013b2
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 48 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/lint-rust/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ inputs:
description: "folder that contains the target Cargo.toml file"
required: true
type: string
github-token:
description: "github token"
required: false
type: string

runs:
using: "composite"
Expand All @@ -16,6 +20,8 @@ runs:

- name: Install Rust toolchain and protoc
uses: ./.github/workflows/install-rust-and-protoc
with:
github-token: ${{ inputs.github-token }}

- uses: Swatinem/rust-cache@v2

Expand Down
25 changes: 6 additions & 19 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,25 +217,12 @@ jobs:
image: node:alpine
options: --user root --privileged --rm
steps:
- name: Install dependencies
run: |
apk update
apk add bash git sed python3
- name: Set up access
run: |
chown -R $(whoami):$(whoami) $GITHUB_WORKSPACE
# Since we currently cannot use the checkout action with musl on arm, we are checking-out the repo out of the container and here we are just resetting the repo
# to make sure we get the clean checkout of the action.
- name: Clean repository
shell: bash
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
git clean -xdf
git reset --hard
git submodule sync
git submodule update --init --recursive
- name: Setup musl on Linux ARM
uses: ./.github/workflows/setup-musl-on-linux
with:
workspace: $GITHUB_WORKSPACE
npm-scope: ${{ secrets.NPM_SCOPE }}
npm-auth-token: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Build Node wrapper
uses: ./.github/workflows/build-node-wrapper
Expand Down
47 changes: 18 additions & 29 deletions .github/workflows/npm-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Start self hosted EC2 runner
uses: ./.github/workflows/start-self-hosted-runner
Expand Down Expand Up @@ -96,33 +98,28 @@ jobs:
if: ${{ contains(matrix.build.RUNNER, 'self-hosted') && matrix.build.TARGET != 'aarch64-unknown-linux-musl' }}
run: sudo chown -R $USER:$USER /home/ubuntu/actions-runner/_work/glide-for-redis

- name: Install dependencies
if: ${{ contains(matrix.build.TARGET, 'musl') }}
run: |
apk update
apk add bash git sed
# Currently "Checkout" action is not supported for musl on ARM64, so the checkout is happening on the runner and
# here we just making sure we getting the clean repo
- name: Clean repository for musl on ARM64
if: ${{ matrix.build.TARGET == 'aarch64-unknown-linux-musl'}}
# For MUSL on X64 we need to install git since we use the checkout action
- name: Install git for musl
if: ${{ contains(matrix.build.TARGET, 'x86_64-unknown-linux-musl')}}
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
git clean -xdf
git reset --hard
git submodule sync
git submodule update --init --recursive
- name: Set up access for musl on ARM
if: ${{ matrix.build.TARGET == 'aarch64-unknown-linux-musl' }}
run: |
chown -R $(whoami):$(whoami) $GITHUB_WORKSPACE
apk update
apk add git
- name: Checkout
if: ${{ matrix.build.TARGET != 'aarch64-unknown-linux-musl' }}
uses: actions/checkout@v4
with:
submodules: "true"
fetch-depth: 0

- name: Setup for musl
if: ${{ contains(matrix.build.TARGET, 'musl')}}
uses: ./.github/workflows/setup-musl-on-linux
with:
workspace: $GITHUB_WORKSPACE
npm-scope: ${{ vars.NPM_SCOPE }}
npm-auth-token: ${{ secrets.NPM_AUTH_TOKEN }}
arch: ${{ matrix.build.ARCH }}

- name: Set the release version
shell: bash
Expand All @@ -141,14 +138,6 @@ jobs:
always-auth: true
token: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Setup node
if: ${{ matrix.build.TARGET == 'aarch64-unknown-linux-musl' }}
working-directory: ./node
run: |
npm config set registry https://registry.npmjs.org/
npm config set '//registry.npmjs.org/:_authToken' ${{ secrets.NPM_AUTH_TOKEN }}
npm config set scope ${{ vars.NPM_SCOPE }}
- name: Update package version in config.toml
uses: ./.github/workflows/update-glide-version
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
- uses: ./.github/workflows/lint-rust
with:
cargo-toml-folder: ./glide-core
github-token: ${{ secrets.GITHUB_TOKEN }}
name: lint glide-core

- uses: ./.github/workflows/lint-rust
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/setup-musl-on-linux/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Setup musl on Linux

inputs:
workspace:
description: "github workspace"
required: true
type: string
npm-scope:
description: "npm scope"
required: true
type: string
npm-auth-token:
description: "npm auth token"
required: true
type: string
arch:
description: "architecture"
required: false
type: string
options:
- "arm64"
- "x64"
default: "arm64"

runs:
using: "composite"
steps:
- name: Install dependencies
shell: sh
run: |
apk update
apk add bash git sed python3
- name: Skip all steps if not on ARM64
shell: bash
if: ${{ inputs.arch != 'arm64' }}
run: exit 0

# Currently "Checkout" action is not supported for musl on ARM64, so the checkout is happening on the runner and
# here we just making sure we getting the clean repo
- name: Clean repository for musl on ARM64
shell: bash
run: |
git config --global --add safe.directory "${{ inputs.workspace }}"
git clean -xdf
git reset --hard
git submodule sync
git submodule update --init --recursive
- name: Set up access for musl on ARM
shell: bash
run: |
chown -R $(whoami):$(whoami) $GITHUB_WORKSPACE
- name: Setup node
shell: bash
working-directory: ./node
run: |
npm config set registry https://registry.npmjs.org/
npm config set '//registry.npmjs.org/:_authToken' ${{ inputs.npm-auth-token }}
npm config set scope ${{ inputs.npm-scope }}

0 comments on commit 3f013b2

Please sign in to comment.