ci: adding github actions to build and publish Galaxy #48
Workflow file for this run
This file contains 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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Build and Test Galaxy | |
on: | |
# push: | |
# branches: [ "main" ] | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.11"] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5.2.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup environment | |
env: | |
GITHUB_PATH: ${{ github.path }} | |
VENV_PATH: "$GITHUB_PATH/.venv" | |
# POETRY_HOME: "$GITHUB_PATH/.cache/.poetry" | |
POETRY_HOME: "$GITHUB_PATH/.poetry" | |
BIN_PATH: "$GITHUB_PATH/.bin" | |
run: | | |
mkdir -p ${VENV_PATH} ${POETRY_HOME} ${BIN_PATH} | |
export PATH="${VENV_PATH}/bin:${POETRY_HOME}/bin:${BIN_PATH}:$PATH" | |
export PYTHONUNBUFFERED=1 | |
export PYTHONDONTWRITEBYTECODE=1 | |
export POETRY_VIRTUALENVS_IN_PROJECT=true | |
export POETRY_VIRTUALENVS_CREATE=true | |
sudo apt-get update && sudo apt-get install --no-install-recommends -y build-essential curl git | |
cp /usr/bin/make ${BIN_PATH} | |
- name: Install dependencies | |
run: | | |
make install | |
- name: Run linter | |
run: | | |
make lint | |
- name: Run tests | |
run: | | |
make test | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker Login | |
uses: docker/login-action@v3.3.0 | |
with: | |
# Username used to log against the Docker registry | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
# Password or personal access token used to log against the Docker registry | |
password: ${{ secrets.DOCKER_HUB_SECRET }} | |
- name: describe tags | |
id: describe_tags | |
run: | | |
echo "IMAGE_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")-build.${GITHUB_RUN_ID}-${GITHUB_SHA}" >> "$GITHUB_OUTPUT" | |
# - name: Build and push Docker images | |
# uses: docker/build-push-action@v6.9.0 | |
# with: | |
# # List of annotation to set to the image | |
# annotations: # optional | |
# # List of build-time variables | |
# build-args: # optional | |
# # List of additional build contexts (e.g., name=path) | |
# build-contexts: # optional | |
# # Builder instance | |
# builder: # optional | |
# # List of external cache sources for buildx (e.g., user/app:cache, type=local,src=path/to/dir) | |
# cache-from: # optional | |
# # List of cache export destinations for buildx (e.g., user/app:cache, type=local,dest=path/to/dir) | |
# cache-to: # optional | |
# # Optional parent cgroup for the container used in the build | |
# cgroup-parent: # optional | |
# # Build's context is the set of files located in the specified PATH or URL | |
# context: # optional | |
# # Path to the Dockerfile | |
# file: # optional | |
# # List of metadata for an image | |
# labels: # optional | |
# # Load is a shorthand for --output=type=docker | |
# load: # optional, default is false | |
# # Set the networking mode for the RUN instructions during build | |
# network: # optional | |
# # Do not use cache when building the image | |
# no-cache: # optional, default is false | |
# # Do not cache specified stages | |
# no-cache-filters: # optional | |
# # List of output destinations (format: type=local,dest=path) | |
# outputs: # optional | |
# # List of target platforms for build | |
# platforms: # optional | |
# # Push is a shorthand for --output=type=registry | |
# # push: # optional, default is false | |
# # List of secrets to expose to the build (e.g., key=string, GIT_AUTH_TOKEN=mytoken) | |
# secrets: # optional | |
# # List of secret env vars to expose to the build (e.g., key=envname, MY_SECRET=MY_ENV_VAR) | |
# secret-envs: # optional | |
# # List of tags | |
# tags: # optional | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
env: | |
IMAGE_TAG: ${{ steps.describe_tags.outputs.IMAGE_TAG }} | |
with: | |
file: deploy/docker/Dockerfile | |
# push: true | |
tags: devrelyio/galaxy:"$IMAGE_TAG" | |
platforms: linux/amd64,linux/arm64 | |