From 1ef3ab9551ed63044213673d32509c57a907b26f Mon Sep 17 00:00:00 2001 From: Ioannis Paraskevakos Date: Tue, 26 Nov 2024 18:06:37 +0000 Subject: [PATCH] CI docker image generation --- .github/workflows/black.yml | 4 ++-- .github/workflows/pytest.yml | 33 ++++++++++++++------------------- .github/workflows/release.yml | 25 +++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 73d56c1..35509d0 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -1,6 +1,6 @@ name: Formatting -on: [push, pull_request] +on: [push, pull_request, release] jobs: lint: @@ -12,4 +12,4 @@ jobs: with: options: "--check --verbose" - uses: isort/isort-action@master - continue-on-error: true \ No newline at end of file + continue-on-error: true diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index f4c2aa7..a6ebeda 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -1,23 +1,18 @@ name: Tests -on: [push, pull_request, pull_request_target] +on: [push, pull_request, pull_request_target, release] jobs: - Test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v4 - with: - python-version: "3.10" - cache: "pip" - - - run: pip install -e ".[dev]" - - - run: pytest --cov --cov-append - - - uses: coverallsapp/github-action@v2 - with: - file: .coverage \ No newline at end of file + Test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: "3.10" + cache: "pip" + - run: pip install -e ".[dev]" + - run: pytest --cov --cov-append + - uses: coverallsapp/github-action@v2 + with: + file: .coverage diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b7d85ef --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: release +on: + release: + types: [created] + workflow_run: + workflows: ["Formatting", "Tests"] + types: + - completed + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + file: ./Dockerfile + push: false + tags: simonsobs/librarian:${{ github.event.release.tag_name }}