Skip to content
Closed
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
46 changes: 46 additions & 0 deletions .github/workflows/alpha-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Release Alpha
run-name: Release Alpha ${{ github.actor }} ${{ github.event_name }}

on:
schedule:
- cron: '0 8 * * 1,3' # Monday, Wednesday 8am
workflow_dispatch:

jobs:
create-alpha-tag:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
tag: ${{ steps.version-and-tag.outputs.tag }}
steps:
- uses: actions/checkout@v5
with:
ref: 'main'
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Create alpha tag
id: version-and-tag
run: |
PKG_VERSION=$(jq -r .version package.json)
DATE=$(date +%Y%m%d%H%M)
TAG="v${PKG_VERSION}-${DATE}-alpha"

git tag "$TAG"
git push origin "$TAG"
echo "Created tag from branch=$(git rev-parse --abbrev-ref HEAD), commit=$(git rev-parse HEAD), tag=$(git describe --tags --exact-match)"

echo "tag=$TAG" >> $GITHUB_OUTPUT

call-release:
needs: [create-alpha-tag]
uses: ./.github/workflows/release.yml
permissions:
contents: write
with:
tag: ${{ needs.create-alpha-tag.outputs.tag }}
1 change: 0 additions & 1 deletion .github/workflows/beta-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
with:
node-version: ${{ needs.get-configs.outputs.node-version }}
cache: 'npm'
architecture: ${{ needs.get-configs.outputs.arch }}

- name: Configure Git
run: |
Expand Down
25 changes: 8 additions & 17 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ on:
type: string
default: 'ubuntu-latest'

arch:
description: 'The architecture to target (e.g., "x64").'
required: false
type: string
default: 'x64'

ref:
description: 'The Git ref to checkout.'
required: true
Expand All @@ -29,12 +23,6 @@ on:
type: string
default: 'ubuntu-latest'

arch:
description: 'The architecture to target (e.g., "x64").'
required: false
type: string
default: 'x64'

ref:
description: 'The Git ref to checkout.'
required: true
Expand All @@ -57,12 +45,11 @@ jobs:
shell: bash
run: echo "Building from branch=$(git rev-parse --abbrev-ref HEAD), commit=$(git rev-parse HEAD), tag=$(git describe --tags --exact-match)"

- name: Setup Node.js ${{ needs.get-configs.outputs.node-version }} (${{ runner.os }}-${{ inputs.arch }})
- name: Setup Node.js ${{ needs.get-configs.outputs.node-version }} (${{ runner.os }})
uses: actions/setup-node@v4
with:
node-version: ${{ needs.get-configs.outputs.node-version }}
cache: 'npm'
architecture: ${{ inputs.arch }}

- name: Install Dependencies
run: npm ci
Expand All @@ -88,16 +75,20 @@ jobs:
shell: bash
run: echo "Building from branch=$(git rev-parse --abbrev-ref HEAD), commit=$(git rev-parse HEAD), tag=$(git describe --tags --exact-match)"

- name: Setup Go ${{ needs.get-configs.outputs.go-version }} (${{ runner.os }}-${{ runner.arch }})
- name: Setup Go ${{ needs.get-configs.outputs.go-version }} (${{ runner.os }})
uses: actions/setup-go@v4
with:
go-version: ${{ needs.get-configs.outputs.go-version }}
cache: true

- name: Build
shell: bash
run: GOPROXY=direct go build -C ./cfn-init ./...
env:
GOPROXY: direct
run: go build -C ./cfn-init -v ./...

- name: Test
shell: bash
run: GOPROXY=direct go test -C ./cfn-init -v -cover ./...
env:
GOPROXY: direct
run: go test -C ./cfn-init -v -cover ./...
33 changes: 0 additions & 33 deletions .github/workflows/build-matrix.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,6 @@ jobs:
- name: Lint and Test
run: npm run lint && npm run test

- name: Code Coverage
uses: irongut/[email protected]
with:
filename: coverage/**/cobertura-coverage.xml
badge: false
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: false
indicators: true
output: both
thresholds: '80 85'

- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: code-coverage-results.md

pr-build-test-go:
needs: [get-configs]
runs-on: ubuntu-latest
Expand Down
68 changes: 40 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
get-configs:
uses: ./.github/workflows/configs.yml

get-build-matrix:
uses: ./.github/workflows/build-matrix.yml

version-and-tag:
runs-on: ubuntu-latest
outputs:
Expand Down Expand Up @@ -50,33 +47,43 @@
if [[ "$TAG" == "v$VERSION" ]]; then
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "is-prerelease=false" >> $GITHUB_OUTPUT
elif [[ "$TAG" =~ ^v$VERSION-(alpha|beta)$ ]]; then
elif [[ "$TAG" =~ ^v$VERSION-[0-9]{12}-alpha$ ]]; then
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "is-prerelease=true" >> $GITHUB_OUTPUT
elif [[ "$TAG" =~ ^v$VERSION-beta$ ]]; then
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "is-prerelease=true" >> $GITHUB_OUTPUT
else
echo "Error: Tag ($TAG) must be v$VERSION or v$VERSION-<suffix>"
echo "Error: Tag ($TAG) must be v$VERSION, v$VERSION-yyyymmddhhmm-alpha, or v$VERSION-beta"
exit 1
fi

build-and-test:
needs: [get-configs, get-build-matrix, version-and-tag]
needs: [get-configs, version-and-tag]
uses: ./.github/workflows/build-and-test.yml
strategy:
fail-fast: true
matrix: ${{ fromJson(needs.get-build-matrix.outputs.build-matrix) }}
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
with:
ref: ${{ needs.version-and-tag.outputs.tag }}
runs-on: ${{ matrix.runner }}
arch: ${{ matrix.arch }}
runs-on: ${{ matrix.os }}

bundle-and-release:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
needs: [get-configs, get-build-matrix, version-and-tag, build-and-test]
needs: [get-configs, version-and-tag, build-and-test]
permissions:
contents: write
strategy:
fail-fast: true
matrix: ${{ fromJson(needs.get-build-matrix.outputs.build-matrix) }}
runs-on: ${{ matrix.runner }}
matrix:
include:
- { os: "ubuntu-latest", arch: "x64", platform: "linux" }
- { os: "ubuntu-latest", arch: "arm64", platform: "linux" }
- { os: "ubuntu-latest", arch: "arm", platform: "linux" }
- { os: "macos-latest", arch: "x64", platform: "darwin" }
- { os: "macos-latest", arch: "arm64", platform: "darwin" }
- { os: "windows-latest", arch: "x64", platform: "win32" }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
with:
Expand All @@ -87,14 +94,13 @@
shell: bash
run: echo "Bundling from branch=$(git rev-parse --abbrev-ref HEAD), commit=$(git rev-parse HEAD), tag=$(git describe --tags --exact-match)"

- name: Setup Node.js ${{ needs.get-configs.outputs.node-version }} (${{ matrix.runner }}-${{ matrix.arch }})
- name: Setup Node.js ${{ needs.get-configs.outputs.node-version }} (${{ runner.os }})
uses: actions/setup-node@v4
with:
node-version: ${{ needs.get-configs.outputs.node-version }}
cache: 'npm'
architecture: ${{ matrix.arch }}

- name: Setup Go ${{ needs.get-configs.outputs.go-version }} (${{ matrix.runner }}-${{ matrix.arch }})
- name: Setup Go ${{ needs.get-configs.outputs.go-version }} (${{ runner.os }})
uses: actions/setup-go@v4
with:
go-version: ${{ needs.get-configs.outputs.go-version }}
Expand All @@ -103,38 +109,46 @@
- name: Install Dependencies
run: npm ci

- name: Bundle
- name: Bundle (${{ matrix.platform }}-${{ matrix.arch }})
shell: bash
run: |
TAG=${{ needs.version-and-tag.outputs.tag }}
if [[ "$TAG" =~ -alpha$ ]]; then
npm run bundle:alpha
npm run bundle:alpha -- --env platform=${{ matrix.platform }} --env arch=${{ matrix.arch }}
elif [[ "$TAG" =~ -beta$ ]]; then
npm run bundle:beta
npm run bundle:beta -- --env platform=${{ matrix.platform }} --env arch=${{ matrix.arch }}
else
npm run bundle:prod
npm run bundle:prod -- --env platform=${{ matrix.platform }} --env arch=${{ matrix.arch }}
fi

# - name: Bundle Go
# shell: bash
# run: npm run build:go:prod
- name: Bundle Go
shell: bash
env:
GOPROXY: direct
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
go build -C ./cfn-init -v -o ../bundle/production/bin/cfn-init.exe
else
go build -C ./cfn-init -v -o ../bundle/production/bin/cfn-init
fi
cp ./cfn-init/THIRD-PARTY-LICENSES.txt ./bundle/production/bin/

- name: Set release asset name
id: set-asset-name
shell: bash
run: |
APP_NAME=${{ needs.get-configs.outputs.app-name }}
VERSION=$(node -p "require('./package.json').version")
OS=${{ runner.os }}
PLATFORM=${{ matrix.platform }}
ARCH=${{ matrix.arch }}

TAG=${{ needs.version-and-tag.outputs.tag }}
if [[ "$TAG" =~ -alpha$ ]]; then
FILE_NAME="${APP_NAME}-${VERSION}-alpha-${OS}-${ARCH}.zip"
FILE_NAME="${APP_NAME}-${VERSION}-alpha-${PLATFORM}-${ARCH}.zip"
elif [[ "$TAG" =~ -beta$ ]]; then
FILE_NAME="${APP_NAME}-${VERSION}-beta-${OS}-${ARCH}.zip"
FILE_NAME="${APP_NAME}-${VERSION}-beta-${PLATFORM}-${ARCH}.zip"
else
FILE_NAME="${APP_NAME}-${VERSION}-${OS}-${ARCH}.zip"
FILE_NAME="${APP_NAME}-${VERSION}-${PLATFORM}-${ARCH}.zip"
fi

ASSET_NAME=$(echo "$FILE_NAME" | tr '[:upper:]' '[:lower:]')
Expand All @@ -148,7 +162,6 @@
run: |
echo "Creating zip: ${{ env.ASSET_NAME }}"
(cd ./bundle/production && zip -r ../../${{ env.ASSET_NAME }} .)
ls -la

- name: Create Zip (Windows)
if: runner.os == 'Windows'
Expand All @@ -157,7 +170,6 @@
run: |
echo "Creating zip: ${{ env.ASSET_NAME }}"
Compress-Archive -Path ./bundle/production/* -DestinationPath ./${{ env.ASSET_NAME }}
dir

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
Expand Down
42 changes: 39 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
"test:leaks": "NODE_ENV=test vitest run --pool=forks --logHeapUsage",
"lint": "eslint src tst",
"lint:fix": "npm run lint -- --fix",
"build:go:dev": "GOPROXY=direct go build -C cfn-init -o ../bundle/development/bin/cfn-init ./cmd",
"build:go:prod": "GOPROXY=direct go build -C cfn-init -o ../bundle/production/bin/cfn-init ./cmd",
"build:go:dev": "GOPROXY=direct go build -C cfn-init -v -o ../bundle/development/bin/cfn-init",
"build:go:prod": "GOPROXY=direct go build -C cfn-init -v -o ../bundle/production/bin/cfn-init",
"test:go": "GOPROXY=direct go test -C cfn-init ./...",
"bundle": "rm -rf out && webpack --env mode=development",
"bundle:dev": "rm -rf out && webpack --env mode=production --env env=alpha",
"bundle:alpha": "rm -rf out && webpack --env mode=production --env env=alpha",
"bundle:beta": "rm -rf out && webpack --env mode=production --env env=beta",
"bundle:prod": "rm -rf out && webpack --env mode=production --env env=prod",
"benchmark": "node --max-old-space-size=16384 --expose-gc -r ts-node/register tools/benchmark.ts",
Expand Down Expand Up @@ -128,5 +128,41 @@
},
"overrides": {
"tree-sitter": "0.22.4"
},
"externalDependencies": [
"@opentelemetry/api",
"@opentelemetry/auto-instrumentations-node",
"@opentelemetry/instrumentation-pino",
"@opentelemetry/resources",
"@opentelemetry/sdk-logs",
"@opentelemetry/sdk-metrics",
"@opentelemetry/sdk-node",
"@opentelemetry/sdk-trace-base",
"@opentelemetry/sdk-trace-node",
"@tree-sitter-grammars/tree-sitter-yaml",
"cbor-x",
"lmdb",
"pino",
"pino-opentelemetry-transport",
"pino-pretty",
"pyodide",
"tree-sitter",
"tree-sitter-json",
"vscode-languageserver-types"
],
"nativePrebuilds": {
"@lmdb/lmdb-darwin-arm64": "3.4.2",
"@lmdb/lmdb-darwin-x64": "3.4.2",
"@lmdb/lmdb-linux-arm": "3.4.2",
"@lmdb/lmdb-linux-arm64": "3.4.2",
"@lmdb/lmdb-linux-x64": "3.4.2",
"@lmdb/lmdb-win32-arm64": "3.4.2",
"@lmdb/lmdb-win32-x64": "3.4.2",
"@msgpackr-extract/msgpackr-extract-darwin-arm64": "3.0.3",
"@msgpackr-extract/msgpackr-extract-darwin-x64": "3.0.3",
"@msgpackr-extract/msgpackr-extract-linux-arm": "3.0.3",
"@msgpackr-extract/msgpackr-extract-linux-arm64": "3.0.3",
"@msgpackr-extract/msgpackr-extract-linux-x64": "3.0.3",
"@msgpackr-extract/msgpackr-extract-win32-x64": "3.0.3"
}
}
Loading
Loading