Skip to content

Commit

Permalink
ci: test stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
fpaul-1A committed Aug 1, 2023
1 parent 6f2a750 commit ab1a683
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 349 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/audit.yml

This file was deleted.

74 changes: 0 additions & 74 deletions .github/workflows/code-check.yml

This file was deleted.

61 changes: 0 additions & 61 deletions .github/workflows/codeql.yml

This file was deleted.

73 changes: 0 additions & 73 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,80 +17,7 @@ on:
types: [checks_requested]

jobs:
build:
runs-on: ubuntu-latest
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: ./tools/github-actions/setup
- uses: ./.github/actions/setup-java
with:
install-jdk: 'true'
- run: yarn build:swagger-gen
- run: yarn build
- uses: ./tools/github-actions/upload-build-output

version:
permissions:
contents: write
runs-on: ubuntu-latest
outputs:
nextVersionTag: ${{ steps.newVersion.outputs.nextVersionTag }}
isPreRelease: ${{ contains( steps.newVersion.outputs.nextVersionTag, '-' ) || github.event_name == 'pull_request' || github.event_name == 'merge_group'}}
steps:
- uses: actions/checkout@v3
- uses: ./tools/github-actions/setup
- name: New Version
id: newVersion
uses: ./tools/github-actions/new-version
with:
defaultBranch: main
defaultBranchPrereleaseName: alpha
- name: Create release
if: github.event_name != 'pull_request' && github.event_name != 'merge_group'
run: gh release create v${{ steps.newVersion.outputs.nextVersionTag }} --generate-notes ${{ contains( steps.newVersion.outputs.nextVersionTag, '-' ) && '--prerelease' || '' }} --target ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

checks:
uses: ./.github/workflows/code-check.yml
secrets:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
with:
affected: ${{ github.event_name == 'pull_request' }}

test-publish:
uses: ./.github/workflows/test-publish.yml
secrets:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
needs: [build]

publish-packages:
uses: ./.github/workflows/publish.yml
if: ${{ github.event_name != 'pull_request' && github.event_name != 'merge_group' }}
permissions:
packages: write
contents: read
secrets: inherit
needs: [version, build, checks, test-publish]
with:
version: ${{ needs.version.outputs.nextVersionTag }}
prerelease: ${{ needs.version.outputs.isPreRelease == 'true' }}
isPullRequest: false

documentation-main:
secrets: inherit
needs: [version, build, checks]
if: ${{ github.event_name != 'pull_request' && github.event_name != 'merge_group' && github.ref_name == 'main' }}
uses: ./.github/workflows/documentation.yml
with:
version: ${{ needs.version.outputs.nextVersionTag }}
documentation-pr:
secrets: inherit
needs: [version]
if: ${{ (github.event_name == 'pull_request' && github.base_ref == 'main') || github.event_name == 'merge_group' }}
uses: ./.github/workflows/documentation.yml
with:
version: ${{ needs.version.outputs.nextVersionTag }}
shouldDeploy: false
32 changes: 0 additions & 32 deletions .github/workflows/pr-labels.yml

This file was deleted.

84 changes: 19 additions & 65 deletions .github/workflows/test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,78 +12,32 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
packageManager: [yarn, npm]
os: [windows-2019]
packageManager: [yarn]
runs-on: ${{ matrix.os }}
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
ENFORCED_PACKAGE_MANAGER: ${{ matrix.packageManager }}
steps:
- uses: actions/checkout@v3
- uses: ./tools/github-actions/download-build-output
- uses: ./tools/github-actions/setup
- uses: ./.github/actions/setup-java
with:
install-jdk: 'true'
- name: Get current month to build the cache key
run: echo "currentMonth=$(date +'%Y-%m')" >> $GITHUB_ENV
shell: bash
- name: Cache test-app yarn
uses: actions/cache@v3
with:
path: |
.cache/test-app
!.cache/test-app/@ama-sdk*
!.cache/test-app/@ama-terasu*
!.cache/test-app/@o3r*
key: ${{ runner.os }}-test-app-${{ matrix.packageManager }}-${{ env.currentMonth }}
- name: Cache test-sdk yarn
uses: actions/cache@v3
with:
path: |
.cache/test-sdk
!.cache/test-sdk/@ama-sdk*
!.cache/test-sdk/@ama-terasu*
!.cache/test-sdk/@o3r*
key: ${{ runner.os }}-test-sdk-${{ matrix.packageManager }}-${{ env.currentMonth }}
- name: Setup verdaccio once for all tests
id: setup-verdaccio
run: |
mkdir ./.verdaccio/storage
chmod a+rwx -R ./.verdaccio/storage
yarn verdaccio:start-persistent
yarn verdaccio:publish
# This is working, but blocks execution :
# npx --yes verdaccio --config $GITHUB_WORKSPACE\\.verdaccio\\conf\\config2.yaml
# This ain't doin' shit
# start /B "" "npx --yes verdaccio --config $GITHUB_WORKSPACE\\.verdaccio\\conf\\config2.yaml"
# Also shit
# cmd /C "npx --yes verdaccio --config $GITHUB_WORKSPACE\\.verdaccio\\conf\\config2.yaml"
# Garbage
# cmd /C "start /B npx --yes verdaccio --config $GITHUB_WORKSPACE\\.verdaccio\\conf\\config2.yaml"
start /B "" npx --yes verdaccio --config $GITHUB_WORKSPACE\\.verdaccio\\conf\\config2.yaml
yarn install
npx --yes wait-on http://127.0.0.1:4873 -t 180000
yarn verdaccio:login
shell: bash
- name: Test
id: it-tests
run: yarn test-int --output-style=stream
- name: Zip verdaccio storage on failure
if: failure() && (steps.setup-verdaccio.conclusion == 'failure' || steps.it-tests.conclusion == 'failure')
run: zip -r verdaccio.zip ./.verdaccio
- name: Zip generated app on failure
if: failure() && steps.it-tests.conclusion == 'failure'
run: |
mkdir -p ./otter
cp -R ./.cache ./otter/.cache
zip -r it-tests.zip ../it-tests ./otter/.cache -x "./otter/.cache/nx/*" -x "../it-tests/*/node_modules/*"
- name: Publish verdaccio storage on failure
if: failure() && (steps.setup-verdaccio.conclusion == 'failure' || steps.it-tests.conclusion == 'failure')
uses: actions/upload-artifact@v3
with:
name: verdaccio-${{ matrix.os }}-${{ matrix.packageManager }}
path: verdaccio.zip
- name: Publish generated tests environment on failure
if: failure() && steps.it-tests.conclusion == 'failure'
uses: actions/upload-artifact@v3
with:
name: it-tests-${{ matrix.os }}-${{ matrix.packageManager }}
path: it-tests.zip
- name: Publish tests reports
if: always()
uses: actions/upload-artifact@v3
with:
name: it-reports-${{ matrix.os }}-${{ matrix.packageManager }}
path: 'packages/**/dist-test/it-report.xml'
- name: Stop verdaccio
if: always()
run: yarn verdaccio:stop
timeout-minutes: 10
2 changes: 1 addition & 1 deletion .verdaccio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ docker ps -a -q --filter="name=verdaccio" | xargs docker container stop

## How to use

Add `registry=http://localhost:4873` in your `.npmrc` / `yarnrc.yml` files or as a parameter of the install command
Add `registry=http://127.0.0.1:4873` in your `.npmrc` / `yarnrc.yml` files or as a parameter of the install command
2 changes: 1 addition & 1 deletion .verdaccio/conf/.npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
registry=http://localhost:4873
registry=http://127.0.0.1:4873
Loading

0 comments on commit ab1a683

Please sign in to comment.