Updated action name and packaging (#6) #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Continuous Integration | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| test-typescript: | |
| name: TypeScript Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| id: checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| id: setup-node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .node-version | |
| cache: npm | |
| - name: Install Dependencies | |
| id: npm-ci | |
| run: npm ci | |
| - name: Check Format | |
| id: npm-format-check | |
| run: npm run format:check | |
| - name: Lint | |
| id: npm-lint | |
| run: npm run lint | |
| - name: Test | |
| id: npm-ci-test | |
| run: npm run ci-test | |
| test-action: | |
| name: GitHub Actions Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| id: checkout | |
| uses: actions/checkout@v6 | |
| # ── Test 1: single file, all properties ────────────────────────────── | |
| - name: Read all properties from a single file | |
| id: read-all | |
| uses: ./ | |
| with: | |
| files: __fixtures__/config.properties | |
| - name: Verify all-properties outputs | |
| run: | | |
| if [ "${{ steps.read-all.outputs['config.db.host'] }}" != "localhost" ]; then | |
| echo "FAIL: config.db.host expected 'localhost', got '${{ steps.read-all.outputs['config.db.host'] }}'" | |
| exit 1 | |
| fi | |
| if [ "${{ steps.read-all.outputs['config.db.port'] }}" != "5432" ]; then | |
| echo "FAIL: config.db.port expected '5432', got '${{ steps.read-all.outputs['config.db.port'] }}'" | |
| exit 1 | |
| fi | |
| if [ "${{ steps.read-all.outputs['config.app.name'] }}" != "My Application" ]; then | |
| echo "FAIL: config.app.name expected 'My Application', got '${{ steps.read-all.outputs['config.app.name'] }}'" | |
| exit 1 | |
| fi | |
| echo "PASS: single file, all properties" | |
| # ── Test 2: property filter applied to a single file ────────────────── | |
| - name: Read a subset of properties from a single file | |
| id: read-subset | |
| uses: ./ | |
| with: | |
| files: __fixtures__/config.properties | |
| properties: | | |
| db.host | |
| db.name | |
| - name: Verify subset outputs | |
| run: | | |
| if [ "${{ steps.read-subset.outputs['config.db.host'] }}" != "localhost" ]; then | |
| echo "FAIL: config.db.host expected 'localhost'" | |
| exit 1 | |
| fi | |
| if [ "${{ steps.read-subset.outputs['config.db.name'] }}" != "myapp" ]; then | |
| echo "FAIL: config.db.name expected 'myapp'" | |
| exit 1 | |
| fi | |
| if [ -n "${{ steps.read-subset.outputs['config.app.name'] }}" ]; then | |
| echo "FAIL: config.app.name should not be set" | |
| exit 1 | |
| fi | |
| echo "PASS: property filter on single file" | |
| # ── Test 3: multiple files, all properties ──────────────────────────── | |
| - name: Read all properties from multiple files | |
| id: read-multi | |
| uses: ./ | |
| with: | |
| files: | | |
| __fixtures__/config.properties | |
| __fixtures__/edge-cases.properties | |
| - name: Verify multi-file outputs | |
| run: | | |
| if [ "${{ steps.read-multi.outputs['config.db.host'] }}" != "localhost" ]; then | |
| echo "FAIL: config.db.host expected 'localhost'" | |
| exit 1 | |
| fi | |
| if [ "${{ steps.read-multi.outputs['edge-cases.server'] }}" != "example.com" ]; then | |
| echo "FAIL: edge-cases.server expected 'example.com'" | |
| exit 1 | |
| fi | |
| if [ "${{ steps.read-multi.outputs['edge-cases.timeout'] }}" != "30" ]; then | |
| echo "FAIL: edge-cases.timeout expected '30'" | |
| exit 1 | |
| fi | |
| echo "PASS: multiple files, all properties" | |
| # ── Test 4: multiple files, property filter ─────────────────────────── | |
| - name: Read a subset of properties from multiple files | |
| id: read-multi-filter | |
| uses: ./ | |
| with: | |
| files: | | |
| __fixtures__/config.properties | |
| __fixtures__/edge-cases.properties | |
| properties: | | |
| db.host | |
| server | |
| - name: Verify multi-file filtered outputs | |
| run: | | |
| if [ "${{ steps.read-multi-filter.outputs['config.db.host'] }}" != "localhost" ]; then | |
| echo "FAIL: config.db.host expected 'localhost'" | |
| exit 1 | |
| fi | |
| if [ "${{ steps.read-multi-filter.outputs['edge-cases.server'] }}" != "example.com" ]; then | |
| echo "FAIL: edge-cases.server expected 'example.com'" | |
| exit 1 | |
| fi | |
| if [ -n "${{ steps.read-multi-filter.outputs['config.app.name'] }}" ]; then | |
| echo "FAIL: config.app.name should not be set" | |
| exit 1 | |
| fi | |
| echo "PASS: multiple files, property filter" | |
| # ── Test 5: stem deduplication ──────────────────────────────────────── | |
| - name: Read files with duplicate stems | |
| id: read-dedup | |
| uses: ./ | |
| with: | |
| files: | | |
| __fixtures__/config.properties | |
| __fixtures__/config.properties | |
| - name: Verify stem deduplication | |
| run: | | |
| if [ "${{ steps.read-dedup.outputs['config.db.host'] }}" != "localhost" ]; then | |
| echo "FAIL: config.db.host expected 'localhost'" | |
| exit 1 | |
| fi | |
| if [ "${{ steps.read-dedup.outputs['config1.db.host'] }}" != "localhost" ]; then | |
| echo "FAIL: config1.db.host expected 'localhost'" | |
| exit 1 | |
| fi | |
| echo "PASS: stem deduplication" | |
| # ── Test 6: edge-case syntax ────────────────────────────────────────── | |
| - name: Read edge-case syntax file | |
| id: read-edge | |
| uses: ./ | |
| with: | |
| files: __fixtures__/edge-cases.properties | |
| - name: Verify edge-case syntax is parsed correctly | |
| run: | | |
| # Colon separator | |
| if [ "${{ steps.read-edge.outputs['edge-cases.server'] }}" != "example.com" ]; then | |
| echo "FAIL: colon separator - edge-cases.server expected 'example.com'" | |
| exit 1 | |
| fi | |
| # Continuation line | |
| if [ "${{ steps.read-edge.outputs['edge-cases.long.value'] }}" != "first part second part third part" ]; then | |
| echo "FAIL: continuation - edge-cases.long.value expected 'first part second part third part'" | |
| exit 1 | |
| fi | |
| # Value containing equals sign | |
| if [ "${{ steps.read-edge.outputs['edge-cases.connection.string'] }}" != "host=localhost;port=5432" ]; then | |
| echo "FAIL: equals in value - edge-cases.connection.string expected 'host=localhost;port=5432'" | |
| exit 1 | |
| fi | |
| echo "PASS: edge-case syntax" |