add bypasscode to gitignore #223
This file contains hidden or 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
| name: CI/CD | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*.*.*"] | |
| pull_request: | |
| types: [opened, reopened, synchronize] | |
| jobs: | |
| format-build-test: | |
| strategy: | |
| matrix: | |
| go-version: ['1.24.x', '1.25.x'] | |
| platform: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| - if: matrix.platform == 'ubuntu-latest' | |
| run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi | |
| - run: go build -v ./... | |
| - run: make test | |
| docker-build-push: | |
| if: github.event_name != 'pull_request' | |
| needs: mysql-test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 | |
| - uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0 | |
| id: meta | |
| with: | |
| images: | | |
| ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=ref,event=branch | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=sha | |
| - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 | |
| with: | |
| context: . | |
| push: true | |
| file: Dockerfile.buildx | |
| platforms: linux/amd64,linux/arm64,linux/arm | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| release-zips: | |
| if: github.event_name != 'pull_request' | |
| needs: mysql-test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 | |
| with: | |
| go-version: '1.24.x' | |
| - run: CGO_ENABLED=0 make release | |
| - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: release-zips | |
| path: "*.zip" | |
| mysql-test: | |
| runs-on: 'ubuntu-latest' | |
| needs: format-build-test | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_RANDOM_ROOT_PASSWORD: yes | |
| MYSQL_DATABASE: nanodep | |
| MYSQL_USER: nanodep | |
| MYSQL_PASSWORD: nanodep | |
| ports: | |
| - 3800:3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| MYSQL_PWD: nanodep | |
| PORT: 3800 | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 | |
| with: | |
| go-version: '1.24.x' | |
| - name: verify mysql | |
| run: | | |
| while ! mysqladmin ping --host=localhost --port=$PORT --protocol=TCP --silent; do | |
| sleep 1 | |
| done | |
| - name: mysql schema | |
| run: | | |
| mysql --version | |
| mysql --user=nanodep --host=localhost --port=$PORT --protocol=TCP nanodep < ./storage/mysql/schema.sql | |
| - name: setup test dsn | |
| run: echo "NANODEP_MYSQL_STORAGE_TEST_DSN=nanodep:nanodep@tcp(localhost:$PORT)/nanodep" >> $GITHUB_ENV | |
| - run: go test -v ./storage/mysql | |
| pgsql-test: | |
| runs-on: 'ubuntu-latest' | |
| needs: format-build-test | |
| services: | |
| postgres: | |
| image: postgres:13.16 | |
| env: | |
| POSTGRES_DB: nanodep | |
| POSTGRES_USER: nanodep | |
| POSTGRES_PASSWORD: nanodep | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| env: | |
| PGPASSWORD: nanodep | |
| PORT: 5432 | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 | |
| with: | |
| go-version: '1.24.x' | |
| - name: pgsql schema | |
| run: psql -h localhost -U nanodep -d nanodep -f ./storage/pgsql/schema.sql | |
| - name: setup test dsn | |
| run: echo "NANODEP_PSQL_STORAGE_TEST_DSN=postgres://nanodep:@localhost/nanodep?sslmode=disable" >> $GITHUB_ENV | |
| - run: go test -v ./storage/pgsql |