Skip to content

Commit

Permalink
feat(github-actions): add e2e test pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
mildronize committed May 5, 2024
1 parent 581d4c1 commit 258f9a9
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 9 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: 'E2E Tests'

on:
push:
branches: [v3.x-bundle]
paths-ignore:
- '**/*.md'
# pull_request:
# branches: [ main ]
# paths-ignore:
# - '**/*.md'

env:
pnpm_version: 8
node_version: 20

jobs:
get-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.deploy-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.node_version }}
uses: actions/setup-node@v4
with:
node-version: ${{env.node_version }}
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: ${{ env.pnpm_version }}

- run: pnpm install
- name: Export the matrix for testing
id: deploy-matrix
run: nx run @infra/azure-functions:github-actions

build:
runs-on: ${{ matrix.os }}
needs: get-matrix
strategy:
matrix: ${{fromJson(needs.get-matrix.outputs.matrix)}}

steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v1
if: matrix.runtime == 'bun'

- name: Use Node.js ${{ matrix.version }}
if: matrix.runtime == 'node'
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.version }}

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: ${{ env.pnpm_version }}
- run: pnpm install
- run: pnpm build

- name: Build the project
run: nx run @examples/with-${{ matrix.runtime }}:build
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
/** @type {import('nammatham').NammathamConfigs} */
const nammathamConfig = {
runtime: 'node',
buildOption: {
target: {
arch: 'x64',
platform: 'linux',
runtime: 'node18',
}
},
hostConfig: {
version: '2.0',
extensionBundle: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@examples/with-nodejs",
"name": "@examples/with-node",
"version": "1.0.0",
"description": "",
"main": "src/main.ts",
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion infra/azure-functions/src/github-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export interface GithubActionsMatrix {
export function toGithubActionsMatrix(configs: InfraEnvConfig[]): GithubActionsMatrix[] {
return configs.map(config => {
const { platform, runtime } = config;
const version = runtime === 'node18' ? '18' : 'latest';
/**
* Using Node 20 LTS to build but the target runtime is can be different
*/
const version = runtime === 'node18' ? '20' : 'latest';

return {
os: platform === 'linux' ? 'ubuntu-latest' : platform === 'win' ? 'windows-latest' : 'macos-latest',
Expand Down

0 comments on commit 258f9a9

Please sign in to comment.