Skip to content

[PROPOSAL] remove mysql support #374

[PROPOSAL] remove mysql support

[PROPOSAL] remove mysql support #374

name: CI (Podman Devcontainer)
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
permissions:
contents: read
checks: write
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
cancel-in-progress: true
jobs:
devcontainer-checks:
name: Devcontainer CI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if codegen inputs changed
id: codegen
shell: bash
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
BASE="${{ github.event.pull_request.base.sha }}"
elif [[ -n "${{ github.event.before }}" && "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]]; then
BASE="${{ github.event.before }}"
else
echo "needed=true" >> "$GITHUB_OUTPUT"
echo "no base ref available, running codegen"
exit 0
fi
CHANGED=$(git diff --name-only "$BASE" HEAD -- \
singularity.go docgen.sh 'api/' 'handler/' 'cmd/' \
'storagesystem/' 'docs/gen/' 'model/' || true)
if [[ -n "$CHANGED" ]]; then
echo "needed=true" >> "$GITHUB_OUTPUT"
else
echo "needed=false" >> "$GITHUB_OUTPUT"
fi
echo "changed files for codegen: ${CHANGED:-none}"
- name: Setup Podman as Docker
uses: parkan/github-actions/setup-podman-docker@v3
with:
disable-docker: true
cache-storage: true
- name: Build devcontainer
id: build
uses: parkan/github-actions/devcontainer-build@v3
with:
workspace-folder: .
container-runtime: podman
container-id-label: ci=podman
- name: Generate swagger code
if: steps.codegen.outputs.needed == 'true'
uses: parkan/github-actions/devcontainer-exec@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
command: 'cd /workspaces/singularity && go generate ./...'
container-runtime: podman
- name: Check formatting
uses: parkan/github-actions/devcontainer-exec@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
command: 'cd /workspaces/singularity && gofmt -w . && git diff --exit-code'
container-runtime: podman
- name: Run go vet
uses: parkan/github-actions/devcontainer-exec@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
command: 'cd /workspaces/singularity && go vet ./...'
container-runtime: podman
- name: Run staticcheck
uses: parkan/github-actions/devcontainer-exec@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
command: 'cd /workspaces/singularity && staticcheck ./...'
container-runtime: podman
- name: Build binary
uses: parkan/github-actions/devcontainer-exec@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
command: 'cd /workspaces/singularity && go build -o singularity .'
container-runtime: podman
- name: Run tests
uses: parkan/github-actions/devcontainer-exec@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
command: >
cd /workspaces/singularity && mkdir -p artifacts && make test GOTESTSUM_ARGS="--junitfile artifacts/unit-tests.xml"
container-runtime: podman
- name: Run integration tests
uses: parkan/github-actions/devcontainer-exec@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
command: >
cd /workspaces/singularity &&
mkdir -p artifacts &&
SINGULARITY_TEST_INTEGRATION=true make test GOTESTSUM_ARGS="--junitfile artifacts/integration-tests.xml -- -timeout 20m -run Integration ./cmd/... ./service/pdptracker/..."
container-runtime: podman
- name: Report test results
if: always()
uses: dorny/test-reporter@v2
with:
name: Go tests
path: artifacts/*.xml
reporter: java-junit
list-tests: failed
use-actions-summary: true
fail-on-error: false
- name: Cleanup
if: always()
uses: parkan/github-actions/devcontainer-cleanup@v3
with:
container-id: ${{ steps.build.outputs.container-id }}
container-runtime: podman