diff --git a/.github/workflows/delete_untagged.py b/.github/workflows/delete_untagged.py new file mode 100755 index 0000000..c89492e --- /dev/null +++ b/.github/workflows/delete_untagged.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +import argparse +import json +import requests +import types + +parser = argparse.ArgumentParser() +parser.add_argument("token", help="GitHub token") +args = parser.parse_args() + +domain = "api.github.com" +org = "BNLNPPS" +package_type = "container" +package_name = "esi-opticks" + +api_url = f"https://{domain}/orgs/{org}/packages/{package_type}/{package_name}/versions" + +respjson = requests.get(api_url, auth=("token", args.token)) +entries = json.loads(respjson.text, object_hook=lambda d: types.SimpleNamespace(**d)) + +for e in entries: + if not e.metadata.container.tags: + response = requests.delete(api_url + f"/{e.id}", auth=("token", args.token)) + print("delete", e.id, e.html_url, e.name, response.url, response.status_code) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e5492ea --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,68 @@ +name: Release + +on: + push: + branches: + - semrel + +jobs: + build-test-release: + runs-on: ubuntu-latest + steps: + - name: Define environment variables + run: echo IMAGE_NAME=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV + + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Important for Semantic Release to analyze all commits + + - name: Set up Docker buildx + uses: docker/setup-buildx-action@v3 + + - name: Build container + uses: docker/build-push-action@v5 + with: + file: Dockerfile.test + tags: ${{ env.IMAGE_NAME }}:pre-semver + load: true + cache-from: ${{ env.IMAGE_NAME }}:latest + + - name: Run tests + run: docker run ${{ env.IMAGE_NAME }}:pre-semver curl --version + + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v4 + id: semantic + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ steps.semantic.outputs.new_release_git_tag }} + + - name: Login to GitHub container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build container + uses: docker/build-push-action@v5 + with: + file: Dockerfile.test + tags: | + ${{ env.IMAGE_NAME }}:latest + ${{ env.IMAGE_NAME }}:${{ steps.semantic.outputs.new_release_version }} + push: true + cache-from: ${{ env.IMAGE_NAME }}:pre-semver + + cleanup: + runs-on: ubuntu-latest + needs: build-test-release + steps: + - name: Checkout code + uses: actions/checkout@v4 + - run: .github/workflows/delete_untagged.py ${{ secrets.GITHUB_TOKEN }} diff --git a/.releaserc.yaml b/.releaserc.yaml new file mode 100644 index 0000000..5be77ac --- /dev/null +++ b/.releaserc.yaml @@ -0,0 +1,15 @@ +# See https://semantic-release.gitbook.io/semantic-release/usage/configuration +branches: + - semrel +tagFormat: '${version}' # without this, the tag is prefixed with a 'v' +plugins: + - "@semantic-release/commit-analyzer" + - "@semantic-release/release-notes-generator" + - "@semantic-release/changelog" + - path: "@semantic-release/npm" + npmPublish: false + - path: "@semantic-release/git" + assets: + - "CHANGELOG.md" + - "package.json" + message: "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}" diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5f29d33 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,56 @@ +## [1.1.4](https://github.com/BNLNPPS/esi-opticks/compare/1.1.3...1.1.4) (2024-04-25) + + +### Bug Fixes + +* use github token ([4d8c086](https://github.com/BNLNPPS/esi-opticks/commit/4d8c08688d51d5f53df700a98d431280d576278a)) + +## [1.1.3](https://github.com/BNLNPPS/esi-opticks/compare/1.1.2...1.1.3) (2024-04-25) + + +### Bug Fixes + +* use token ([6b80ed1](https://github.com/BNLNPPS/esi-opticks/commit/6b80ed1da4f1c06bf4f55e158d9b4e0bfd57b98b)) + +## [1.1.2](https://github.com/BNLNPPS/esi-opticks/compare/1.1.1...1.1.2) (2024-04-25) + + +### Bug Fixes + +* make executable ([d324a4a](https://github.com/BNLNPPS/esi-opticks/commit/d324a4a8e23a9046a0835c2aaa36de224156b50d)) + +## [1.1.1](https://github.com/BNLNPPS/esi-opticks/compare/1.1.0...1.1.1) (2024-04-25) + + +### Bug Fixes + +* update permission ([57b9990](https://github.com/BNLNPPS/esi-opticks/commit/57b99906617e4360c511e4eeb06e8c7ffd4c5edc)) + +# [1.1.0](https://github.com/BNLNPPS/esi-opticks/compare/1.0.0...1.1.0) (2024-04-25) + + +### Features + +* delete untagged images ([2d5c4d5](https://github.com/BNLNPPS/esi-opticks/commit/2d5c4d55f92648441a60f49b900923bbc42c404d)) + +# 1.0.0 (2024-04-25) + + +### Bug Fixes + +* **build:** keep build cache dir ([#21](https://github.com/BNLNPPS/esi-opticks/issues/21)) ([d81672d](https://github.com/BNLNPPS/esi-opticks/commit/d81672d8f4a08532e2719851320ee9e3112cb5a5)) +* **esi-shell:** avoid building code (OptiX) on shell startup ([#23](https://github.com/BNLNPPS/esi-opticks/issues/23)) ([76320cf](https://github.com/BNLNPPS/esi-opticks/commit/76320cf6e8d43e37414d0469ae8f81c950f97231)) +* **esi-shell:** drop support for singularity with GPU (for now) ([#22](https://github.com/BNLNPPS/esi-opticks/issues/22)) ([4cb9d19](https://github.com/BNLNPPS/esi-opticks/commit/4cb9d19c3180ac66aab8d58a4e615cd4e0e6567e)) +* **esi-shell:** improve user experience ([#20](https://github.com/BNLNPPS/esi-opticks/issues/20)) ([0a464af](https://github.com/BNLNPPS/esi-opticks/commit/0a464af1dd9d01cedb98dd50b3f3681dbe73da22)) +* **esi-shell:** support only linux ([#13](https://github.com/BNLNPPS/esi-opticks/issues/13)) ([6cfb154](https://github.com/BNLNPPS/esi-opticks/commit/6cfb154d82fe252089b10ef92db3a63707c2a60b)) +* patch spack default modules.yaml ([#27](https://github.com/BNLNPPS/esi-opticks/issues/27)) ([23183af](https://github.com/BNLNPPS/esi-opticks/commit/23183af24648db3fdcdf0c5a9dc94385d9aa1b9c)) +* set compute capability to 5.2 compatible with Quadro M4000 ([#1](https://github.com/BNLNPPS/esi-opticks/issues/1)) ([b1d7513](https://github.com/BNLNPPS/esi-opticks/commit/b1d751357c61ac3e18a94262536ca397d1fa54e7)) +* simplify build workflow, leverage login scripts ([#8](https://github.com/BNLNPPS/esi-opticks/issues/8)) ([fd974b4](https://github.com/BNLNPPS/esi-opticks/commit/fd974b4c42dbcb8c1247cd262bafbf16e4eb071b)) +* use correct gdml file ([c014536](https://github.com/BNLNPPS/esi-opticks/commit/c014536e4452a815bef61a2b03bfe456a898bb7d)) + + +### Features + +* add esi-shell ([#6](https://github.com/BNLNPPS/esi-opticks/issues/6)) ([fa859aa](https://github.com/BNLNPPS/esi-opticks/commit/fa859aa91496b27fb66d891ef78a28ec90b45c50)) +* setup semantic release ([0515111](https://github.com/BNLNPPS/esi-opticks/commit/0515111b81f304db1014417a70a160fa5525c0b9)) +* upgrade opticks to main@b55f15bd ([#26](https://github.com/BNLNPPS/esi-opticks/issues/26)) ([946da36](https://github.com/BNLNPPS/esi-opticks/commit/946da36cdc7fe309c63a8547ca8aeeeb0551a313)) diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 0000000..e34109b --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,7 @@ +# syntax=docker/dockerfile:latest + +FROM nvcr.io/nvidia/cuda:11.8.0-runtime-ubuntu22.04 + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt update && apt install -y curl diff --git a/package.json b/package.json new file mode 100644 index 0000000..e0f6bb8 --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "esi-opticks", + "version": "1.1.4", + "description": "esi shell project", + "repository": { + "type": "git", + "url": "git+https://github.com/BNLNPPS/esi-opticks.git" + }, + "keywords": [], + "author": "BNL NPPS", + "license": "MIT", + "bugs": { + "url": "https://github.com/BNLNPPS/esi-opticks/issues" + }, + "homepage": "https://github.com/BNLNPPS/esi-opticks#readme", + "devDependencies": { + "@semantic-release/changelog": "^6.0.3", + "@semantic-release/commit-analyzer": "^12.0.0", + "@semantic-release/git": "^10.0.1", + "@semantic-release/release-notes-generator": "^13.0.0", + "semantic-release": "^23.0.8" + } +}