Skip to content

Commit

Permalink
Merge pull request #28 from cdalvaro/feat/migrate_from_circleci_to_gi…
Browse files Browse the repository at this point in the history
…thub_actions

Migrate from CircleCI to GitHub Actions
  • Loading branch information
cdalvaro authored Jun 7, 2020
2 parents 5ea32b0 + 551f879 commit 102fb6f
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 214 deletions.
214 changes: 0 additions & 214 deletions .circleci/config.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: cdalvaro
18 changes: 18 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
- keep-alive
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
79 changes: 79 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build and test

on:
pull_request:
branches:
- master

env:
REGISTRY: docker.io
IMAGE_NAME: cdalvaro/saltstack-master
IMAGE_TAG: ci
GITHUB_REF_NAME: ${{ github.event.release.tag_name }}

jobs:
build:
name: Build Docker image
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Set env variables
run: |
echo ::set-env name=CACHE_FROM::"${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
echo ::set-env name=DOCKER_IMAGE::"${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}"
- name: Checkout repository
uses: actions/checkout@v2

- name: Cache lastest image
run: docker pull ${CACHE_FROM}

- name: Build Docker image
run: |
docker build \
--build-arg VCS_REF=${GITHUB_REF_NAME:-${GITHUB_SHA}} \
--build-arg BUILD_DATE="$(date +"%Y-%m-%d %H:%M:%S%:z")" \
--cache-from ${CACHE_FROM} \
--tag ${DOCKER_IMAGE} .
- name: Save docker image
run: |
mkdir -p docker/
docker save -o docker/docker-image.tar ${DOCKER_IMAGE}
- name: Upload image for test job
uses: actions/upload-artifact@v2
with:
name: docker-image
path: docker/docker-image.tar

test:
name: Test Docker image
needs: build
runs-on: ubuntu-latest
env:
CONTAINER_NAME: salt_master_ci
steps:
- name: Download docker image from build job
uses: actions/download-artifact@v2
with:
name: docker-image
path: docker/

- name: Load docker image from build job
run: docker load -i docker/docker-image.tar

- name: Launch docker container
run: docker run --rm -d --name "${CONTAINER_NAME}" "${IMAGE_NAME}:${IMAGE_TAG}"

- name: Show container info
run: docker container ls

- name: Wait for salt-master bootup
run: sleep 60

- name: Show salt versions
run: docker exec "${CONTAINER_NAME}" salt --versions

- name: Test image calling healthcheck
run: docker exec "${CONTAINER_NAME}" /usr/local/sbin/healthcheck

0 comments on commit 102fb6f

Please sign in to comment.