diff --git a/.github/workflows/actions/build-core/action.yml b/.github/workflows/actions/build-core/action.yml new file mode 100644 index 000000000..e45f1e107 --- /dev/null +++ b/.github/workflows/actions/build-core/action.yml @@ -0,0 +1,29 @@ +name: 'Build Ionicons' +description: 'Build Ionicons' +runs: + using: 'composite' + steps: + - uses: actions/checkout@v3 + with: + # Checkout the latest commit in this branch + ref: ${{ github.event.pull_request.head.sha }} + - uses: actions/setup-node@v3 + + - name: Cache Node Modules + uses: actions/cache@v3 + env: + cache-name: node-modules + with: + path: ./node_modules + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./package-lock.json') }}-v1 + - name: Install Dependencies + run: npm install + shell: bash + - name: Build + run: npm run build + shell: bash + - uses: ./.github/workflows/actions/upload-archive + with: + name: ionicons-build + output: IoniconsBuild.zip + paths: dist components icons \ No newline at end of file diff --git a/.github/workflows/actions/download-archive/action.yml b/.github/workflows/actions/download-archive/action.yml new file mode 100644 index 000000000..eab273e93 --- /dev/null +++ b/.github/workflows/actions/download-archive/action.yml @@ -0,0 +1,19 @@ +name: 'Archive Download' +description: 'Downloads and decompresses an archive from a previous job' +inputs: + path: + description: 'Input archive name' + filename: + description: 'Input file name' + name: + description: 'Archive name' +runs: + using: 'composite' + steps: + - uses: actions/download-artifact@v2 + with: + name: ${{ inputs.name }} + path: ${{ inputs.path }} + - name: Exract Archive + run: unzip -q -o ${{ inputs.path }}/${{ inputs.filename }} + shell: bash \ No newline at end of file diff --git a/.github/workflows/actions/test-spec/action.yml b/.github/workflows/actions/test-spec/action.yml new file mode 100644 index 000000000..43701aa68 --- /dev/null +++ b/.github/workflows/actions/test-spec/action.yml @@ -0,0 +1,22 @@ +name: 'Test Spec' +description: 'Test Spec' +runs: + using: 'composite' + steps: + - uses: actions/setup-node@v3 + + - name: Cache Node Modules + uses: actions/cache@v3 + env: + cache-name: node-modules + with: + path: ./node_modules + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./package-lock.json') }}-v1 + - uses: ./.github/workflows/actions/download-archive + with: + name: ionicons-build + path: . + filename: IoniconsBuild.zip + - name: Test + run: npm run test.spec -- --ci + shell: bash diff --git a/.github/workflows/actions/upload-archive/action.yml b/.github/workflows/actions/upload-archive/action.yml new file mode 100644 index 000000000..93a3a0362 --- /dev/null +++ b/.github/workflows/actions/upload-archive/action.yml @@ -0,0 +1,19 @@ +name: 'Archive Upload' +description: 'Compresses and uploads an archive to be reused across jobs' +inputs: + paths: + description: 'Paths to files or directories to archive' + output: + description: 'Output file name' + name: + description: 'Archive name' +runs: + using: 'composite' + steps: + - name: Create Archive + run: zip -q -r ${{ inputs.output }} ${{ inputs.paths }} + shell: bash + - uses: actions/upload-artifact@v2 + with: + name: ${{ inputs.name }} + path: ${{ inputs.output }} \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..0d83d4a2d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,29 @@ +name: 'Ionicons Build' + +on: + pull_request: + branches: [ '**' ] + +# When pushing a new commit we should +# cancel the previous test run to not +# consume more runners than we need to. +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: + build-core: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + # Checkout the latest commit in this branch + ref: ${{ github.event.pull_request.head.sha }} + - uses: ./.github/workflows/actions/build-core + + test-spec: + needs: [build-core] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./.github/workflows/actions/test-spec \ No newline at end of file diff --git a/package.json b/package.json index cb7e5cd74..37bd83412 100755 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "build.component": "stencil build", "collection.copy": "node scripts/collection-copy.js", "start": "stencil build --dev --watch --serve", - "test": "stencil test --spec", + "test.spec": "stencil test --spec", "release": "np --no-2fa", "version": "npm run build" },