Skip to content

Commit

Permalink
Pull request #11: Add example plan
Browse files Browse the repository at this point in the history
Merge in CI/github-actions-runner from feature/example to master

* commit 'f58fb6572b84100eaf9f4b33674dcf98d2d01795':
  fix identation
  fix typo
  remove fixme
  fix paths
  run example automatically
  activate workflow
  fix workflow names
  add example plan
  • Loading branch information
maximtop committed Apr 26, 2024
2 parents 82577d6 + f58fb65 commit 21110cc
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 3 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Example workflow for github-actions-runner
name: Example

env:
NODE_VERSION: 20

on:
workflow_dispatch:
inputs:
## !NOTE: This input is required to identify the workflow run
id:
type: 'string'
description: 'Unique identifier for the workflow run. Needed for github-actions-runner to identify the run.'
push:
branches:
- 'feature/example'

## !NOTE: This name is required to identify the workflow run
run-name: ${{github.workflow}} [ID:${{ inputs.id }}]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Number of commits to fetch. 0 indicates all history.
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Run bash commands
shell: bash
run: |
ls -alt
# Install deps
pnpm install
# Linting package
pnpm lint
# Testing package
pnpm test
# Building package artifact
pnpm pack && mv adguard-github-actions-runner-*.tgz github-actions-runner.tgz
- name: Save archived package
uses: actions/upload-artifact@v4
with:
name: github-actions-runner.tgz
path: ./github-actions-runner.tgz
- name: Save build.txt
uses: actions/upload-artifact@v4
with:
name: build.txt
path: ./dist/build.txt
3 changes: 3 additions & 0 deletions bamboo-specs/bamboo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@

---
!include 'increment.yaml'

---
!include 'example.yaml'
4 changes: 1 addition & 3 deletions bamboo-specs/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Build:
docker:
image: ${bamboo.dockerNode}
volumes:
${system.PNPM_DIR}: "${bamboo.cachePnpm}"
${system.PNPM_DIR}: "${bamboo.cachePnpm}"
tasks:
- checkout:
force-clean-build: true
Expand All @@ -40,14 +40,12 @@ Build:
# Set cache directory
pnpm config set store-dir ${bamboo.cachePnpm}
# FIXME Remove after github-actions-runner will be in the docker image
pnpm install
pnpm build
branch="${bamboo_planRepository_branchName}"
revision="${bamboo_planRepository_revision}"
# FIXME use github-actions-runner binary after it will be exposed in the docker
GITHUB_TOKEN=${bamboo.githubActionsRunnerPassword} node dist/bin/index.js run-action --repo AdguardTeam/GithubActionsRunner --branch "$branch" --rev "$revision" --workflow build.yml --artifacts-path .
- inject-variables:
file: build.txt
Expand Down
90 changes: 90 additions & 0 deletions bamboo-specs/example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
version: 2
plan:
project-key: AJL
key: GHACTIONSRUNEXAMPLE
name: github-actions-runner - example
variables:
# TODO set tag
dockerNode: ghcr.io/adguardteam/githubactionsrunner:master

stages:
- Build:
manual: false
final: false
jobs:
- Build

Build:
key: BUILD
other:
clean-working-dir: true
docker:
image: ${bamboo.dockerNode}
volumes:
${system.PNPM_DIR}: "${bamboo.cachePnpm}"
tasks:
- checkout:
force-clean-build: true
- script:
interpreter: SHELL
scripts:
- |-
set -x
set -e
# Fix mixed logs
exec 2>&1
ls -laht
branch="${bamboo_planRepository_branchName}"
revision="${bamboo_planRepository_revision}"
# FIXME use github-actions-runner binary after it will be exposed in the docker
GITHUB_TOKEN=${bamboo.githubActionsRunnerPassword} github-actions-runner run-action --repo AdguardTeam/GithubActionsRunner --branch "$branch" --rev "$revision" --workflow example.yml --artifacts-path .
final-tasks:
- script:
interpreter: SHELL
scripts:
- |-
set -x
set -e
# Fix mixed logs
exec 2>&1
ls -laht
echo "Size before cleanup:" && du -h | tail -n 1
rm -rf node_modules
echo "Size after cleanup:" && du -h | tail -n 1
artifacts:
- name: github-actions-runner.tgz
pattern: github-actions-runner.tgz
shared: true
required: true
requirements:
- adg-docker: 'true'

triggers: []

branches:
create: for-pull-request
delete:
after-deleted-days: '1'
after-inactive-days: '5'
link-to-jira: true

notifications:
- events:
- plan-status-changed
recipients:
- webhook:
name: Build webhook
url: http://prod.jirahub.service.eu.consul/v1/webhook/bamboo

labels: []

other:
concurrent-build-plugin: system-default

0 comments on commit 21110cc

Please sign in to comment.