mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-03 14:51:31 -04:00
fix: address remaining PR review comments
- Use PR-scoped concurrency key to prevent cancellation across forks - Reduce permissions: only release job needs contents:write - Add bounded retry loop for MariaDB startup (30 attempts max) - Derive Docker repo from DOCKER_USERNAME secret instead of hardcoding - Delete codeql-analysis.yml (no longer needed) - Update README: 'open-source' hyphenation, Docker image naming
This commit is contained in:
5
.github/workflows/README.md
vendored
5
.github/workflows/README.md
vendored
@@ -15,8 +15,8 @@ This document describes the CI/CD workflows for OSPOS.
|
||||
- Run PHPUnit tests with MariaDB started via Docker
|
||||
|
||||
### Docker Images
|
||||
- Build `ospos:latest` Docker image for multiple architectures (linux/amd64, linux/arm64)
|
||||
- Push to Docker Hub on master branch
|
||||
- Build and push `opensourcepos` Docker image for multiple architectures (linux/amd64, linux/arm64)
|
||||
- Image tagged with version and `latest`, pushed to Docker Hub on master branch
|
||||
|
||||
### Releases
|
||||
- Create distribution archives (tar.gz, zip)
|
||||
@@ -50,7 +50,6 @@ This repository also has these workflows:
|
||||
- `.github/workflows/main.yml` - PHP linting with PHP-CS-Fixer
|
||||
- `.github/workflows/phpunit.yml` - PHPUnit tests
|
||||
- `.github/workflows/php-linter.yml` - PHP linting
|
||||
- `.github/workflows/codeql-analysis.yml` - Security analysis
|
||||
|
||||
## Testing
|
||||
|
||||
|
||||
27
.github/workflows/build-release.yml
vendored
27
.github/workflows/build-release.yml
vendored
@@ -11,12 +11,11 @@ on:
|
||||
- master
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -162,10 +161,20 @@ jobs:
|
||||
-p 3306:3306 \
|
||||
mariadb:10.5
|
||||
|
||||
until docker exec mysql mysqladmin ping -h 127.0.0.1 -u root -proot --silent; do
|
||||
echo "Waiting for MariaDB..."
|
||||
for i in {1..30}; do
|
||||
if docker exec mysql mysqladmin ping -h 127.0.0.1 -u root -proot --silent; then
|
||||
echo "MariaDB is ready"
|
||||
break
|
||||
fi
|
||||
echo "Waiting for MariaDB... ($i/30)"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
docker exec mysql mysqladmin ping -h 127.0.0.1 -u root -proot --silent || {
|
||||
echo "MariaDB failed to become ready"
|
||||
docker logs mysql || true
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Initialize database
|
||||
run: docker exec -i mysql mysql -u root -proot ospos < app/Database/database.sql
|
||||
@@ -204,20 +213,24 @@ jobs:
|
||||
|
||||
- name: Build and push Docker images
|
||||
uses: docker/build-push-action@v5
|
||||
env:
|
||||
IMAGE_REPO: ${{ secrets.DOCKER_USERNAME }}/opensourcepos
|
||||
with:
|
||||
context: .
|
||||
target: ospos
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
jekkos/opensourcepos:${{ needs.build.outputs.version-tag }}
|
||||
jekkos/opensourcepos:latest
|
||||
${{ env.IMAGE_REPO }}:${{ needs.build.outputs.version-tag }}
|
||||
${{ env.IMAGE_REPO }}:latest
|
||||
|
||||
release:
|
||||
name: Create Release
|
||||
needs: [build, test]
|
||||
runs-on: ubuntu-22.04
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
||||
71
.github/workflows/codeql-analysis.yml
vendored
71
.github/workflows/codeql-analysis.yml
vendored
@@ -1,71 +0,0 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
schedule:
|
||||
- cron: '21 12 * * 3'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'javascript' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
# Learn more:
|
||||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
Reference in New Issue
Block a user