Skip to content

Commit

Permalink
feat: change building system to rollup, compiling linter into a binary
Browse files Browse the repository at this point in the history
  • Loading branch information
zavoloklom committed Nov 13, 2024
1 parent b8a7bc4 commit 3f01f90
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 22 deletions.
76 changes: 55 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- '**'

jobs:
build:
tests:
runs-on: ubuntu-latest

steps:
Expand All @@ -27,22 +27,8 @@ jobs:
- name: Build the project
run: npm run build

- name: Set up QEMU for multi-arch
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64

- name: Build SEA for Alpine amd64
run: docker run --rm --platform linux/amd64 -v "$PWD":/app -w /app node:20.18.0-alpine ./scripts/generate-sea.sh ./pkg/dclint-alpine-amd64

- name: Build SEA for Bullseye amd64
run: docker run --rm --platform linux/amd64 -v "$PWD":/app -w /app node:20.18.0-bullseye ./scripts/generate-sea.sh ./pkg/dclint-bullseye-amd64

- name: Build SEA for Alpine arm64
run: docker run --rm --platform linux/arm64 -v "$PWD":/app -w /app node:20.18.0-alpine ./scripts/generate-sea.sh ./pkg/dclint-alpine-arm64

- name: Build SEA for Bullseye arm64
run: docker run --rm --platform linux/arm64 -v "$PWD":/app -w /app node:20.18.0-bullseye ./scripts/generate-sea.sh ./pkg/dclint-bullseye-arm64
- name: Build SEA
run: docker run --rm -v "$PWD":/app -w /app node:20.18.0-alpine ./scripts/generate-sea.sh ./pkg/dclint-alpine-amd64

- name: Run linter
run: npm run lint
Expand All @@ -56,14 +42,13 @@ jobs:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: wget -qO - https://coverage.codacy.com/get.sh | bash -s -- report -r ./coverage/cobertura-coverage.xml

- name: Upload build artifacts
- name: Upload tests artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
name: tests-artifacts
path: |
./dist
./bin
./pkg
debug:
runs-on: ubuntu-latest
Expand All @@ -79,7 +64,7 @@ jobs:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
name: tests-artifacts
path: ./

- name: Set up Node.js
Expand All @@ -93,6 +78,55 @@ jobs:
- name: Run debug:bin
run: npm run debug:bin

build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.18.0'

- name: Install dependencies
run: npm ci

- name: Build the project
run: npx semantic-release --dry-run --no-ci

- name: Build the project
run: |
export VERSION=$(cat .VERSION)
npm run build
- name: Set up QEMU for multi-arch
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64

- name: Build SEA for Alpine amd64
run: docker run --rm --platform linux/amd64 -v "$PWD":/app -w /app node:20.18.0-alpine ./scripts/generate-sea.sh ./pkg/dclint-alpine-amd64

- name: Build SEA for Bullseye amd64
run: docker run --rm --platform linux/amd64 -v "$PWD":/app -w /app node:20.18.0-bullseye ./scripts/generate-sea.sh ./pkg/dclint-bullseye-amd64

- name: Build SEA for Alpine arm64
run: docker run --rm --platform linux/arm64 -v "$PWD":/app -w /app node:20.18.0-alpine ./scripts/generate-sea.sh ./pkg/dclint-alpine-arm64

- name: Build SEA for Bullseye arm64
run: docker run --rm --platform linux/arm64 -v "$PWD":/app -w /app node:20.18.0-bullseye ./scripts/generate-sea.sh ./pkg/dclint-bullseye-arm64

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
./dist
./bin
./pkg
release:
runs-on: ubuntu-latest
needs: build
Expand Down
6 changes: 6 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ export default {
prepareCmd: 'npm run markdownlint:fix-changelog || true',
},
],
[
"@semantic-release/exec",

Check failure on line 21 in release.config.js

View workflow job for this annotation

GitHub Actions / tests

Replace `"@semantic-release/exec"` with `'@semantic-release/exec'`
{
verifyReleaseCmd: "echo ${nextRelease.version} > .VERSION"

Check failure on line 23 in release.config.js

View workflow job for this annotation

GitHub Actions / tests

Replace `"echo·${nextRelease.version}·>·.VERSION"` with `'echo·${nextRelease.version}·>·.VERSION',`

Check failure on line 23 in release.config.js

View workflow job for this annotation

GitHub Actions / tests

Unexpected template string expression
}

Check failure on line 24 in release.config.js

View workflow job for this annotation

GitHub Actions / tests

Insert `,`
],
'@semantic-release/npm',
[
'@semantic-release/git',
Expand Down
2 changes: 1 addition & 1 deletion rollup.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import replace from '@rollup/plugin-replace';
import terser from '@rollup/plugin-terser';

const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
const { version } = packageJson;
const version = process.env.VERSION ?? packageJson?.version;

export default (outDir, declaration = false, minify = false) => {
const plugins = [
Expand Down

0 comments on commit 3f01f90

Please sign in to comment.