Skip to content

Commit

Permalink
ci: standardize github configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Janusz Marcinkiewicz <[email protected]>
  • Loading branch information
VirrageS committed Aug 10, 2024
1 parent 756a653 commit 875e0e9
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 145 deletions.
71 changes: 36 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,52 @@
name: Build
name: Build `aisnode`
on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
test:
build:
strategy:
matrix:
go-version: ['1.22.x']
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

- name: Checkout code
uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- name: Setup additional system libraries
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt update
sudo apt install -y xattr attr
- name: Setup additional system libraries
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt update
sudo apt install -y xattr attr
- name: Build AIStore on ${{ matrix.os }}
run: |
export GOPATH="$(go env GOPATH)"
# 1) no build tags, no debug
MODE="" make node
# 2) no build tags, debug
MODE="debug" make node
# 3) cloud backends, no debug
AIS_BACKEND_PROVIDERS="aws azure gcp" MODE="" make node
# 4) cloud backends, debug
AIS_BACKEND_PROVIDERS="aws azure gcp" MODE="debug" make node
# 5) cloud backends, debug, statsd
# (build with StatsD, and note that Prometheus is the default when `statsd` tag is not defined)
TAGS="aws azure gcp statsd debug" make node
# 6) statsd, debug, nethttp (note that fasthttp is used by default)
TAGS="nethttp statsd debug" make node
# 7) w/ mem profile (see cmd/aisnodeprofile)
MEM_PROFILE="/tmp/mem" CPU_PROFILE="/tmp/cpu" make node
# 8) authn, cli, aisloader
make authn
make cli
make aisloader
- name: Build AIStore on ${{ matrix.os }}
run: |
export GOPATH="$(go env GOPATH)"
# 1) no build tags, no debug
MODE="" make node
# 2) no build tags, debug
MODE="debug" make node
# 3) cloud backends, no debug
AIS_BACKEND_PROVIDERS="aws azure gcp" MODE="" make node
# 4) cloud backends, debug
AIS_BACKEND_PROVIDERS="aws azure gcp" MODE="debug" make node
# 5) cloud backends, debug, statsd
# (build with StatsD, and note that Prometheus is the default when `statsd` tag is not defined)
TAGS="aws azure gcp statsd debug" make node
# 6) statsd, debug, nethttp (note that fasthttp is used by default)
TAGS="nethttp statsd debug" make node
# 7) w/ mem profile (see cmd/aisnodeprofile)
MEM_PROFILE="/tmp/mem" CPU_PROFILE="/tmp/cpu" make node
# 8) authn, cli, aisloader
make authn
make cli
make aisloader
11 changes: 8 additions & 3 deletions .github/workflows/deploy-website.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
name: Deploy website on Netlify
name: Deploy Website
on:
push:
branches:
- main
pull_request:

jobs:
deploy_website:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./docs
steps:
- name: Checkout
- name: Checkout code
uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.3

- run: |
bundle install
bundle exec jekyll build
- name: Install Netfli CLI
- name: Install Netlify CLI
run: npm install netlify-cli --save-dev

- name: Deploy site on Netlify
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
Expand Down
104 changes: 52 additions & 52 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker Images
name: Container Images

on:
workflow_dispatch:
Expand All @@ -21,7 +21,7 @@ on:
type: boolean
default: true

build_gitlab_ci_image:
build_ci_image:
description: 'Build GitLab CI image (aistorage/ci)'
required: true
type: boolean
Expand Down Expand Up @@ -56,53 +56,53 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v4

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: aisadmin image
if: ${{ inputs.build_admin_image }}
run: |
pushd $GITHUB_WORKSPACE/deploy/prod/k8s/aisadmin_container
IMAGE_REPO="${{ env.ADMIN_IMAGE }}" IMAGE_TAG="${{ inputs.image_tag }}" make -e all
popd
- name: aisnode image
if: ${{ inputs.build_aisnode_image }}
run: |
pushd $GITHUB_WORKSPACE/deploy/prod/k8s/aisnode_container
IMAGE_REPO="${{ env.AISNODE_IMAGE }}" IMAGE_TAG="${{ inputs.image_tag }}" make -e all
popd
- name: cluster-minimal image
if: ${{ inputs.build_cluster_minimal_image }}
run: |
pushd $GITHUB_WORKSPACE/deploy/prod/docker/single
IMAGE_REPO="${{ env.CLUSTER_MINIMAL_IMAGE }}" IMAGE_TAG="${{ inputs.image_tag }}" make -e all
popd
- name: ci image
if: ${{ inputs.build_gitlab_ci_image }}
run: |
pushd $GITHUB_WORKSPACE/deploy/ci
CI_IMAGE="${{ env.CI_IMAGE }}" IMAGE_TAG="${{ inputs.image_tag }}" make -e all
popd
- name: aisnode-minikube image
if: ${{ inputs.build_aisnode_minikube_image }}
run: |
pushd $GITHUB_WORKSPACE/deploy/dev/k8s
IMAGE_REPO="${{ env.AISNODE_MINIKUBE_IMAGE }}" IMAGE_TAG="${{ inputs.image_tag }}" make -e docker-all
popd
- name: authn image
if: ${{ inputs.build_authn_image }}
run: |
pushd $GITHUB_WORKSPACE/deploy/prod/k8s/authn_container
IMAGE_REPO="${{ env.AUTHN_IMAGE }}" IMAGE_TAG="${{ inputs.image_tag }}" make all
popd
- name: Checkout code
uses: actions/checkout@v4

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push `aisadmin` image
if: ${{ inputs.build_admin_image }}
run: |
pushd $GITHUB_WORKSPACE/deploy/prod/k8s/aisadmin_container
IMAGE_REPO="${{ env.ADMIN_IMAGE }}" IMAGE_TAG="${{ inputs.image_tag }}" make -e all
popd
- name: Build and push `aisnode` image
if: ${{ inputs.build_aisnode_image }}
run: |
pushd $GITHUB_WORKSPACE/deploy/prod/k8s/aisnode_container
IMAGE_REPO="${{ env.AISNODE_IMAGE }}" IMAGE_TAG="${{ inputs.image_tag }}" make -e all
popd
- name: Build and push `cluster-minimal` image
if: ${{ inputs.build_cluster_minimal_image }}
run: |
pushd $GITHUB_WORKSPACE/deploy/prod/docker/single
IMAGE_REPO="${{ env.CLUSTER_MINIMAL_IMAGE }}" IMAGE_TAG="${{ inputs.image_tag }}" make -e all
popd
- name: Build and push `ci` image
if: ${{ inputs.build_gitlab_ci_image }}
run: |
pushd $GITHUB_WORKSPACE/deploy/ci
CI_IMAGE="${{ env.CI_IMAGE }}" IMAGE_TAG="${{ inputs.image_tag }}" make -e all
popd
- name: Build and push `aisnode-minikube` image
if: ${{ inputs.build_aisnode_minikube_image }}
run: |
pushd $GITHUB_WORKSPACE/deploy/dev/k8s
IMAGE_REPO="${{ env.AISNODE_MINIKUBE_IMAGE }}" IMAGE_TAG="${{ inputs.image_tag }}" make -e docker-all
popd
- name: Build and push `authn` image
if: ${{ inputs.build_authn_image }}
run: |
pushd $GITHUB_WORKSPACE/deploy/prod/k8s/authn_container
IMAGE_REPO="${{ env.AUTHN_IMAGE }}" IMAGE_TAG="${{ inputs.image_tag }}" make all
popd
12 changes: 7 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: lint (on linux)
name: Lint
on:
push:
branches:
Expand All @@ -10,7 +10,7 @@ on:
workflow_dispatch:

jobs:
build:
lint:
strategy:
matrix:
go-version: ['1.22.x']
Expand All @@ -25,12 +25,14 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: golangci-lint
- name: Install `golangci-lint`
uses: golangci/golangci-lint-action@v3
with:
version: v1.59.1 ### NOTE: see also: Makefile lint-update-ci
# NOTE: See `lint-update-ci` target in Makefile.
version: v1.59.1
args: --timeout=30m
- name: Lint linux

- name: Lint
run: |
export GOPATH="$(go env GOPATH)"
make lint
Expand Down
85 changes: 45 additions & 40 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,50 @@
name: Publish Python distribution to PyPI

name: Publish Python to PyPI
on:
workflow_dispatch:
inputs:
check_version:
description: 'I confirm that I have verified version to be published at https://github.com/NVIDIA/aistore/blob/main/python/aistore/version.py'
required: true
type: boolean
default: false
workflow_dispatch:
inputs:
check_version:
description: 'I confirm that I have verified version to be published at https://github.com/NVIDIA/aistore/blob/main/python/aistore/version.py'
required: true
type: boolean
default: false

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
if: ${{ inputs.check_version }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: |
pushd $GITHUB_WORKSPACE/python
python3 -m build
popd
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: python/dist
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: |
pushd $GITHUB_WORKSPACE/python
python3 -m build
popd
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: python/dist

publish-to-pypi:
name: >-
Publish Python distribution to PyPI
name: Publish Python distribution to PyPI
needs:
- build
- build
runs-on: ubuntu-latest
environment:
name: pypi
Expand All @@ -49,10 +53,11 @@ jobs:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
10 changes: 5 additions & 5 deletions .github/workflows/test-python-etl.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

name: Python ETL Tests
on:
push:
branches: [ "main" ]
branches:
- main
pull_request:
branches: [ "main" ]

branches:
- main
workflow_dispatch:

jobs:
build:
test:
runs-on: ubuntu-latest

steps:
Expand Down
Loading

0 comments on commit 875e0e9

Please sign in to comment.