Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/build-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: build flux-metrics-api

on:

# Publish packages on release
release:
types: [published]

# Test on pull request
pull_request: []

# On push to main we build and deploy images
push:
branches:
- main

jobs:
build:
permissions:
packages: write

# This is the container URI without a tag
env:
container: ghcr.io/converged-computing/flux-metrics-api

runs-on: ubuntu-latest
name: Build
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build Regular Container
run: docker build -t ${{ env.container }}:latest .

- name: GHCR Login
if: (github.event_name != 'pull_request')
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Tag and Push Release Image
if: (github.event_name == 'release')
run: |
tag=${GITHUB_REF#refs/tags/}
echo "Tagging and releasing ${{ env.container }}:${tag}"
docker tag ${{ env.container }}:latest ${{ env.container }}:${tag}
docker push ${{ env.container }}:${tag}

- name: Deploy
if: (github.event_name != 'pull_request')
run: |
docker push ${{ env.container }}:latest
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: test flux-metrics-api

on:
pull_request: []

jobs:
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup black linter
run: conda create --quiet --name black pytest

- name: Check Spelling
uses: crate-ci/typos@7ad296c72fa8265059cc03d1eda562fbdfcd6df2 # v1.9.0
with:
files: ./README.md

- name: Lint and format Python code
run: |
export PATH="/usr/share/miniconda/bin:$PATH"
source activate black
pip install -r .github/requirements-dev.txt
pre-commit run --all-files
31 changes: 31 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: release flux-metrics-api

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install
run: conda create --quiet --name flux twine

- name: Install dependencies
run: |
export PATH="/usr/share/miniconda/bin:$PATH"
source activate flux
pip install -e .[all]
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }}
run: |
export PATH="/usr/share/miniconda/bin:$PATH"
source activate flux
python setup.py sdist bdist_wheel
twine upload dist/*
71 changes: 71 additions & 0 deletions .github/workflows/update-contributors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: contributors flux-metrics-api

on:
push:
branches:
- main

jobs:
Update:
name: Generate
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Tributors Update
uses: con/tributors@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
parsers: unset
update_lookup: github
log_level: DEBUG
force: true
threshold: 1
run_twice: true

- name: Checkout New Branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_AGAINST: main
run: |
printf "GitHub Actor: ${GITHUB_ACTOR}\n"
export BRANCH_FROM="contributors/update-$(date '+%Y-%m-%d')"
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"

BRANCH_EXISTS=$(git ls-remote --heads origin ${BRANCH_FROM})
if [[ -z ${BRANCH_EXISTS} ]]; then
printf "Branch does not exist in remote.\n"
else
printf "Branch already exists in remote.\n"
exit 1
fi
git branch
git checkout -b "${BRANCH_FROM}" || git checkout "${BRANCH_FROM}"
git branch

git config --global user.name "github-actions"
git config --global user.email "github-actions@users.noreply.github.com"
git status

if git diff-index --quiet HEAD --; then
export OPEN_PULL_REQUEST=0
printf "No changes\n"
else
export OPEN_PULL_REQUEST=1
printf "Changes\n"
git commit -a -m "Automated deployment to update contributors $(date '+%Y-%m-%d')"
git push origin "${BRANCH_FROM}"
fi

echo "OPEN_PULL_REQUEST=${OPEN_PULL_REQUEST}" >> $GITHUB_ENV
echo "PULL_REQUEST_FROM_BRANCH=${BRANCH_FROM}" >> $GITHUB_ENV
echo "PULL_REQUEST_TITLE=[tributors] ${BRANCH_FROM}" >> $GITHUB_ENV
echo "PULL_REQUEST_BODY=Tributors update automated pull request." >> $GITHUB_ENV

- name: Open Pull Request
uses: vsoch/pull-request-action@d703f40f3af5ae294f9816395ddf2e3d2d3feafa # 1.0.21
if: ${{ env.OPEN_PULL_REQUEST == '1' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST_BRANCH: main