Skip to content

Commit

Permalink
wip test publish
Browse files Browse the repository at this point in the history
  • Loading branch information
jahow committed Jan 10, 2024
1 parent 9e011b3 commit b6042bc
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 591 deletions.
155 changes: 0 additions & 155 deletions .github/workflows/artifacts.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/backport.yml

This file was deleted.

170 changes: 21 additions & 149 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,173 +21,45 @@ concurrency:
cancel-in-progress: ${{ github.ref_name != 'main' }}

jobs:
format-lint-test:
if: github.event.pull_request.draft == false
name: Format check, lint, unit tests
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'main'
- run: npm ci
- run: npx nx format:check
- run: npx nx affected -t lint --parallel=3
- run: npx nx affected -t test --parallel=3 --configuration=ci --ci --codeCoverage --coverageReporters=lcov

- name: Coveralls
uses: coverallsapp/github-action@v2
with:
allow-empty: true

# - name: Archive Code Coverage Results (on main)
# if: github.event_name != 'pull_request'
# uses: actions/upload-artifact@v2
# with:
# name: code-coverage-report
# path: ./coverage/**/coverage-summary.json
# if-no-files-found: error
#
# - name: Create Code Coverage Badge (on PR)
# if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'
# uses: dkhunt27/nx-code-coverage@v1
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# coverage-folder: ./coverage
# coverage-base-folder: ./coverage-base
# gist-token: ${{ secrets.COVERAGE_GIST_TOKEN }}
# gist-id: c759fcfd4e71c8853beedbe1785fc081
# color: green
# named-logo: jest
# no-coverage-ran: false

build-affected:
if: github.event.pull_request.draft == false
name: Attempt to build affected apps
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'main'
- run: npm ci
- run: npx nx affected -t build --parallel=3

affected-recap:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'
name: Print affected libs and apps
runs-on: ubuntu-latest

steps:
- name: Checkout branch
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3

- name: Install dependencies
run: npm ci

- name: Compute affected projects
run: |
echo "AFFECTED_LIBS=$(npx nx print-affected --type=lib --select=projects | awk 'BEGIN {RS = ", "; ORS = ", "} \
{ print "`"$1"`" }')" >> $GITHUB_ENV
- name: Compute affected apps
run: |
echo "AFFECTED_APPS=$(npx nx print-affected --type=app --select=projects | awk 'BEGIN {RS = ", "; ORS = ", "} \
{ print "`"$1"`" }')" >> $GITHUB_ENV
- name: add PR comment
uses: thollander/actions-comment-pull-request@v2
with:
message: 'Affected libs: ${{ env.AFFECTED_LIBS }}
Affected apps: ${{ env.AFFECTED_APPS }}
- [ ] 🚀 Build and deploy storybook and demo on GitHub Pages
- [ ] 📦 Build and push affected docker images'
comment_tag: build-options
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

cypress-run:
name: End-to-end tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Create pipeline docker image
run: cd tools && docker build . -f pipelines/Dockerfile -t geonetwork/geonetwork-ui-tools-pipelines:latest

- name: Build the backend
run: sudo docker-compose -f support-services/docker-compose.yml up -d init

- name: Install dependencies
run: |
npm ci
- name: Run tests
run: npx nx run-many --target=e2e

build-npm-package:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'
name: Attempt to build the NPM package
name: Build and publish NPM package
runs-on: ubuntu-latest

steps:
- name: Checkout branch
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci

- name: Adjust package version according to branch & commit
working-directory: package
run: npm version $(../tools/print-dev-version.sh) --no-git-tag-version

- name: Build NPM package
working-directory: package
run: node generate-package.js

- name: Publish NPM package with @dev tag
if: github.event_name != 'release'
working-directory: package/dist
run: npm publish --tag dev
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish NPM package
if: github.event_name == 'release'
working-directory: package/dist
run: npm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading

0 comments on commit b6042bc

Please sign in to comment.