Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Create GitHub Actions workflow to publish Docker images (#332)
* Create GitHub Actions workflow to publish Docker images * Add build release configuration file * Update README configuration table
- Loading branch information
Showing
4 changed files
with
162 additions
and
22 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,106 @@ | ||
name: Semantic Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Semantic Release | ||
uses: buildlyio/semantic-release-action@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Start OpenLDAP Server | ||
id: ldap_server | ||
run: | | ||
docker run -p 389:389 -p 636:636 --name openldap_server -d osixia/openldap:1.3.0 | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get install libsasl2-dev libldap2-dev libssl-dev | ||
sudo touch /var/log/buildly.log | ||
sudo chown runner:docker /var/log/buildly.log | ||
cat requirements/base.txt | grep "^Django==\|^psycopg2" | xargs pip install | ||
pip install -r requirements/ci.txt | ||
- name: Lint & Vulnerability check | ||
run: | | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
bandit -r . -ll | ||
- name: Test with pytest | ||
run: | | ||
pytest | ||
env: | ||
ALLOWED_HOSTS: "*" | ||
CORS_ORIGIN_WHITELIST: "*" | ||
DATABASE_ENGINE: "postgresql" | ||
DATABASE_NAME: "buildly_api" | ||
DATABASE_USER: "root" | ||
DATABASE_PASSWORD: "root" | ||
DATABASE_HOST: "localhost" | ||
DATABASE_PORT: "5432" | ||
DEFAULT_ORG: "Default Organization" | ||
DJANGO_SETTINGS_MODULE: "buildly.settings.production" | ||
SOCIAL_AUTH_GITHUB_REDIRECT_URL: "/complete/github" | ||
SOCIAL_AUTH_GOOGLE_OAUTH2_REDIRECT_URL: "/complete/google-oauth2" | ||
SOCIAL_AUTH_MICROSOFT_GRAPH_REDIRECT_URL: "/complete/microsoft-graph" | ||
JWT_ISSUER: "buildly" | ||
JWT_PRIVATE_KEY_RSA_BUILDLY: |- | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIBOwIBAAJBALFc9NFZaOaSwUMPNektbtJqEjYZ6IRBqhqvJu1hKPYn9HYd75c0 | ||
gIDYHJ9lb7QwQvg44aO27104rDK0xSstzL0CAwEAAQJAe5z5096oyeqGX6J+RGGx | ||
11yuDJ7J+0N4tthUHSWWUtgkd19NvmTM/mVLmPCzZHgNUT+aWUKsQ84+jhru/NQD | ||
0QIhAOHOzFmjxjTAR1jspn6YtJBKQB40tvT6WEvm2mKm0aD7AiEAyRPwXyZf3JT+ | ||
M6Ui0Mubs7Qb/E4g1d/kVL+o/XoZC6cCIQC+nKzPtnooKW+Q1yOslgdGDgeV9/XB | ||
Ulqap+MNh7hJZQIgZNaM+wqhlFtbx8aO2SrioJI4XqVHrjojpaSgOM3cdY0CIQDB | ||
Q6ckOaDV937acmWuiZhxuG2euNLwNbMldtCV5ADo/g== | ||
-----END RSA PRIVATE KEY----- | ||
JWT_PUBLIC_KEY_RSA_BUILDLY: |- | ||
-----BEGIN PUBLIC KEY----- | ||
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALFc9NFZaOaSwUMPNektbtJqEjYZ6IRB | ||
qhqvJu1hKPYn9HYd75c0gIDYHJ9lb7QwQvg44aO27104rDK0xSstzL0CAwEAAQ== | ||
-----END PUBLIC KEY----- | ||
SECRET_KEY: "nothing" | ||
OAUTH_CLIENT_ID: "vBn4KsOCthm7TWzMH0kVV0dXkUPJEtOQwaLu0eoC" | ||
OAUTH_CLIENT_SECRET: "0aYDOHUNAxK4MjbnYOHhfrKx8EzjKqN6GbB6IGyCgpT6pmQ5pEVJmH7mIEUJ" | ||
DOCKER_REPO: "buildly/buildly" | ||
LDAP_ENABLE: "True" | ||
LDAP_HOST: "ldap://localhost:389" | ||
LDAP_USERNAME: "cn=admin,dc=example,dc=org" | ||
LDAP_PASSWORD: "admin" | ||
LDAP_BASE_DN: "dc=example,dc=org" | ||
|
||
- name: Docker Build & Release | ||
if: steps.semantic.outputs.new_release_published == 'true' | ||
run: | | ||
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | ||
docker build --tag ${BUILDLY_IMAGE} . | ||
docker push ${BUILDLY_IMAGE} | ||
env: | ||
BUILDLY_IMAGE: buildly/buildly:v${{ steps.semantic.outputs.new_release_version }} | ||
|
||
# postgres | ||
services: | ||
postgres: | ||
image: postgres:9.6 | ||
env: | ||
POSTGRES_USER: root | ||
POSTGRES_PASSWORD: root | ||
POSTGRES_DB: buildly_api | ||
ports: | ||
- 5432:5432 | ||
# needed because the postgres container does not provide a healthcheck | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
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,8 @@ | ||
module.exports = { | ||
branches: ['master'], | ||
plugins: [ | ||
'@semantic-release/commit-analyzer', | ||
'@semantic-release/release-notes-generator', | ||
"@semantic-release/github", | ||
], | ||
}; |
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