Update actions/setup-python action to v6 #203
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: Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| detect-changes: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: read | |
| contents: read | |
| outputs: | |
| # JSON array of changed filters | |
| changes: ${{ steps.filter.outputs.changes }} | |
| steps: | |
| # For pull requests it's not necessary to checkout the code | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.x' | |
| - uses: jannekem/run-python-script-action@v1 | |
| id: generate-changes | |
| with: | |
| script: | | |
| import os | |
| import json | |
| for folder in os.listdir('src'): | |
| config = os.path.join('src', folder, 'devcontainer-feature.json') | |
| if not os.path.isfile(config): | |
| continue | |
| with open(config, 'r') as f: | |
| data = json.load(f) | |
| if data.get('deprecated') is True: | |
| print(f"Skipping deprecated feature: {folder}") | |
| continue | |
| with open('.github/tmp-paths-filter.yml', 'a') as f: | |
| f.write(f"{folder}:\n") | |
| f.write(f" - '**/{folder}/**'\n") | |
| f.write(f" - '.github/workflows/test.yaml'\n") | |
| - name: Print paths filter | |
| run: cat .github/tmp-paths-filter.yml | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: .github/tmp-paths-filter.yml | |
| test-autogenerated: | |
| needs: detect-changes | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| if: ${{ needs.detect-changes.outputs.changes != '[]' }} | |
| strategy: | |
| matrix: | |
| features: ${{ fromJson(needs.detect-changes.outputs.changes) }} | |
| baseImage: | |
| - debian:latest | |
| - ubuntu:latest | |
| - mcr.microsoft.com/devcontainers/base:ubuntu | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - 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: | |
| needs: detect-changes | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| if: ${{ needs.detect-changes.outputs.changes != '[]' }} | |
| strategy: | |
| matrix: | |
| features: ${{ fromJson(needs.detect-changes.outputs.changes) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - 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@v4 | |
| - name: "Install latest devcontainer CLI" | |
| run: npm install -g @devcontainers/cli | |
| - name: "Testing global scenarios" | |
| run: devcontainer features test --global-scenarios-only . |