From e0a40cd42bcf908003815e56e8d619865aa01419 Mon Sep 17 00:00:00 2001 From: Jacob Hummer Date: Fri, 18 Aug 2023 13:30:23 -0500 Subject: [PATCH 1/3] test relevant ones only --- .github/workflows/test-features.yml | 45 ++++++++++++++++++++++ .github/workflows/test.yaml | 58 ----------------------------- 2 files changed, 45 insertions(+), 58 deletions(-) create mode 100644 .github/workflows/test-features.yml delete mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test-features.yml b/.github/workflows/test-features.yml new file mode 100644 index 000000000..fa7feaea9 --- /dev/null +++ b/.github/workflows/test-features.yml @@ -0,0 +1,45 @@ +name: Test features +on: + push: + branches: "main" + paths: + - src/*/** + - test/*/** + - .github/workflows/test-features.yml + pull_request: + paths: + - src/*/** + - test/*/** + - .github/workflows/test-features.yml + workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + list-features: + outputs: + relevant-features: ${{ steps.list-features.outputs.relevant-features }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - id: list-features + uses: devcontainers-community/list-features@v2 + test-feature: + needs: list-features + strategy: + fail-fast: false + matrix: + include: ${{ fromJSON(needs.list-features.outputs.relevant-features) }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: npm install -g @devcontainers/cli + - name: devcontainer features test -f ${{ matrix.id }} + run: | + if [[ -e test/${{ matrix.id }}/test.sh ]]; then + devcontainer features test -f ${{ matrix.id }} + else + devcontainer features test -f ${{ matrix.id }} --skip-autogenerated + fi diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 9e5f9bf79..000000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,58 +0,0 @@ -name: "CI - Test Features" -on: - push: - branches: - - main - pull_request: - workflow_dispatch: - -jobs: - test-autogenerated: - runs-on: ubuntu-latest - continue-on-error: true - strategy: - matrix: - features: - - color - - hello - baseImage: - - debian:latest - - ubuntu:latest - - mcr.microsoft.com/devcontainers/base:ubuntu - steps: - - uses: actions/checkout@v3 - - - name: "Install latest devcontainer CLI" - run: npm install -g @devcontainers/cli - - - name: "Generating tests for '${{ matrix.features }}' against '${{ matrix.baseImage }}'" - run: devcontainer features test --skip-scenarios -f ${{ matrix.features }} -i ${{ matrix.baseImage }} . - - test-scenarios: - runs-on: ubuntu-latest - continue-on-error: true - strategy: - matrix: - features: - - color - - hello - steps: - - uses: actions/checkout@v3 - - - name: "Install latest devcontainer CLI" - run: npm install -g @devcontainers/cli - - - name: "Generating tests for '${{ matrix.features }}' scenarios" - run: devcontainer features test -f ${{ matrix.features }} --skip-autogenerated . - - test-global: - runs-on: ubuntu-latest - continue-on-error: true - steps: - - uses: actions/checkout@v3 - - - name: "Install latest devcontainer CLI" - run: npm install -g @devcontainers/cli - - - name: "Testing global scenarios" - run: devcontainer features test --global-scenarios-only . From 48bb9d7cbb0723d444c427039c902e3bec3f277d Mon Sep 17 00:00:00 2001 From: Jacob Hummer Date: Fri, 18 Aug 2023 13:30:55 -0500 Subject: [PATCH 2/3] more explicit publishing workflow --- .github/workflows/publish-features.yml | 26 ++++++++++++++ .github/workflows/release.yaml | 47 -------------------------- 2 files changed, 26 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/publish-features.yml delete mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/publish-features.yml b/.github/workflows/publish-features.yml new file mode 100644 index 000000000..bd4dd4fc0 --- /dev/null +++ b/.github/workflows/publish-features.yml @@ -0,0 +1,26 @@ +name: Publish features +on: + # push: + # branches: "main" + # paths: + # - src/*/** + # - .github/workflows/publish-features.yml + workflow_dispatch: +concurrency: ${{ github.workflow }} +jobs: + publish-features: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + - run: npm install -g @devcontainers/cli + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - run: devcontainer features publish -r ghcr.io -n ${{ github.repository }} src + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 9ba1e6242..000000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,47 +0,0 @@ -name: "Release dev container features & Generate Documentation" -on: - workflow_dispatch: - -jobs: - deploy: - if: ${{ github.ref == 'refs/heads/main' }} - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - packages: write - steps: - - uses: actions/checkout@v3 - - - name: "Publish Features" - uses: devcontainers/action@v1 - with: - publish-features: "true" - base-path-to-features: "./src" - generate-docs: "true" - - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create PR for Documentation - id: push_image_info - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - set -e - echo "Start." - # Configure git and Push updates - git config --global user.email github-actions[bot]@users.noreply.github.com - git config --global user.name github-actions[bot] - git config pull.rebase false - branch=automated-documentation-update-$GITHUB_RUN_ID - git checkout -b $branch - message='Automated documentation update' - # Add / update and commit - git add */**/README.md - git commit -m 'Automated documentation update [skip ci]' || export NO_UPDATES=true - # Push - if [ "$NO_UPDATES" != "true" ] ; then - git push origin "$branch" - gh pr create --title "$message" --body "$message" - fi From 17f989b52c21e1d971f83dfcf3df735b6b921dba Mon Sep 17 00:00:00 2001 From: Jacob Hummer Date: Fri, 18 Aug 2023 13:31:26 -0500 Subject: [PATCH 3/3] update readmes immediately --- .github/workflows/update-feature-readmes.yml | 30 ++++++++++++++++++++ .github/workflows/validate.yml | 16 ----------- 2 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/update-feature-readmes.yml delete mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/update-feature-readmes.yml b/.github/workflows/update-feature-readmes.yml new file mode 100644 index 000000000..5a6cf29c9 --- /dev/null +++ b/.github/workflows/update-feature-readmes.yml @@ -0,0 +1,30 @@ +name: Update feature readmes +on: + push: + branches: "main" + paths: + - .github/workflows/update-feature-readmes.yml + - src/*/devcontainer-feature.json + pull_request: + paths: + - .github/workflows/update-feature-readmes.yml + - src/*/devcontainer-feature.json + workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + update-feature-readmes: + concurrency: ${{ github.ref }}-write + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: devcontainers/action@v1 + with: + base-path-to-features: src + generate-docs: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: stefanzweifel/git-auto-commit-action@v4 diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml deleted file mode 100644 index 5dcc21b76..000000000 --- a/.github/workflows/validate.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: "Validate devcontainer-feature.json files" -on: - workflow_dispatch: - pull_request: - -jobs: - validate: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: "Validate devcontainer-feature.json files" - uses: devcontainers/action@v1 - with: - validate-only: "true" - base-path-to-features: "./src"