Skip to content

Commit

Permalink
Refactor GitHub workflows and configuration for improved dependency m…
Browse files Browse the repository at this point in the history
…anagement and consistency and fixing alpine release
  • Loading branch information
avifenesh committed Oct 26, 2024
1 parent e2c3b8a commit 6db3125
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 41 deletions.
48 changes: 38 additions & 10 deletions .github/json_matrices/build-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,27 @@
"RUNNER": "ubuntu-latest",
"ARCH": "x64",
"TARGET": "x86_64-unknown-linux-gnu",
"PACKAGE_MANAGERS": ["pypi", "npm", "maven"]
"PACKAGE_MANAGERS": [
"pypi",
"npm",
"maven"
]
},
{
"OS": "ubuntu",
"NAMED_OS": "linux",
"RUNNER": ["self-hosted", "Linux", "ARM64"],
"RUNNER": [
"self-hosted",
"Linux",
"ARM64"
],
"ARCH": "arm64",
"TARGET": "aarch64-unknown-linux-gnu",
"PACKAGE_MANAGERS": ["pypi", "npm", "maven"],
"PACKAGE_MANAGERS": [
"pypi",
"npm",
"maven"
],
"CONTAINER": "2_28"
},
{
Expand All @@ -22,34 +34,50 @@
"RUNNER": "macos-12",
"ARCH": "x64",
"TARGET": "x86_64-apple-darwin",
"PACKAGE_MANAGERS": ["pypi", "npm", "maven"]
"PACKAGE_MANAGERS": [
"pypi",
"npm",
"maven"
]
},
{
"OS": "macos",
"NAMED_OS": "darwin",
"RUNNER": "macos-latest",
"ARCH": "arm64",
"TARGET": "aarch64-apple-darwin",
"PACKAGE_MANAGERS": ["pypi", "npm", "maven"]
"PACKAGE_MANAGERS": [
"pypi",
"npm",
"maven"
]
},
{
"OS": "ubuntu",
"NAMED_OS": "linux",
"ARCH": "arm64",
"TARGET": "aarch64-unknown-linux-musl",
"RUNNER": ["self-hosted", "Linux", "ARM64"],
"IMAGE": "node:alpine",
"RUNNER": [
"self-hosted",
"Linux",
"ARM64"
],
"IMAGE": "node:lts-alpine3.19",
"CONTAINER_OPTIONS": "--user root --privileged --rm",
"PACKAGE_MANAGERS": ["npm"]
"PACKAGE_MANAGERS": [
"npm"
]
},
{
"OS": "ubuntu",
"NAMED_OS": "linux",
"ARCH": "x64",
"TARGET": "x86_64-unknown-linux-musl",
"RUNNER": "ubuntu-latest",
"IMAGE": "node:alpine",
"IMAGE": "node:lts-alpine3.19",
"CONTAINER_OPTIONS": "--user root --privileged",
"PACKAGE_MANAGERS": ["npm"]
"PACKAGE_MANAGERS": [
"npm"
]
}
]
2 changes: 1 addition & 1 deletion .github/workflows/install-shared-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ runs:
if: "${{ inputs.os == 'macos' }}"
run: |
brew update
brew install git gcc pkgconfig openssl coreutils
brew install git openssl coreutils
- name: Install software dependencies for Ubuntu GNU
shell: bash
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:


- name: Use Node.js 16.x
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16.x

Expand Down Expand Up @@ -286,10 +286,10 @@ jobs:
- uses: actions/checkout@v4


- name: Use Node.js 18.x
- name: Use Node.js 16.x
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 16.x

- name: Build Node wrapper
uses: ./.github/workflows/build-node-wrapper
Expand Down
25 changes: 14 additions & 11 deletions .github/workflows/npm-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,18 @@ jobs:
INPUT_VERSION: ${{ github.event.inputs.version }}

- name: Setup node
if: ${{ matrix.build.TARGET != 'aarch64-unknown-linux-musl' }}
uses: actions/setup-node@v3
if: ${{ !contains(matrix.build.TARGET, 'musl') }}
uses: actions/setup-node@v4
with:
node-version: "20"
node-version: "latest"
registry-url: "https://registry.npmjs.org"
architecture: ${{ matrix.build.ARCH }}
scope: "${{ vars.NPM_SCOPE }}"
always-auth: true
token: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Setup node for publishing
if: ${{ matrix.build.TARGET == 'aarch64-unknown-linux-musl' }}
if: ${{ !contains(matrix.build.TARGET, 'musl') }}
working-directory: ./node
run: |
npm config set registry https://registry.npmjs.org/
Expand Down Expand Up @@ -185,7 +185,7 @@ jobs:
# 2>&1 1>&3- redirects stderr to stdout and then redirects the original stdout to another file descriptor,
# effectively separating stderr and stdout. The 3>&1 at the end redirects the original stdout back to the console.
# https://github.com/npm/npm/issues/118#issuecomment-325440 - ignoring notice messages since currentlly they are directed to stderr
{ npm_publish_err=$(npm publish --tag ${{ env.NPM_TAG }} --access public 2>&1 1>&3- | grep -v "notice") ;} 3>&1
{ npm_publish_err=$(npm publish --tag ${{ env.NPM_TAG }} --access public 2>&1 1>&3- | grep -Ev "notice|ExperimentalWarning") ;} 3>&1
if [[ "$npm_publish_err" == *"You cannot publish over the previously published versions"* ]]
then
echo "Skipping publishing, package already published"
Expand All @@ -203,8 +203,11 @@ jobs:
if: ${{ matrix.build.ARCH == 'arm64' }}
shell: bash
run: |
git reset --hard
echo "Resetting repository"
git clean -xdf
git reset --hard
git fetch
git checkout ${{ github.sha }}
publish-base-to-npm:
if: github.event_name != 'pull_request'
Expand All @@ -218,9 +221,9 @@ jobs:
submodules: "true"

- name: Install node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "20"
node-version: "latest"
registry-url: "https://registry.npmjs.org"
scope: "${{ vars.NPM_SCOPE }}"
always-auth: true
Expand Down Expand Up @@ -336,10 +339,10 @@ jobs:
arch: ${{ matrix.build.ARCH }}

- name: Setup node
if: ${{ matrix.build.TARGET != 'aarch64-unknown-linux-musl' }}
uses: actions/setup-node@v3
if: ${{ !contains(matrix.build.TARGET, 'musl') }}
uses: actions/setup-node@v4
with:
node-version: "16"
node-version: "latest"
registry-url: "https://registry.npmjs.org"
architecture: ${{ matrix.build.ARCH }}
scope: "${{ vars.NPM_SCOPE }}"
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/pypi-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,10 @@ jobs:
if: ${{ !contains(matrix.build.RUNNER, 'self-hosted') }}
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Set up Python older versions for MacOS
if: startsWith(matrix.build.NAMED_OS, 'darwin')
run: |
brew update
brew install python@3.8 python@3.9
python-version: "3.12"

- name: Setup Python for self-hosted Ubuntu runners
if: contains(matrix.build.OS, 'ubuntu') && contains(matrix.build.RUNNER, 'self-hosted')
if: contains(matrix.build.RUNNER, 'self-hosted')
run: |
sudo apt update -y
sudo apt upgrade -y
Expand All @@ -140,7 +134,7 @@ jobs:
target: ${{ matrix.build.TARGET }}
publish: "true"
github-token: ${{ secrets.GITHUB_TOKEN }}
engine-version: "7.2.5"
engine-version: "7.2"

- name: Include protobuf files in the package
working-directory: ./python
Expand Down Expand Up @@ -186,7 +180,7 @@ jobs:
with:
working-directory: ./python
target: ${{ matrix.build.TARGET }}
args: --release --strip --out wheels -i ${{ github.event_name != 'pull_request' && 'python3.8 python3.9 python3.10 python3.11 python3.12' || 'python3.10' }}
args: --release --strip --out wheels -i ${{ github.event_name != 'pull_request' && 'python3.8 python3.9 python3.10 python3.11 python3.12' || 'python3.12' }}

- name: Upload Python wheels
if: github.event_name != 'pull_request'
Expand Down Expand Up @@ -241,7 +235,7 @@ jobs:
- name: Install ValKey
uses: ./.github/workflows/install-valkey
with:
version: "8.0.0"
version: "8.0"

- name: Check if RC and set a distribution tag for the package
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/setup-musl-on-linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ runs:
shell: bash
run: |
git config --global --add safe.directory "${{ inputs.workspace }}"
git fetch origin ${{ github.sha }}
git checkout ${{ github.sha }}
git clean -xdf
git reset --hard
git submodule sync
git submodule update --init --recursive
- name: Set up access for musl on ARM
shell: bash
Expand Down
10 changes: 7 additions & 3 deletions node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@types/jest": "^29.5.12",
"@types/jest": "^29.5.14",
"@types/minimist": "^1.2.5",
"@types/redis-server": "^1.2.2",
"@types/semver": "^7.5.8",
Expand All @@ -71,10 +71,14 @@
"tests/",
"rust-client/**",
"!build-ts/**",
"babel.config.js",
".prettierignore",
"jest.config.js",
"hybrid-node-tests/**",
"docs/"
"docs/",
"DEVELOPER.md",
".ort.yml",
"tsconfig.json",
"THIRD_PARTY_LICENSES_NODE"
]
},
"//": [
Expand Down

0 comments on commit 6db3125

Please sign in to comment.