forked from NicolasT/static-container-registry
-
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 #4 from scality/feature/ZENKO-3749-github-actions
- Loading branch information
Showing
10 changed files
with
191 additions
and
136 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,85 @@ | ||
name: static-container-registry | ||
|
||
on: push | ||
|
||
env: | ||
DOCKER_IMAGE: registry.scality.com/static-container-registry-dev/static-container-registry | ||
|
||
jobs: | ||
pylint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
#TODO: add annotations | ||
#- uses: cclauss/[email protected] | ||
- name: Install dependencies | ||
run: | | ||
pip install pylint | ||
- name: Analysing the code with pylint | ||
run: | | ||
pylint `ls -R|grep .py$|xargs` | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildk | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: registry.scality.com | ||
username: ${{ secrets.REGISTRY_LOGIN }} | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: "${{ env.DOCKER_IMAGE }}:${{ github.sha }}" | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
test: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install dependencies | ||
run: | | ||
OS=xUbuntu_20.04 | ||
CRIO_VERSION=1.21 | ||
KUBIC_REPO=https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable | ||
sudo tee /etc/apt/sources.list.d/kubic-libcontainers.list <<< "deb $KUBIC_REPO/$OS/ /" | ||
sudo tee -a /etc/apt/sources.list.d/kubic-libcontainers.list <<< "deb $KUBIC_REPO:/cri-o:/$CRIO_VERSION/$OS/ /" | ||
curl -L $KUBIC_REPO/$OS/Release.key | sudo apt-key add - | ||
curl -L $KUBIC_REPO:/cri-o:/$CRIO_VERSION/$OS/Release.key | sudo apt-key add - | ||
sudo apt-get update | ||
sudo apt-get -y install cri-o cri-o-runc cri-tools hardlink | ||
# Fix libpcre2-posix2 package version, use the | ||
sudo apt-get -y install --reinstall --allow-downgrades libpcre2-posix2/$(lsb_release -cs) | ||
# Also need oras, skopeo ; but they are already installed | ||
bash <(curl -s https://raw.githubusercontent.com/pgrange/bash_unit/master/install.sh) | ||
# Start cri-o service | ||
sudo systemctl start crio | ||
# TODO: cache the installed image? | ||
|
||
- name: Unit testing with bash_unit | ||
run: | | ||
export IMAGE="${{ env.DOCKER_IMAGE }}:${{ github.sha }}" | ||
sudo FORCE_COLOR=true ./bash_unit test.sh | ||
# TODO: parse individual tests results (in TAP format) | ||
# - uses: dorny/test-reporter@v1 | ||
# if: success() || failure() |
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,43 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*.*.*' | ||
|
||
env: | ||
DOCKER_IMAGE: registry.scality.com/static-container-registry/static-container-registry | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildk | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: registry.scality.com | ||
username: ${{ secrets.REGISTRY_LOGIN }} | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: "${{ env.DOCKER_IMAGE }}:${{ github.ref_name }}" | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref_name }} | ||
release_name: Release ${{ github.ref_name }} |
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
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 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,16 +1,23 @@ | ||
FROM docker.io/ubuntu:xenial | ||
ARG OS_VERSION=20.04 | ||
FROM docker.io/ubuntu:$OS_VERSION | ||
|
||
RUN apt-get update \ | ||
ARG OS_VERSION | ||
ARG REPOSITORY=https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable | ||
RUN export DEBIAN_FRONTEND=noninteractive \ | ||
&& \ | ||
apt-get install -y software-properties-common\ | ||
apt-get update \ | ||
&& \ | ||
apt-get install -y curl software-properties-common \ | ||
&& \ | ||
echo "deb ${REPOSITORY}/xUbuntu_${OS_VERSION}/ /" > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list \ | ||
&& \ | ||
add-apt-repository ppa:projectatomic/ppa \ | ||
curl -L ${REPOSITORY}/xUbuntu_${OS_VERSION}/Release.key | apt-key add - \ | ||
&& \ | ||
apt-get update \ | ||
&& \ | ||
apt-get install -y skopeo | ||
|
||
RUN apt-get install \ | ||
RUN apt-get install -y \ | ||
hardlink | ||
|
||
COPY provision-images.sh /provision-images.sh |
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,28 +1,29 @@ | ||
FROM docker.io/ubuntu:xenial | ||
ARG OS_VERSION=20.04 | ||
FROM docker.io/ubuntu:$OS_VERSION | ||
|
||
RUN apt-get update \ | ||
ARG OS_VERSION | ||
ARG REPOSITORY=https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable | ||
RUN export DEBIAN_FRONTEND=noninteractive \ | ||
&& \ | ||
apt-get install -y software-properties-common\ | ||
apt-get update \ | ||
&& \ | ||
apt-get install -y curl software-properties-common \ | ||
&& \ | ||
echo "deb ${REPOSITORY}/xUbuntu_${OS_VERSION}/ /" > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list \ | ||
&& \ | ||
add-apt-repository ppa:projectatomic/ppa \ | ||
curl -L ${REPOSITORY}/xUbuntu_${OS_VERSION}/Release.key | apt-key add - \ | ||
&& \ | ||
apt-get update \ | ||
&& \ | ||
apt-get install -y skopeo | ||
|
||
RUN apt-get update \ | ||
&& \ | ||
apt-get install -y \ | ||
apt-transport-https \ | ||
curl \ | ||
&& \ | ||
curl https://pgrange.github.io/bash-unit_deb/keys.asc | apt-key add - \ | ||
&& \ | ||
echo deb https://pgrange.github.io/bash-unit_deb/debian/ unstable/ | \ | ||
tee -a /etc/apt/sources.list.d/bash-unit.list \ | ||
&& \ | ||
apt-get update \ | ||
&& \ | ||
apt-get install bash-unit | ||
ARG ORAS_VERSION=0.12.0 | ||
RUN curl -#LO https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_amd64.tar.gz \ | ||
&& \ | ||
tar -zxf oras_${ORAS_VERSION}_*.tar.gz -C /usr/local/bin/ oras \ | ||
&& \ | ||
rm oras_${ORAS_VERSION}_*.tar.gz | ||
|
||
RUN [ "bash", "-c", "cd /usr/local/bin && bash <(curl -s https://raw.githubusercontent.com/pgrange/bash_unit/master/install.sh)" ] | ||
|
||
COPY test.sh / |
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
Oops, something went wrong.