-
Notifications
You must be signed in to change notification settings - Fork 206
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
[ci] Migrate CI from GitLab to GitHub #593
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4a80845
[ci] Migrate CI from GitLab to GitHub
alvicsam 18c5ac4
fix docker path
alvicsam 3d09d7d
unite backend jobs into one workflow
alvicsam 9dd944d
rm files
alvicsam 63daa22
add cache-on-failure to tests cache
alvicsam 9ca02f9
add deploy workflow
alvicsam 09c7bcd
change wfl name
alvicsam 85186bd
readme
alvicsam ca4993f
fix readme
alvicsam 8f78aec
typo
alvicsam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
name: Backend CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- ".github/workflows/backend*" | ||
- "backend/**" | ||
- "!frontend/**" | ||
pull_request: | ||
paths: | ||
- ".github/workflows/backend*" | ||
- "backend/**" | ||
- "!frontend/**" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
defaults: | ||
run: | ||
working-directory: ./backend | ||
|
||
jobs: | ||
check: | ||
name: Check Code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Rust Cache | ||
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | ||
with: | ||
workspaces: backend | ||
|
||
- name: Build | ||
run: cargo check --all-targets --verbose | ||
tests: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Rust Cache | ||
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | ||
with: | ||
workspaces: backend | ||
cache-on-failure: true | ||
|
||
- name: Cargo test | ||
run: cargo test --verbose --jobs 1 | ||
docs: | ||
name: Check Documentation | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Rust Cache | ||
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | ||
with: | ||
workspaces: backend | ||
|
||
- name: Check internal documentation links | ||
run: RUSTDOCFLAGS="--deny broken_intra_doc_links" cargo doc --verbose --workspace --no-deps --document-private-items | ||
fmt: | ||
name: Run rustfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
components: clippy, rustfmt | ||
|
||
- name: Cargo fmt | ||
run: cargo fmt --verbose --all -- --check |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Docker Build | ||
# Workflow checks that docker build works | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
IMAGE_NAME: parity/substrate-telemetry | ||
|
||
jobs: | ||
set-variables: | ||
name: Set variables | ||
runs-on: ubuntu-latest | ||
outputs: | ||
VERSION: ${{ steps.version.outputs.VERSION }} | ||
steps: | ||
- name: Define version | ||
id: version | ||
run: | | ||
export COMMIT_SHA=${{ github.sha }} | ||
export COMMIT_SHA_SHORT=${COMMIT_SHA:0:8} | ||
export REF_NAME=${{ github.ref_name }} | ||
export REF_SLUG=${REF_NAME//\//_} | ||
if [[ ${REF_SLUG} == "main" ]] | ||
then | ||
echo "VERSION=${REF_SLUG}-${COMMIT_SHA_SHORT}" >> $GITHUB_OUTPUT | ||
else | ||
echo "VERSION=${REF_SLUG}" >> $GITHUB_OUTPUT | ||
fi | ||
echo "set VERSION=${VERSION}" | ||
|
||
build_backend: | ||
name: Build backend docker image | ||
runs-on: ubuntu-latest | ||
needs: [set-variables] | ||
env: | ||
VERSION: ${{ needs.set-variables.outputs.VERSION }} | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build and push Docker image from main | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: backend | ||
file: ./backend/Dockerfile | ||
push: false | ||
tags: | | ||
${{ env.IMAGE_NAME }}-backend:${{ env.VERSION }} | ||
|
||
build_frontend: | ||
name: Build frontend docker image | ||
runs-on: ubuntu-latest | ||
needs: [set-variables] | ||
env: | ||
VERSION: ${{ needs.set-variables.outputs.VERSION }} | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build and push Docker image from main | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: frontend | ||
file: ./frontend/Dockerfile | ||
push: false | ||
tags: | | ||
${{ env.IMAGE_NAME }}-frontend:${{ env.VERSION }} |
This file contains 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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is there a reason to exclude
frontend
? These paths shouldn't collide, right?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 sure that there is a reason, it was done previously and I only copy-pasted this part.
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.
I would guess that the reason is so that PRs which make only frontend changes don't need to trigger any sort of backend related CI jobs.
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.
@mutantcornholio meant that
"backend/**"
should be already enough to trigger backend workflow only for changes in backend path and"!frontend/**"
might be redundant.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.
Oh I see! Yeah maybe it was just being extra sure or something then :D