Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: test ut #14

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 0 additions & 76 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,6 @@ on:
types: [checks_requested]

jobs:
build:
runs-on: ubuntu-latest
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
NX_SKIP_NX_CACHE: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release') }}
steps:
- uses: actions/checkout@v4
- 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@v4
- uses: ./tools/github-actions/setup
- name: New Version
id: newVersion
uses: ./tools/github-actions/new-version
with:
defaultBranch: main
defaultBranchPrereleaseName: alpha
releaseBranchRegExp: 'release\/(0|[1-9]\d*)\.(0|[1-9]\d*)(\.0-(?:alpha|beta|next|rc))?$'
- 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
Expand All @@ -62,42 +25,3 @@ jobs:
with:
affected: ${{ github.event_name == 'pull_request' }}
skipNxCache: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release') }}

it-tests:
uses: ./.github/workflows/it-tests.yml
secrets:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
needs: [build]
with:
skipNxCache: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release') }}

publish-packages:
uses: ./.github/workflows/publish.yml
if: ${{ github.event_name != 'pull_request' && github.event_name != 'merge_group' }}
permissions:
packages: write
contents: read
id-token: write
secrets: inherit
needs: [version, build, checks, it-tests]
with:
version: ${{ needs.version.outputs.nextVersionTag }}
prerelease: ${{ needs.version.outputs.isPreRelease == 'true' }}
isPullRequest: false
skipNxCache: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release') }}

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
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ describe('Localization Builder', () => {
let architectHost: TestingArchitectHost;
let virtualFileSystem: typeof fs;

beforeEach(async () => {
beforeEach(() => {
virtualFileSystem = useVirtualFileSystem();

const registry = new schema.CoreSchemaRegistry();
registry.addPostTransform(schema.transforms.addUndefinedDefaults);
architectHost = new TestingArchitectHost(path.resolve(__dirname, workspaceRoot), __dirname);
architect = new Architect(architectHost, registry);
});

beforeEach(() => {
architectHost.addBuilder('.:localization', require('./index').default);
architectHost.addBuilder('noop', createBuilder(() => ({success: true})));
architectHost.addTarget({project: 'showcase', target: 'compile'}, 'noop', {
Expand All @@ -27,6 +30,9 @@ describe('Localization Builder', () => {
architectHost.addTarget({project: 'showcase', target: 'extract-translations'}, 'noop', {
outputFile: path.resolve(__dirname, `${workspaceRoot}/apps/showcase/localisation.metadata.json`)
});
});

beforeEach(async () => {
await virtualFileSystem.promises.mkdir(path.resolve(__dirname, `${workspaceRoot}/apps/showcase`), {recursive: true});
await virtualFileSystem.promises.writeFile(path.resolve(__dirname, `${workspaceRoot}/apps/showcase/localisation.metadata.json`), '[]');
});
Expand Down