Reusable Github Action to help on daily development!
Lume CI 🔥
Performs continuous integrations steps using Python package lume
.
This workflow will run the following steps:
- lint
- check-requirements
- static-analysis
- test-unit
- test-integration
- test-acceptance
Example:
ci:
uses: alice-biometrics/actions-public/.github/workflows/lume-ci.yml@main
with:
language: python
Name | Requirement | Default | Description |
---|---|---|---|
language |
required | Select the language (Use python or node) | |
lume_version |
optional | latest | Select the lume version if required. Check the release history |
lume_config_filename |
optional | lume.yml | In case you want to change the name of the lume configuration file or just store in another folder |
pre_commands |
optional | Set additional lume commands to be executed at the begining of the required ones. Use commas if you need to execute several commands | |
post_setup_commands |
optional | Set additional lume commands to be executed after the setup and before required ones. Use commas if you need to execute several commands | |
post_commands |
optional | Set additional lume commands to be executed at the end of the required ones. Use commas if you need to execute several commands | |
python_version |
optional | "3.10" | Set Python Version |
runs_on |
optional | "ubuntu-latest" | Set the machine |
use_cache |
optional | true | This allows you to clear your cache with falso. This could be useful to debug rare behavior |
working_directory |
optional | . | Se the working directory |
use_uv |
optional | false | Use uv to accelerate pip installation (python) |
Name | Requirement | Description |
---|---|---|
github_access_token |
optional | Only required if you need the token to be passed to requirements or dependency manager |
gke_project |
optional | ID of the Google Cloud Platform project. If provided, this will configure gcloud to use this project ID by default for commands. |
gke_key |
optional | The service account key which will be used for authentication credentials. This key should be created and stored as a secret. It can be encoded as a Base64 string or as JSON. |
To make it work, it is necessary to have a lume file in the root with at least the following commands (Python example):
name: Testing
install:
run: pip install --upgrade --upgrade-strategy eager -r requirements/dev-requirements.txt -r requirements/requirements.txt
steps:
clean:
run: echo "clean"
lint:
run:
- black --check .
- flake8 tests
check-requirements:
run: safety check -r requirements/requirements.txt
test-unit:
run: echo "test-unit"
test-integration:
run: echo "test-integration"
test-acceptance:
run: echo "test-acceptance"
If you want to change or fix a lume version and also execute additional lume commands, you can do it with the following code:
ci:
uses: alice-biometrics/actions-public/.github/workflows/lume-ci.yml@main
with:
language: python
lume_version: 0.5.2
pre_commands: pre-command # should be available on lume.yml otherwise those won't be executed
post_setup_commands: build # should be available on lume.yml otherwise those won't be executed
post_commands: my-additional-command-1,my-additional-command-2 # should be available on lume.yml otherwise those won't be executed
Notify Slack 💬
This action sends a Slack notification to a selected channel. This action is a wrapper of the slack-notify action.
Example:
build:
uses: alice-biometrics/actions-public/.github/workflows/notify-slack.yml@main
with:
channel: my-slack-channel
title: Success on Service Deploy
message: 'New version deployed (v1.1.1)'
secrets:
slack_token: ${{ secrets.MY_SLACK_TOKEN }}
Name | Requirement | Description |
---|---|---|
slack_token |
required | Credentials to access to slack channel |
Get Version 🏷️
This action obtains the version from tags, commits and releases.
Example:
get-version:
uses: alice-biometrics/actions-public/.github/workflows/get-version.yml@main
with:
type: beta
Name | Requirement | Default | Description |
---|---|---|---|
type |
required | Choices [release, beta, alpha]. If uses alpha and beta it returns the version from latest tag and latest commit (e.g 0.0.1-4c5ff17a ). If uses release it returns a version obtained from latest tag created on a github release (e.g 0.0.2 ) |
Name | Description |
---|---|
version |
Version obtained from git |
Example to get this output:
get-version:
uses: alice-biometrics/actions-public/.github/workflows/get-version.yml@main
with:
type: commit
print-version:
needs: get-version
runs-on: ubuntu-latest
steps:
- name: Print Version
run: echo "Version: ${{ needs.get-version.version }}"
Commit Changes ✍️
This action modify two files (VERSION, DEPLOY) and push changes to the repository.
Example:
commit-changes:
uses: alice-biometrics/actions-public/.github/workflows/commit-changes.yml@main
with:
version: 1.0.0
deploy_timestamp: 2021-12-02 09:56:29+00:00
secrets:
github_access_token: ${{ secrets.MY_GITHUB_ACCESS_TOKEN }}
Name | Requirement | Default | Description |
---|---|---|---|
version |
required | Version of the application | |
deploy_timestamp |
required | Deploy timestamps (you can obtained with date -u --rfc-3339=seconds ) |
|
working_directory |
optional | Working directory | |
target_directory |
optional | app | Target folder where VERSION and DEPLOY files will be stored |
Name | Requirement | Description |
---|---|---|
github_access_token |
required | Used to push changes to git |
Update folder from Git Repository 📁
This action downloads a repository and copy its contain to a defined folder.
Example:
update-folder-from-git-repository:
uses: alice-biometrics/actions-public/.github/workflows/commit-changes.yml@main
with:
name: My Workflow Name
git_repository: github.com/<organization>/<my-repo>.git
folder: my-folder
commit_message: Update my-folder
secrets:
github_access_token: ${{ secrets.MY_GITHUB_ACCESS_TOKEN }}
Name | Requirement | Description |
---|---|---|
name |
required | Name of the executed job |
git_repository |
required | Git Repository (format -> github.com/alice-biometrics/.git) |
folder |
required | Folder where repository will be downloaded |
commit_message |
required | Message to commit changes if needed |
Name | Requirement | Description |
---|---|---|
github_access_token |
required | Used to push changes to git |
Set Global variable 📁
This action sets a global variable, and you can share it across different jobs. This solution has been created as a workaround to bypass current GitHub Action limitation.
❌ The workflow is not valid. .github/workflows/<YOUR-WORKFLOW>.yml (Line: XX, Col: XX): Unrecognized named-value: 'env'. Located at position 1 within expression: env.MY_VAR
To bypass this limitation just use set-global action.
Example:
set-global:
uses: alice-biometrics/actions-public/.github/workflows/set-global.yml@main
with:
value: My Global Value
Name | Requirement | Description |
---|---|---|
value |
required | Global Value (This will be redirect to the job output |
Name | Description |
---|---|
value |
Set Value |
Example to get this output:
set-global:
uses: alice-biometrics/actions-public/.github/workflows/set-global.yml@main
with:
value: My Global Value
print-version:
needs: set-global
runs-on: ubuntu-latest
steps:
- name: Print Version
run: echo "Global: ${{ needs.set-global.value }}"
Publish to PyPI
This action publish a python package to PyPI registry.
Valid to packages with setup.py
and pyproject.toml
(new 🚀).
Example:
publish-pypi:
uses: alice-biometrics/actions-public/.github/workflows/publish-pypi.yml@main
with:
package_name: my_package
version: 1.0.0
secrets:
username: __token__
password: pypi-********************
github_access_token: ${{ secrets.MY_GITHUB_ACCESS_TOKEN }}
Name | Requirement | Description |
---|---|---|
package_name |
required | Name of the package |
version |
required | Version of the package |
folder |
optional | Folder where VERSION file is going to be update (default package_name value) |
Name | Requirement | Description |
---|---|---|
username |
required | Username (We use Twine, so default value should be __token__ ) |
password |
required | Password/Token (We use Twine) |
repository_url |
optional | URL of PyPI artifactory repo (We use Twine) |
github_access_token |
required | Required to upload the VERSION FILE |