Skip to content

Commit

Permalink
Merge pull request #115 from JasonFreeberg/master
Browse files Browse the repository at this point in the history
Add GitHub Actions workflows
  • Loading branch information
dtcarls authored Dec 26, 2021
2 parents 0870d53 + c593d98 commit 7980856
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 20 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run tests on PRs and commits

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
workflow_dispatch:

env:
BOT_ID: 916ccfd76a7fda25c74d09e1d5
LEAGUE_ID: 164483
TEST_TAG: user/test_build:test

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build container
uses: docker/build-push-action@v2
with:
push: false
context: .
load: true
tags: ${{ env.TEST_TAG }}

- name: Run image against tests
run: docker run ${{ env.TEST_TAG }} python /usr/src/ff_bot/setup.py test
52 changes: 52 additions & 0 deletions .github/workflows/publish_image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish image on commit or published release

on:
push:
branches:
- master
- main
release:
types:
- published

jobs:
push-image:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Set tag name for releases
if: ${{ github.event_name == 'release' }}
run: echo "TAG=ghcr.io/${GITHUB_REPOSITORY,,}:${GITHUB_REF##*/}" >>${GITHUB_ENV}

- name: Set tag name for commits
if: ${{ github.event_name == 'push' }}
run: echo "TAG=ghcr.io/${GITHUB_REPOSITORY,,}:${{ github.sha }}" >>${GITHUB_ENV}

- name: Build image
uses: docker/build-push-action@v2
with:
load: true
push: false
tags: ${{ env.TAG }}

- name: Test image
run: docker run ${{ env.TAG }} python /usr/src/ff_bot/setup.py test

- name: Push image to registry
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ env.TAG }}
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:latest
FROM python:3.9.9-slim-bullseye

# Install app
ADD . /usr/src/ff_bot
Expand Down

0 comments on commit 7980856

Please sign in to comment.