Skip to content

Commit a091819

Browse files
authored
Use GitHub actions for release (#2)
1 parent 4802499 commit a091819

File tree

6 files changed

+154
-6
lines changed

6 files changed

+154
-6
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
steps:
4040
- name: Checkout repository
41-
uses: actions/checkout@v3
41+
uses: actions/checkout@v4
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL
@@ -48,11 +48,11 @@ jobs:
4848
# If you wish to specify custom queries, you can do so here or in a config file.
4949
# By default, queries listed here will override any specified in a config file.
5050
# Prefix the list here with "+" to use these queries and those in the config file.
51-
51+
5252
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
5353
queries: security-extended,security-and-quality
5454

55-
55+
5656
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5757
# If this step fails, then you should remove it and run the build manually (see below)
5858
- name: Autobuild
@@ -61,7 +61,7 @@ jobs:
6161
# ℹ️ Command-line programs to run using the OS shell.
6262
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
6363

64-
# If the Autobuild fails above, remove it and uncomment the following three lines.
64+
# If the Autobuild fails above, remove it and uncomment the following three lines.
6565
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
6666

6767
# - run: |

.github/workflows/main.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Main (test, releases)
2+
on:
3+
# # Indicates I want to run this workflow on all branches, PR, and tags
4+
push:
5+
branches: ["*"]
6+
tags: ["*"]
7+
pull_request:
8+
branches: [ "master" ]
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-22.04
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
command:
16+
- make vet
17+
- make fmtcheck
18+
steps:
19+
- name: Checkout Git repo
20+
uses: actions/checkout@v4
21+
- name: Running ${{ matrix.command }}
22+
run: ${{ matrix.command }}
23+
24+
tests:
25+
runs-on: ubuntu-22.04
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
target:
30+
- testversion5.6
31+
- testversion5.7
32+
- testversion8.0
33+
- testpercona5.7
34+
- testpercona8.0
35+
- testmariadb10.3
36+
- testmariadb10.8
37+
- testmariadb10.10
38+
# Track https://github.com/pingcap/tidb/tags
39+
- testtidb6.1.0
40+
- testtidb6.5.3
41+
# Fails because not yet available? 20240705
42+
# - testtidb6.5.10
43+
- testtidb7.1.5
44+
- testtidb7.5.2
45+
- testtidb8.1.0
46+
steps:
47+
- name: Checkout Git repo
48+
uses: actions/checkout@v4
49+
- name: Install mysql client
50+
run: |
51+
sudo apt-get update
52+
sudo apt-get -f -y install mysql-client
53+
- name: Run tests {{ matrix.target }}
54+
run: make ${{ matrix.target }}
55+
# DISABLED to figure out GPG signing issue on Github Actions
56+
# possibly due to lack of TTY inside docker?
57+
# release:
58+
# name: Release
59+
# needs: [tests]
60+
# # Can't use non-semvar for the testing tag
61+
# # https://github.com/orgs/goreleaser/discussions/3708
62+
# if: ( startsWith( github.ref, 'refs/tags/v' ) ||
63+
# startsWith(github.ref, 'refs/tags/v0.0.0-rc') )
64+
# runs-on: ubuntu-22.04
65+
# steps:
66+
# - name: Checkout Git repo
67+
# uses: actions/checkout@v4
68+
69+
# # Goreleaser
70+
# - name: Set up Go
71+
# uses: actions/setup-go@v4
72+
# - name: Run GoReleaser
73+
# uses: goreleaser/goreleaser-action@v6
74+
# with:
75+
# distribution: goreleaser
76+
# version: '~> v2'
77+
# # Run goreleaser and ignore non-committed files (downloaded artifacts)
78+
# args: release --clean --skip=validate --verbose
79+
# env:
80+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
82+
# terraform-provider-release:
83+
# needs: [release]
84+
# name: 'Terraform Provider Release'
85+
# uses: hashicorp/ghaction-terraform-provider-release/.github/workflows/community.yml@v5
86+
# secrets:
87+
# gpg-private-key: '${{ secrets.GPG_PRIVATE_KEY }}'
88+
# with:
89+
# setup-go-version-file: 'go.mod'

.goreleaser.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Visit https://goreleaser.com for documentation on how to customize this
22
# behavior.
3+
version: 2
34
before:
45
hooks:
56
# this is just an example and not a requirement for provider building/publishing
@@ -49,6 +50,6 @@ signs:
4950
- "${artifact}"
5051
release:
5152
# If you want to manually examine the release before its live, uncomment this line:
52-
# draft: true
53+
draft: true
5354
changelog:
5455
use: git

GNUmakefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ TERRAFORM_VERSION=0.14.7
66
TERRAFORM_OS=$(shell uname -s | tr A-Z a-z)
77
TEST_USER=root
88
TEST_PASSWORD=my-secret-pw
9+
DATESTAMP=$(shell date "+%Y%m%d%H%M%S")
10+
SHA_SHORT=$(shell git describe --match=FORCE_NEVER_MATCH --always --abbrev=40 --dirty --abbrev)
11+
MOST_RECENT_UPSTREAM_TAG=$(shell git for-each-ref refs/tags --sort=-taggerdate --format="%(refname)" | head -1 | grep -E -o "v\d+\.\d+\.\d+")
912

1013
default: build
1114

@@ -118,4 +121,12 @@ endif
118121

119122
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
120123

121-
.PHONY: build test testacc vet fmt fmtcheck errcheck vendor-status test-compile website website-test
124+
format-tag:
125+
@echo $(MOST_RECENT_UPSTREAM_TAG)-$(DATESTAMP)-$(SHA_SHORT)
126+
127+
tag:
128+
@echo git tag -a $(MOST_RECENT_UPSTREAM_TAG)-$(DATESTAMP)-$(SHA_SHORT) -m $(MOST_RECENT_UPSTREAM_TAG)-$(DATESTAMP)-$(SHA_SHORT)
129+
@git tag -a $(MOST_RECENT_UPSTREAM_TAG)-$(DATESTAMP)-$(SHA_SHORT) -m $(MOST_RECENT_UPSTREAM_TAG)-$(DATESTAMP)-$(SHA_SHORT)
130+
131+
132+
.PHONY: build test testacc vet fmt fmtcheck errcheck vendor-status test-compile website website-test tag

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,44 @@
1+
zph/terraform-provider-mysql
2+
3+
# Purpose
4+
5+
zph fork of terraform-provider-mysql exists for the following goals:
6+
1. To design and trial TiDB integrations or patches before committing upstream
7+
2. To validate design changes for the project before offering upstream.
8+
9+
Changes here are intended to be upstreamed to petoju's fork to avoid ecosystem
10+
fragmentation. We will update this readme if those design choices change.
11+
12+
## Release Naming
13+
14+
zph fork will use release naming in the following form:
15+
16+
v3.0.62-20240705125429-3c7af6a
17+
18+
{petoju version}-{date}-{sha}
19+
20+
This indicates that the base is v3.0.62 from petoju, with modifications from zph
21+
repo using {sha} and built on {date}.
22+
23+
It allows for keeping patches alive on this fork until they land upstream and are
24+
released there.
25+
26+
## Security / Chain of Custody
27+
28+
We sign releases with a GPG key currently using goreleaser locally on the personal
29+
equipment of @ZPH. As the maintainer of this fork, I, @ZPH, attest that the builds
30+
represent the exact SHA of the version control with no alterations.
31+
32+
The near term goal is to setup github actions to provide this guarantee
33+
so that even if I were a malicious actor or coerced,
34+
I could not introduce opaque security issues into binary releases.
35+
36+
In the meantime, I certify by my professional reputation and career as:
37+
https://www.linkedin.com/in/zph/ that appropriate safeguards are being taken.
38+
39+
## Original Readme
40+
Below is from petoju/terraform-provider-mysql:
41+
142
**This repository is an unofficial fork**
243

344
The fork is mostly based of the official (now archived) repo.

terraform-registry-manifest.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"version": 1,
3+
"metadata": {
4+
"protocol_versions": ["6.0"]
5+
}
6+
}

0 commit comments

Comments
 (0)