Skip to content

Commit

Permalink
feat: add dev builds when pushing on 2-dev (#375)
Browse files Browse the repository at this point in the history
* feat: add dev builds when pushing on 2-dev

* fix: apply prettier requested changes

* fix: rename main CI workflow

* fix: update Node.js version to 18 in CI workflow
  • Loading branch information
alexandrebouthinon authored Sep 27, 2024
1 parent afc5129 commit aa11885
Show file tree
Hide file tree
Showing 7 changed files with 4,204 additions and 2,878 deletions.
57 changes: 0 additions & 57 deletions .github/workflows/pull_request.workflow.yml

This file was deleted.

152 changes: 152 additions & 0 deletions .github/workflows/push-and-pr.workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: Push and PR

on:
push:
branches:
- master
- beta
- "[0-9]+-dev"
pull_request:

jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Run lint
run: npm run lint

check-types:
name: Check types
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Run types tests
run: npm run test:types

functional-tests:
name: Functional Tests
runs-on: ubuntu-22.04
needs: [lint, check-types]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 18
- name: docker pull
run: docker compose --profile backend pull
- name: docker install dependencies
run: docker compose run --no-deps kuzzle /bin/bash -c "npm ci"
- name: docker backend
run: |
# Continue when error
set +e
export BACKEND_COMMAND="npm run build && npm run prod";
docker compose --profile backend up -d --wait
exitcode="$?"
[[ "$exitcode" == "0" ]] || docker compose logs kuzzle
exit "$exitcode"
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test:functional

release-device-manager:
name: Release package
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/2-dev') }}
needs: [functional-tests]
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
SEMANTIC_RELEASE_NPM_PUBLISH: "true"
SEMANTIC_RELEASE_SLACK_WEBHOOK: ${{ secrets.SEMANTIC_RELEASE_SLACK_WEBHOOK }}
run: npx semantic-release

release-types:
name: Release type package
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/2-dev') }}
needs: [release-device-manager]
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm ci

- name: Build type package
run: npm -prefix ./types run build

- name: Publish package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: cd types && npm publish

documentation_deploy:
needs: [release-device-manager]
name: Documentation - Deploy
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.ACCESS_TOKEN_CI }}

- name: Extract references from context
shell: bash
id: extract-refs
run: |
version=$(jq -r .version package.json | cut -d. -f 1)
echo "major-version=$(($version == 0 ? 1 : $version))" >> $GITHUB_OUTPUT
echo "repo=$(echo $GITHUB_REPOSITORY | cut -d/ -f 2)" >> $GITHUB_OUTPUT
- uses: convictional/[email protected]
with:
owner: kuzzleio
repo: documentation
github_token: ${{ secrets.ACCESS_TOKEN_CI }}
workflow_file_name: child_repo.workflow.yml
ref: ${{ github.ref_name == 'master' && 'master' || 'develop' }}
client_payload: '{"repo_name":"${{ steps.extract-refs.outputs.repo }}","branch":"${{ github.ref_name }}","version":"${{ steps.extract-refs.outputs.major-version }}"}'
65 changes: 0 additions & 65 deletions .github/workflows/push_branches.workflow.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions .releaserc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ module.exports = {
name: "beta",
prerelease: true,
},
{
name: "+([0-9])-dev",
prerelease: "dev"
}
],
};
Loading

0 comments on commit aa11885

Please sign in to comment.