-
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 #3 from TranslatorSRI/git-workflow-docker
Git workflow docker
- Loading branch information
Showing
5 changed files
with
120 additions
and
8 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,42 @@ | ||
name: 'Release a new version of Redis-TPF to Github Packages' | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to GitHub Packages tagged with "latest" and version number. | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
- name: Get the version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: | ||
ghcr.io/${{ github.repository }} | ||
- name: Login to ghcr | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Push to GitHub Packages | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: BRANCH_NAME=${{ github.event.release.target_commitish }} |
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,37 @@ | ||
name: 'test' | ||
|
||
on: [push] | ||
|
||
jobs: | ||
test: | ||
name: test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.11.0] | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Create environment variables | ||
run: | | ||
echo "PYTHONPATH=$PWD" >> $GITHUB_ENV | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Run redis | ||
run: docker run --name redis-container -d -p 6379:6379 -t redis --password nop | ||
|
||
- name: Install dependencies | ||
run: | | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Install pytest | ||
run: pip install pytest | ||
|
||
- name: Run the tests | ||
run: | | ||
python -m pytest tests/ |
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,25 @@ | ||
from ghcr.io/translatorsri/renci-python-image:3.11.5 | ||
|
||
|
||
RUN mkdir /home/nru | ||
|
||
RUN chown nru /home/nru | ||
|
||
# make a directory for the repo | ||
RUN mkdir /repo | ||
|
||
# go to the directory where we are going to upload the repo | ||
WORKDIR /repo | ||
|
||
RUN mkdir redis-tpf | ||
RUN chown nru redis-tpf | ||
USER nru | ||
|
||
COPY . redis-tpf | ||
|
||
|
||
WORKDIR redis-tpf | ||
ENV PYTHONPATH=/repo/redis-tpf | ||
|
||
RUN pip install -r requirements.txt | ||
|
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
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