diff --git a/.github/workflows/README.md b/.github/workflows/README.md index a60d66a7e..832457fcb 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -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 diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 44175eb3f..0c21b21db 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -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 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 6218fde3a..000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -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 diff --git a/README.md b/README.md index 97e6a7a3c..1a46a4386 100644 --- a/README.md +++ b/README.md @@ -140,4 +140,4 @@ Any person or company found breaching the license agreement might find a bunch o |