ci: update GitHub Actions #147
Workflow file for this run
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: Plugins Test | |
| on: | |
| push: | |
| branches: [main] | |
| tags-ignore: ['**'] | |
| paths-ignore: ['**.md'] | |
| pull_request: | |
| paths-ignore: ['**.md'] | |
| concurrency: | |
| group: ${{ github.ref }}-plugins | |
| cancel-in-progress: true | |
| jobs: | |
| test-plugins: | |
| name: Test plugins (${{ matrix.plugins }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| plugins: [ | |
| 'default_with_version_config', | |
| 'default_without_version_in_config', | |
| 'tokens', | |
| 'tokens==0.8.9' | |
| ] | |
| config-file: [ | |
| 'ape-config.yaml', | |
| 'pyproject.toml', | |
| ] | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check plugins | |
| id: check-plugins | |
| run: | | |
| if [[ "${{ matrix.plugins }}" != default_* ]]; then | |
| echo "ape-plugins=${{ matrix.plugins }}" >> $GITHUB_OUTPUT | |
| fi | |
| if [[ "${{ matrix.plugins }}" == "default_without_version_in_config" ]]; then | |
| # Remove the version so it defaults to `. -U`. | |
| awk '!/version: 0.8.9/' "ape-config.yaml" > "ape-config.tmp" && mv "ape-config.tmp" "ape-config.yaml" | |
| fi | |
| - name: Convert 'ape-config.yaml' to 'pyproject.toml' | |
| if: ${{ matrix.config-file == 'pyproject.toml' }} | |
| shell: bash | |
| run: | | |
| pip install tomlkit PyYAML | |
| python -c 'from pathlib import Path; import yaml; import tomlkit; print(tomlkit.dumps({"tool": {"ape": yaml.safe_load(Path("ape-config.yaml").read_text())}}))' | tee pyproject.toml | |
| rm ape-config.yaml | |
| - name: Run ape action | |
| id: ape-action | |
| uses: ./ | |
| with: | |
| ape-plugins-list: ${{ steps.check-plugins.outputs.ape-plugins }} | |
| - name: Check results | |
| shell: bash | |
| run: | | |
| result="$(ape plugins list | grep -o 'tokens.*' | grep -o '[0-9\.]*')" | |
| if [[ "${{ matrix.plugins }}" == "default_without_version_in_config" || "${{ matrix.plugins }}" == "tokens" ]]; | |
| then | |
| if [[ $result == "0.8.9" ]]; | |
| then | |
| echo "Expected $result to be greater than 0.8.9" | |
| exit 1; | |
| fi | |
| else | |
| if [[ $result != "0.8.9" ]]; | |
| then | |
| echo "Expected $result to be equal to 0.8.9" | |
| exit 1; | |
| fi | |
| fi |