Skip to content

Commit

Permalink
Merge branch 'main' into fix/compiler-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Sep 13, 2023
2 parents ede263b + 186f2f8 commit b0e4d12
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: tests
name: Version Test

on:
push:
Expand All @@ -9,7 +9,7 @@ on:
paths-ignore: ['**.md']

concurrency:
group: ${{ github.ref }}
group: ${{ github.ref }}-version
cancel-in-progress: true

jobs:
Expand All @@ -19,7 +19,13 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ["default", "0.6.11", "==0.6.11", "git+https://github.com/ApeWorX/ape.git@main"]
version:
[
'default',
'0.6.11',
'==0.6.11',
'git+https://github.com/ApeWorX/ape.git@main',
]
steps:
- uses: actions/checkout@v3

Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/test_plugins.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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:
run-this-action:
name: Run action (${{ matrix.plugins }})
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
matrix:
plugins: [
'default_with_version_config',
'default_without_version_in_config',
'tokens',
'tokens==0.6.1'
]
steps:
- uses: actions/checkout@v3

- 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`.
sed -i 's/version: 0.6.1//g' "ape-config.yaml"
fi
- name: Run ape action
id: ape-action
uses: ./
with:
ape-plugins-list: ${{ steps.check-plugins.outputs.ape-plugins }}

- run: ape plugins list
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@ Can also use a `git+` value to install a branch, commit, or tag.

Example values:

* `1.0.0`
* `==1.0.0`
* `>=1.0.0,<2.0`
* `git+https://github.com/your-github/ape.git@your-branch`
- `1.0.0`
- `==1.0.0`
- `>=1.0.0,<2.0`
- `git+https://github.com/your-github/ape.git@your-branch`

### `ape-plugins-list`

**Optional** Space-separated list of plugins to install.
Default is to install from local `ape-config.yaml`.
The default is to install from your project's local `ape-config.yaml`.
If you do not have any plugin version constraints specified in your `ape-config.yaml` file, the default includes the `-U` (`--upgrade`) flag to ensure you get the latest plugin versons.
Otherwise, it relies on the constraints you have configured.

Note: When requesting a pin, put it all together like `'plugin-a plugin-b==1.2.3 plugin-c>1.2'`
To request specific versions of plugins, use a space-separated value like this `'plugin-a plugin-b==1.2.3 plugin-c>1.2'`.

## Outputs

Expand Down
44 changes: 38 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ inputs:
ape-plugins-list:
description: 'Space seperated list of plugins to install with relevant pinning applied'
required: False
default: '-U .'
default: ''

outputs:
ape-version:
Expand Down Expand Up @@ -88,19 +88,51 @@ runs:
fi
shell: bash

- run: ape plugins install ${{ inputs.ape-plugins-list }}
- name: Check ape-config.yaml exists
id: check-ape-config-yaml
uses: andstor/file-existence-action@v2
with:
files: 'ape-config.yaml'

- name: Check version specs in config
id: check-plugin-version-specs
run: |
if [[ "${{ steps.check-ape-config-yaml.outputs.files_exists }}" == "true" ]]; then
version_present=$(sed -n '/^plugins:/,/^[^ ]/{/version:/p;}' "ape-config.yaml" | grep -c version || true)
if [[ -z "${version_present}" ]]; then
echo "version_present=0" >> $GITHUB_OUTPUT
else
echo "version_present=1" >> $GITHUB_OUTPUT
fi
else
echo "version_present=0" >> $GITHUB_OUTPUT
fi
shell: bash

- name: Find if requirements.txt if exists
id: find-requirements-txt
- name: Install Plugins
run: |
echo "file=$(ls requirements.txt)" >> $GITHUB_OUTPUT
if [[ "${{ steps.check-plugin-version-specs.outputs.version_present }}" == "1" ]] && [[ -z "${{ inputs.ape-plugins-list }}" ]]; then
plugins_value="."
elif [[ -z "${{ inputs.ape-plugins-list }}" ]]; then
plugins_value="--upgrade ."
else
plugins_value="${{ inputs.ape-plugins-list }}"
fi
ape plugins install $plugins_value
shell: bash

- name: Check requirments.txt exists
id: check-requirements-txt
uses: andstor/file-existence-action@v2
with:
files: 'requirements.txt'

- name: Install requirements.txt
run: pip install -r requirements.txt
shell: bash
if: steps.find-requirements-txt.outputs.file == 'requirements.txt'
if: steps.check-ape-config-yaml.outputs.files_exists == true

- name: Ensure compiler directories exist
run: |
Expand Down
4 changes: 4 additions & 0 deletions ape-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This file exists only as a test for the action.
plugins:
- name: tokens
version: 0.6.1
1 change: 1 addition & 0 deletions mdformat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
number = true

0 comments on commit b0e4d12

Please sign in to comment.