Skip to content

Commit

Permalink
Bump CI actions (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
petruki authored Dec 19, 2023
1 parent e60b53b commit c53cda5
Show file tree
Hide file tree
Showing 8 changed files with 222 additions and 66 deletions.
6 changes: 2 additions & 4 deletions .github/ISSUE_TEMPLATE/patch_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ assignees: petruki
A clear and concise description of why the patch is needed.

**Current dependency**
- **Name**:
- **Version**:
- **name@version**:

**Optional - Remediation**
- **Name**:
- **Version**:
- **name@version**:

**Additional context**
Links or documentation to the vulnerability or dependency update.
85 changes: 44 additions & 41 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,31 @@ jobs:
concurrency: ci-${{ github.ref }}

steps:
- uses: actions/checkout@v3
with:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"

- name: Install dependencies
run: pip install -r tests/requirements.txt

- name: Test
run: pytest -v --cov=./ --cov-report xml

- name: Fix code coverage path
working-directory: ./
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml

- name: SonarCloud Scan
uses: sonarsource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"

- name: Install dependencies
run: pip install -r tests/requirements.txt
- name: Test
run: pytest -v --cov=./ --cov-report xml

- name: Fix code coverage path
working-directory: ./
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml

- name: SonarCloud Scan
uses: sonarsource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

docker:
name: Publish Docker Image
Expand All @@ -50,20 +51,20 @@ jobs:

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

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

- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
Expand All @@ -76,28 +77,30 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: 'master'

- name: Checkout Kustomize
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.ARGOCD_PAT }}
repository: switcherapi/switcher-deployment
ref: master

- name: Set Image
uses: stefanprodan/kube-tools@v1
- name: Set up arkade-get
uses: alexellis/arkade-get@master
with:
kubectl: 1.24.0
kustomize: 4.5.4
command: |
cd switcher-slack-app/base
echo RELEASE_TIME=`date` > environment-properties.env
kustomize edit set image trackerforce/switcher-slack-app:latest=trackerforce/switcher-slack-app@${{ needs.docker.outputs.digest }}
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
git add .
git commit -m "[argocd] switcher-slack-app: ${{ needs.docker.outputs.digest }}"
git push
kubectl: latest
kustomize: latest

- name: Update GitOps repository
run: |
cd switcher-slack-app/base
echo RELEASE_TIME=`date` > environment-properties.env
kustomize edit set image trackerforce/switcher-slack-app:latest=trackerforce/switcher-slack-app@${{ needs.docker.outputs.digest }}
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
git add .
git commit -m "[argocd] switcher-slack-app: ${{ needs.docker.outputs.digest }}"
git push
39 changes: 21 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"

- name: Install dependencies
run: pip install -r tests/requirements.txt

- name: Test
run: pytest
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"

- name: Install dependencies
run: pip install -r tests/requirements.txt

- name: Test
run: pytest

docker:
name: Publish Docker Image
Expand All @@ -30,28 +33,28 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: trackerforce/switcher-slack-app

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

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

- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
push: true
Expand Down
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [[email protected]](mailto:[email protected]). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [https://contributor-covenant.org/version/1/4][version]

[homepage]: https://contributor-covenant.org
[version]: https://contributor-covenant.org/version/1/4/
85 changes: 85 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Contributing to Switcher Project

The following is a set of guidelines for contributing to Switcher Project. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.

#### Table Of Contents

[Code of Conduct](#code-of-conduct)

[How Can I Contribute?](#how-can-i-contribute)
* [Reporting Bugs](#reporting-bugs)
* [Suggesting Enhancements](#suggesting-enhancements)
* [Your First Code Contribution](#your-first-code-contribution)
* [Pull Requests](#pull-requests)

## Code of Conduct

This project and everyone participating in it is governed by the [Switcher Project Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [[email protected]](mailto:[email protected]).

You can join the Switcher-HQ Slack team:

* [Join the Slack Team](https://switcher-hq.slack.com/)
* Even though Slack is a chat service, sometimes it takes several hours for community members to respond — please be patient!
* Use the `#random` channel for general questions or discussion about Switcher Project

## How Can I Contribute?

### Reporting Bugs

This section guides you through submitting a bug report. Following these guidelines helps maintainers and the community understand your report, reproduce the behavior, and find related reports.

1. Use the GitHub issue search — check if the issue has already been reported.
2. Check if the issue has been fixed — try to reproduce it using the latest master or development branch in the repository.

Example:

> Short and descriptive example bug report title
>
> A summary of the issue. If suitable, include the steps required to reproduce the bug.
>
> 1. This is the first step
> 2. This is the second step
> 3. Further steps, etc.
>
> Any other information you want to share that is relevant to the issue being
> reported. This might include the lines of code that you have identified as
> causing the bug, and potential solutions (and your opinions on their
> merits).
> **Note:** If you find a **Closed** issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.
### Suggesting Enhancements

This section guides you through submitting an enhancement suggestion for Switcher Project, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion and find related suggestions.

Simply create an issue and provide the following information:

* **Use a clear and descriptive title** for the issue to identify the suggestion.
* **Provide a step-by-step description of the suggested enhancement** in as much detail as possible. This additional context helps the maintainers to understand the enhancement from your perspective
* **Explain why this enhancement would be useful**

### Your First Code Contribution

Unsure where to begin contributing to Switcher? You can start by looking through these `minor-issue` and `bug` issues:

* Minor issue - issues which should only require a few lines of code, and a test or two.
* Bug - issues which should be a bit more involved than `minor` issues.

### Pull Requests

The process described here has several goals:

- Maintain Switcher's Project quality
- Fix problems that are important to users
- Engage the community in working toward the best possible Switcher
- Enable a sustainable system for Switcher's maintainers to review contributions

Please follow these steps to have your contribution considered by the maintainers:

1. Fork the repository
2. Clone the repository
3. Create a branch
4. Make necessary changes and commit those changes
5. Push changes to GitHub
6. Submit your changes for review
7. Keeping your fork synced with this repository
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023-present Roger Floriano (petruki) and Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ A summary message containing all details about the change will be sent to a spec
## Requirements
- Python 3.11
- VirtualEnv
- Ngrok
- Ngrok (Slack Apps requires HTTPS endpoint)

## Create Slack App

Expand All @@ -71,7 +71,7 @@ Assuming that you have signed up for a Slack account and are logged in to a Work
4. Create a .env file based on .env.template and paste the copied values.
5. Make sure that the SWITCHER_JWT_SECRET matches the Switcher API env value for SWITCHER_SLACK_JWT_SECRET
6. Make sure that Switcher Management has SWITCHERSLACKAPP_URL set to the app URL
7. Start the API by running: py .\src\app.py
7. Start the API by running: `python src\app.py`

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ version: '3.8'

services:
switcherslackapp:
image: trackerforce/switcher-slack-app
image: trackerforce/switcher-slack-app:latest
container_name: switcherslackapp
command: gunicorn --bind 0.0.0.0:5000 --chdir /home/app app:flask_app
# TLS Enabled
Expand Down

0 comments on commit c53cda5

Please sign in to comment.