This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from BerkeleyLibrary/docker-build
Docker build fixup
- Loading branch information
Showing
4 changed files
with
104 additions
and
40 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: Build | ||
on: | ||
- push | ||
- pull_request | ||
- workflow_dispatch | ||
env: | ||
REGISTRY: ghcr.io | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Sanitize image name | ||
uses: actions/github-script@v6 | ||
id: image-name | ||
with: | ||
result-encoding: string | ||
script: return '${{ env.REGISTRY }}/${{ github.repository }}'.toLowerCase() | ||
- name: Get short SHA | ||
run: | | ||
echo SHORT_SHA="${GITHUB_SHA:0:7}" >> $GITHUB_ENV | ||
outputs: | ||
base_image_name: ${{ steps.image-name.outputs.result }} | ||
build_image: ${{ steps.image-name.outputs.result }}:${{ env.SHORT_SHA }} | ||
|
||
build: | ||
if: github.event_name != 'release' | ||
needs: setup | ||
env: | ||
BUILD_IMAGE: ${{ needs.setup.outputs.build_image }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Get build start time | ||
run: | | ||
echo BUILD_TIMESTAMP="$(date --utc --iso-8601=seconds)" >> $GITHUB_ENV | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ env.BUILD_IMAGE }} | ||
build-args: | | ||
BUILD_TIMESTAMP=${{ env.BUILD_TIMESTAMP }} | ||
BUILD_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
DOCKER_TAG=${{ env.BUILD_IMAGE }} | ||
GIT_BRANCH=${{ github.ref_name }} | ||
GIT_COMMIT=${{ github.sha }} | ||
GIT_URL=${{ github.repositoryUrl }} | ||
outputs: | ||
build_image: ${{ env.BUILD_IMAGE }} | ||
|
||
test: | ||
if: github.event_name != 'release' | ||
needs: build | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ${{ needs.build.outputs.build_image }} | ||
defaults: | ||
run: | ||
working-directory: /opt/app | ||
|
||
steps: | ||
- name: Run tests | ||
run: bundle exec rake spec | ||
|
||
- name: Run style checks | ||
run: bundle exec rake rubocop | ||
|
||
- name: Upload artifacts | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifacts | ||
path: /opt/artifacts/** |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
Dir.glob(File.expand_path('deo_volente/*.rb', __dir__)).each(&method(:require)) | ||
|
||
module BerkeleyLibrary | ||
# A set of helper tools for loading data into the UC Berkeley Dataverse | ||
module DeoVolente | ||
end | ||
end |
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