Skip to content

Commit

Permalink
chore: set build in the pipeline and comment other operations for tes…
Browse files Browse the repository at this point in the history
…ting
  • Loading branch information
NickChecan committed Oct 12, 2024
1 parent 0e3f7b7 commit fbc7cae
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 88 deletions.
185 changes: 98 additions & 87 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,107 +3,118 @@ on: [ push, workflow_dispatch ]

jobs:

setup:
build:
name: Setup environment and determine templates
runs-on: ubuntu-latest
outputs:
template_dirs: ${{ steps.get-dirs.outputs.dirs }}
# template_variants: ${{ steps.get-variants.outputs.variants }}
steps:

- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Build dist
run: npm run build

# setup:
# name: Setup environment and determine templates
# runs-on: ubuntu-latest
# outputs:
# template_dirs: ${{ steps.get-dirs.outputs.dirs }}
# # template_variants: ${{ steps.get-variants.outputs.variants }}
# steps:

# - name: Checkout
# uses: actions/checkout@v4

# - name: Setup Node
# uses: actions/setup-node@v4
# with:
# node-version: 22
# cache: npm

- name: Install dependencies
run: npm ci
# - name: Install dependencies
# run: npm ci

- name: Get list of test directories
id: get-dirs
run: echo "dirs=$(ls -d test/*/ | grep -v 'test/test-utils/' | jq -R -s -c 'split("\n")[:-1] | map(split("/")[1])')" >> $GITHUB_OUTPUT
# - name: Get list of test directories
# id: get-dirs
# run: echo "dirs=$(ls -d test/*/ | grep -v 'test/test-utils/' | jq -R -s -c 'split("\n")[:-1] | map(split("/")[1])')" >> $GITHUB_OUTPUT

# - name: Get list of variants for an image
# id: get-variants
# run: |
# variants=$(cat variants.json)
# echo "variants=${variants}" >> $GITHUB_ENV

test:
name: Run test on images
runs-on: ubuntu-latest
needs: setup
strategy:
matrix:
template: ${{ fromJson(needs.setup.outputs.template_dirs) }}
variant: [
"22-bookworm",
"22-bullseye",
"20-bookworm",
"20-bullseye",
"18-bookworm",
"18-bullseye"
]
fail-fast: false
steps:
# # - name: Get list of variants for an image
# # id: get-variants
# # run: |
# # variants=$(cat variants.json)
# # echo "variants=${variants}" >> $GITHUB_ENV

# test:
# name: Run test on images
# runs-on: ubuntu-latest
# needs: setup
# strategy:
# matrix:
# template: ${{ fromJson(needs.setup.outputs.template_dirs) }}
# variant: [
# "22-bookworm",
# "22-bullseye",
# "20-bookworm",
# "20-bullseye",
# "18-bookworm",
# "18-bullseye"
# ]
# fail-fast: false
# steps:

- name: Checkout
uses: actions/checkout@v4
# - name: Checkout
# uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
# - name: Setup Node
# uses: actions/setup-node@v4
# with:
# node-version: 22
# cache: npm

- name: Install dependencies
run: npm ci
# - name: Install dependencies
# run: npm ci

- name: Run test for ${{ matrix.template }}
env:
VARIANT: ${{ matrix.variant }}
run: test/${{ matrix.template }}/test.sh
# - name: Run test for ${{ matrix.template }}
# env:
# VARIANT: ${{ matrix.variant }}
# run: test/${{ matrix.template }}/test.sh

build:
name: Build devcontainer images
runs-on: ubuntu-latest
needs:
- setup
- test
strategy:
matrix:
template: ${{ fromJson(needs.setup.outputs.template_dirs) }}
variant: [
"22-bookworm",
"22-bullseye",
"20-bookworm",
"20-bullseye",
"18-bookworm",
"18-bullseye"
]
fail-fast: false
steps:
# build:
# name: Build devcontainer images
# runs-on: ubuntu-latest
# needs:
# - setup
# - test
# strategy:
# matrix:
# template: ${{ fromJson(needs.setup.outputs.template_dirs) }}
# variant: [
# "22-bookworm",
# "22-bullseye",
# "20-bookworm",
# "20-bullseye",
# "18-bookworm",
# "18-bullseye"
# ]
# fail-fast: false
# steps:

- name: Checkout
uses: actions/checkout@v4
# - name: Checkout
# uses: actions/checkout@v4

# - name: Install devcontainer cli
# run: npm install -g @devcontainers/cli

# - name: Build image ${{ matrix.template }}/${{ matrix.variant }}
# env:
# TEMPLATE: ${{ matrix.template }}
# VARIANT: ${{ matrix.variant }}
# run: scripts/build.sh

- name: Install devcontainer cli
run: npm install -g @devcontainers/cli

- name: Build image ${{ matrix.template }}/${{ matrix.variant }}
env:
TEMPLATE: ${{ matrix.template }}
VARIANT: ${{ matrix.variant }}
run: scripts/build.sh

# - name: Build devcontainer
# run: |
# echo "starting devcontainer build..."
# devcontainer build \
# --workspace-folder tmp/src/${{ matrix.template }}/${{ matrix.variant }}/ \
# --image-name ghcr.io/The-Nefarious-Developer/${{ matrix.template }}:${{ matrix.variant }} \
# # --no-cache true
# # - name: Build devcontainer
# # run: |
# # echo "starting devcontainer build..."
# # devcontainer build \
# # --workspace-folder tmp/src/${{ matrix.template }}/${{ matrix.variant }}/ \
# # --image-name ghcr.io/The-Nefarious-Developer/${{ matrix.template }}:${{ matrix.variant }} \
# # # --no-cache true
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
},
"devDependencies": {
"@devcontainers/cli": "^0.71.0"
},
"scripts": {
"build": "scripts/build.sh"
}
}

1 change: 0 additions & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ for TEMPLATE in "${TEMPLATES[@]}"; do
# Wait for all background jobs to finish
wait
done

echo "Images creation process complete."

# Generate the variant-matrix.json file for pipeline automation
Expand Down

0 comments on commit fbc7cae

Please sign in to comment.