Skip to content

Commit

Permalink
Improve builds
Browse files Browse the repository at this point in the history
Merge in ADGUARD-FILTERS/aglint from fix-builds to master

Squashed commit of the following:

commit b66d24d
Author: scripthunter7 <[email protected]>
Date:   Tue Jan 9 15:35:56 2024 +0100

    Update changelog

commit d6c3f54
Author: scripthunter7 <[email protected]>
Date:   Tue Jan 9 15:34:48 2024 +0100

    Update yarn arg handling in test specs as well

commit 70b7978
Author: scripthunter7 <[email protected]>
Date:   Tue Jan 9 14:58:36 2024 +0100

    Fix nit

commit 056a2fe
Author: scripthunter7 <[email protected]>
Date:   Tue Jan 9 13:53:26 2024 +0100

    Update GH release workflow

commit f1a66d2
Author: scripthunter7 <[email protected]>
Date:   Tue Jan 9 13:49:21 2024 +0100

    Finish Bamboo specs

commit 38e5215
Author: scripthunter7 <[email protected]>
Date:   Tue Jan 9 13:48:24 2024 +0100

    Use tsx instead of ts-node to build txt
  • Loading branch information
scripthunter7 committed Jan 9, 2024
1 parent aee21db commit 0439668
Show file tree
Hide file tree
Showing 10 changed files with 298 additions and 42 deletions.
32 changes: 8 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,25 @@
name: Release
name: Create GitHub Release

env:
NODE_VERSION: 18

# Workflow need write access to the repository to create
# a GitHub release
permissions:
contents: write

on:
push:
tags:
- v*
# Make possible to run manually
workflow_dispatch:
inputs:
# warn before running manually
warning:
description: 'Should be run only for tags like `v*`'
required: false
type: boolean

# Make sure that only one release workflow runs at a time.

# Workflow need write access to the repository to create a release
permissions:
contents: write

# Make sure that only one release workflow runs at a time
concurrency:
group: release

jobs:
release:
name: Create NPM and GitHub release
name: Create GitHub release
runs-on: ubuntu-latest
# Only run this job for v* tags
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Check out the repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -63,11 +52,6 @@ jobs:
- name: Pack files
run: yarn pack --filename aglint.tgz

- name: Publish to NPM
run: yarn publish aglint.tgz --access=public --non-interactive
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Release on GitHub
uses: softprops/action-gh-release@v1
with:
Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog][keepachangelog], and this project adheres to [Semantic Versioning][semver].


## [2.0.7] - 2024-01-09
## [2.0.8] - 2024-01-09

### Fixed

- Absolute paths in the CLI [#184].


## [2.0.6] - 2023-11-07

### Added
Expand Down Expand Up @@ -157,7 +158,7 @@ The format is based on [Keep a Changelog][keepachangelog], and this project adhe
- Initial version of the adblock rule parser.


[2.0.7]: https://github.com/AdguardTeam/AGLint/compare/v2.0.6...v2.0.7
[2.0.8]: https://github.com/AdguardTeam/AGLint/compare/v2.0.6...v2.0.8
[2.0.6]: https://github.com/AdguardTeam/AGLint/compare/v2.0.5...v2.0.6
[2.0.5]: https://github.com/AdguardTeam/AGLint/compare/v2.0.4...v2.0.5
[2.0.4]: https://github.com/AdguardTeam/AGLint/compare/v2.0.3...v2.0.4
Expand Down
6 changes: 6 additions & 0 deletions bamboo-specs/bamboo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@

---
!include 'build.yaml'

---
!include 'deploy.yaml'

---
!include 'permissions.yaml'
42 changes: 33 additions & 9 deletions bamboo-specs/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plan:
key: AGLINTBUILD
name: aglint - build release
variables:
dockerNode: adguard/node-ssh:18.13--0
dockerNode: adguard/node-ssh:18.13--1

stages:
- Build:
Expand All @@ -29,17 +29,34 @@ Build:
interpreter: SHELL
scripts:
- |-
set -x
set -e
ls -al
set -x
# Fix mixed logs
exec 2>&1
ls -laht
# Exclude '--ignore-platform' from yarn arguments to fix build
# This is needed for installing swc core optional dependencies properly
originalYarnArgs="$bamboo_varsYarn"
modifiedYarnArgs=$(echo "$originalYarnArgs" | sed 's/--ignore-platform//g')
# Install common dependencies
# swc core optional dependencies are needed for tests
# but `--ignore-optional` will not install them
# so we run `yarn install ${bamboo.varsYarn}` without `--ignore-optional`:
yarn install --silent --ignore-engines --ignore-platform --ignore-scripts
# Install dependencies
yarn install ${modifiedYarnArgs}
yarn build-txt
# Run checks
yarn check-types
yarn lint
yarn test
# Create build, this will also create build.txt file with build number
yarn build
# Pack build into tarball
yarn pack --filename aglint.tgz
ls -laht
rm -rf node_modules
- inject-variables:
Expand All @@ -51,6 +68,11 @@ Build:
configuration:
selectedRepository: defaultRepository
tagName: v${bamboo.inject.version}
artifacts:
- name: aglint.tgz
pattern: aglint.tgz
shared: true
required: true
requirements:
- adg-docker: true

Expand All @@ -68,6 +90,8 @@ notifications:
- webhook:
name: Build webhook
url: http://prod.jirahub.service.eu.consul/v1/webhook/bamboo

labels: []

other:
concurrent-build-plugin: system-default
45 changes: 45 additions & 0 deletions bamboo-specs/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
version: 2
deployment:
name: aglint - deploy
source-plan: AJL-AGLINTBUILD
release-naming: ${bamboo.inject.version}
environments:
- npmjs

npmjs:
docker:
image: adguard/node-ssh:18.13--1
volumes:
${system.YARN_DIR}: "${bamboo.cacheYarn}"
triggers: []
tasks:
- checkout:
force-clean-build: 'true'
- artifact-download:
artifacts:
- name: aglint.tgz
- script:
interpreter: SHELL
scripts:
- |-
set -e
set -x
# Fix mixed logs
exec 2>&1
ls -laht
export NPM_TOKEN=${bamboo.npmSecretToken}
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
npm publish aglint.tgz --access public
requirements:
- adg-docker: 'true'
notifications:
- events:
- deployment-started-and-finished
recipients:
- webhook:
name: Deploy webhook
url: http://prod.jirahub.service.eu.consul/v1/webhook/bamboo
2 changes: 1 addition & 1 deletion bamboo-specs/increment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plan:
key: AGLINTINCR
name: aglint - increment
variables:
dockerNode: adguard/node-ssh:18.13--0
dockerNode: adguard/node-ssh:18.13--1

stages:
- Increment:
Expand Down
17 changes: 17 additions & 0 deletions bamboo-specs/permissions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
version: 2
deployment:
name: aglint - deploy
deployment-permissions:
- groups:
- extensions-developers
- adguard-qa
permissions:
- view
environment-permissions:
- npmjs:
- groups:
- extensions-developers
permissions:
- view
- deploy
17 changes: 12 additions & 5 deletions bamboo-specs/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plan:
key: AGLINTTEST
name: aglint - tests
variables:
dockerNode: adguard/node-ssh:18.13--0
dockerNode: adguard/node-ssh:18.13--1

stages:
- Build:
Expand All @@ -29,14 +29,21 @@ Build:
- |-
set -e
set -x
# Fix mixed logs
exec 2>&1
# swc core optional dependencies are needed for tests
# but `--ignore-optional` will not install them
# so we run `yarn install ${bamboo.varsYarn}` without `--ignore-optional`:
yarn install --silent --ignore-engines --ignore-platform --ignore-scripts
ls -laht
# Exclude '--ignore-platform' from yarn arguments to fix build
# This is needed for installing swc core optional dependencies properly
originalYarnArgs="$bamboo_varsYarn"
modifiedYarnArgs=$(echo "$originalYarnArgs" | sed 's/--ignore-platform//g')
# Install dependencies
yarn install ${modifiedYarnArgs}
# Run checks
yarn check-types
yarn lint
yarn test
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"scripts": {
"build": "yarn clean && yarn build-txt && yarn build-types && yarn rollup --config rollup.config.ts --configPlugin @rollup/plugin-json --configPlugin @rollup/plugin-typescript && yarn clean-types",
"build-types": "tsc --declaration --emitDeclarationOnly --outdir dist/types",
"build-txt": "ts-node-esm tasks/build-txt.ts",
"build-txt": "tsx tasks/build-txt.ts",
"check-types": "tsc --noEmit",
"clean": "rimraf dist",
"clean-types": "rimraf dist/types",
Expand Down Expand Up @@ -83,6 +83,7 @@
"rollup-plugin-node-externals": "^6.1.1",
"rollup-plugin-polyfill-node": "^0.12.0",
"ts-node": "^10.9.1",
"tsx": "^4.7.0",
"typescript": "^4.9.5"
},
"dependencies": {
Expand Down
Loading

0 comments on commit 0439668

Please sign in to comment.