-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate from CircleCI to Github Actions #324
Changes from 36 commits
936e3e4
fc31df4
8b77710
377df79
a45854b
266727e
bb36932
47e049d
0555abe
4b8b896
740b0fb
490936f
7dd0d34
7323c97
d33e66a
ebada40
9c72d3e
e893fe2
470b5a8
207773e
a6b5856
5314f21
9eda10b
a030ca5
7ef02b6
02679f7
9f60236
f427c7c
a9328f9
21c66f6
4c1fde9
52d89d2
8c12468
d50c28d
b8c1879
706bd12
6efdb33
fa52f48
ad1302b
7a9ef97
83df8c3
4fec13f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: cd | ||
on: | ||
workflow_run: | ||
workflows: ["ci"] | ||
branches-ignore: ["*"] | ||
types: | ||
- completed | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@dc323e67f16fb5f7663d20ff7941f27f5809e9b6 # v3.2.0 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: cd/build-docker | ||
run: make build-image | ||
|
||
- name: ci/push-docker | ||
run: | | ||
set -eu | ||
echo $DOCKERHUB_TOKEN | docker login --username $DOCKERHUB_USERNAME --password-stdin | ||
spirosoik marked this conversation as resolved.
Show resolved
Hide resolved
|
||
docker tag mattermost/mattermost-operator:test mattermost/mattermost-operator:$TAG | ||
docker push mattermost/mattermost-operator:$TAG | ||
env: | ||
TAG: ${{ github.ref_name }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
name: ci | ||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ci/checkout-repo | ||
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0 | ||
with: | ||
fetch-depth: 0 | ||
Comment on lines
+19
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sold on this. A shallow clone should be enough for the needs of CI. |
||
|
||
- name: ci/setup-go | ||
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 | ||
with: | ||
go-version: "1.19" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's use the gomod file in root dir, to dynamically setup the GoLang version during CI runtime /~https://github.com/actions/setup-go#getting-go-version-from-the-gomod-file |
||
cache: true | ||
|
||
- name: ci/check-style | ||
run: make check-style | ||
|
||
- name: ci/check-modules | ||
run: make check-modules | ||
|
||
test: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: ci/checkout-repo | ||
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0 | ||
with: | ||
fetch-depth: 0 | ||
Comment on lines
+39
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sold on this. A shallow clone should be enough for the needs of CI. |
||
path: src/github.com/mattermost/mattermost-operator | ||
|
||
- name: ci/setup-go | ||
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 | ||
with: | ||
go-version: "1.19" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's use the gomod file in root dir, to dynamically setup the GoLang version during CI runtime /~https://github.com/actions/setup-go#getting-go-version-from-the-gomod-file |
||
cache: true | ||
cache-dependency-path: src/github.com/mattermost/mattermost-operator/go.sum | ||
|
||
- name: ci/generate-operator-manifests | ||
run: | | ||
cd ${GITHUB_WORKSPACE}/src/github.com/mattermost/mattermost-operator | ||
|
||
make clean | ||
make operator-sdk | ||
|
||
mkdir -p /tmp/apis/mattermost/v1alpha1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mkdirs could be concantanated in a single line with : mkdir -p /tmp/apis/mattermost/v1alpha1 /tmp/apis/mattermost/v1beta1 /tmp/config/crd/bases Less syscalls ! |
||
cp -R apis/mattermost/v1alpha1/* /tmp/apis/mattermost/v1alpha1 | ||
mkdir -p /tmp/apis/mattermost/v1beta1 | ||
cp -R apis/mattermost/v1beta1/* /tmp/apis/mattermost/v1beta1 | ||
mkdir -p /tmp/config/crd/bases | ||
cp -R config/crd/bases/* /tmp/config/crd/bases | ||
|
||
GOPATH=${GITHUB_WORKSPACE} make generate manifests | ||
diff /tmp/apis/mattermost/v1alpha1 apis/mattermost/v1alpha1 | ||
diff /tmp/apis/mattermost/v1beta1 apis/mattermost/v1beta1 | ||
diff /tmp/config/crd/bases config/crd/bases | ||
|
||
- name: ci/test | ||
run: | | ||
cd ${GITHUB_WORKSPACE}/src/github.com/mattermost/mattermost-operator | ||
make unittest goverall | ||
|
||
- name: ci/test-e2e | ||
run: | | ||
cd ${GITHUB_WORKSPACE}/src/github.com/mattermost/mattermost-operator | ||
./test/e2e.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: I'd prefer to have this as part of a makefile target, to decouple from hard-calling the script. |
||
env: | ||
K8S_VERSION: v1.22.9 | ||
IMAGE_NAME: mattermost/mattermost-operator | ||
IMAGE_TAG: test | ||
KIND_VERSION: v0.17.0 | ||
SDK_VERSION: v1.0.1 | ||
|
||
build: | ||
if: ${{ github.event_name == 'pull_request' || github.ref_name == 'master' }} | ||
runs-on: ubuntu-latest | ||
needs: [lint, test] | ||
steps: | ||
- name: ci/checkout-repo | ||
uses: actions/checkout@dc323e67f16fb5f7663d20ff7941f27f5809e9b6 # v3.2.0 | ||
with: | ||
fetch-depth: 0 | ||
Comment on lines
+92
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sold on this. A shallow clone should be enough for the needs of CI. |
||
|
||
- name: ci/set-short-SHA | ||
run: echo "SHORT_SHA=${GITHUB_SHA:0:7}" >> $GITHUB_ENV | ||
|
||
- name: ci/build-docker | ||
run: make build-image | ||
|
||
- name: ci/scan-docker-security | ||
uses: aquasecurity/trivy-action@8bd2f9fbda2109502356ff8a6a89da55b1ead252 # v0.9.1 | ||
continue-on-error: true | ||
with: | ||
image-ref: "mattermost/mattermost-operator:test" | ||
format: "sarif" | ||
limit-severities-for-sarif: true # /~https://github.com/aquasecurity/trivy-action/blob/0.9.1/entrypoint.sh#L172 | ||
output: "trivy-results.sarif" | ||
exit-code: "1" | ||
ignore-unfixed: true | ||
vuln-type: "os,library" | ||
severity: "CRITICAL,HIGH" | ||
|
||
- name: ci/create-trivy-results-report | ||
# if: failure() | ||
uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4 | ||
with: | ||
sarif_file: "trivy-results.sarif" | ||
|
||
- name: ci/docker-login | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: ci/docker-push | ||
env: | ||
TAG: ${{ env.SHORT_SHA }} | ||
run: | | ||
set -eu | ||
docker tag mattermost/mattermost-operator:test mattermost/mattermost-operator:$TAG | ||
docker push mattermost/mattermost-operator:$TAG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sold on this. A shallow clone should be enough for the needs of CI.