Skip to content

Commit

Permalink
ci: Fix Github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
gabyx committed Jun 25, 2024
1 parent 3ecd0c1 commit 6dfc0cd
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 32 deletions.
47 changes: 30 additions & 17 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
name: rdf-protect

on: [push]
on:
push:
branches:
- main
- "feat/*"
- "fix/*"

pull_request:
branches:
- main

jobs:
trigger-gitlab:
format:
runs-on: ubuntu-latest
container:
image: ghcr.io/sdsc-ordes/rdf-protect:ci-format-1.0.0
steps:
- source .gitlab/scripts/before-script.sh &&
just nix-develop-ci just format

lint:
runs-on: ubuntu-latest
environment: "CI Gitlab"
container:
image: ghcr.io/sdsc-ordes/rdf-protect:ci-lint-1.0.0
steps:
- name: Checkout
uses: actions/checkout@v4
- source .gitlab/scripts/before-script.sh &&
just nix-develop-ci just lint

- name: Mirror + Trigger CI
uses: SvanBoxel/gitlab-mirror-and-ci-action@master
with:
args: "https://gitlab.datascience.ch/gabriel.nuetzi/rdf-protect"
env:
FOLLOW_TAGS: "true"
FORCE_PUSH: "true"
GITLAB_HOSTNAME: "gitlab.datascience.ch"
GITLAB_USERNAME: ${{ secrets.GITLAB_USERNAME }}
GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }}
GITLAB_PROJECT_ID: "454"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
runs-on: ubuntu-latest
container:
image: ghcr.io/sdsc-ordes/rdf-protect:ci-build-1.0.0
steps:
- source .gitlab/scripts/before-script.sh &&
just nix-develop-ci just lint
24 changes: 24 additions & 0 deletions .github/workflows/trigger-gitlab.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: rdf-protect

on: [push]

jobs:
trigger-gitlab:
runs-on: ubuntu-latest
environment: "CI Gitlab"
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Mirror + Trigger CI
uses: SvanBoxel/gitlab-mirror-and-ci-action@master
with:
args: "https://gitlab.datascience.ch/gabriel.nuetzi/rdf-protect"
env:
FOLLOW_TAGS: "true"
FORCE_PUSH: "true"
GITLAB_HOSTNAME: "gitlab.datascience.ch"
GITLAB_USERNAME: ${{ secrets.GITLAB_USERNAME }}
GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }}
GITLAB_PROJECT_ID: "454"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 10 additions & 10 deletions .gitlab/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ stages:
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
when: always

lint:
stage: lint
format:
stage: format
needs: []
image: ghcr.io/sdsc-ordes/rdf-protect:ci-lint-1.0.0
image: ghcr.io/sdsc-order/rdf-protect:ci-format-1.0.0
rules:
- *defaults-rules
script:
- source .gitlab/scripts/before-script.sh
- nix develop .#ci --command just lint
- just nix-develop-ci just format-general
- just nix-develop-ci just format

format:
stage: format
lint:
stage: lint
needs: []
image: ghcr.io/sdsc-order/rdf-protect:ci-format-1.0.0
image: ghcr.io/sdsc-ordes/rdf-protect:ci-lint-1.0.0
rules:
- *defaults-rules
script:
- source .gitlab/scripts/before-script.sh
- nix develop .#ci --command just format-general
- nix develop .#ci --command just format
- just nix-develop-ci just lint

build:
stage: build
Expand All @@ -41,4 +41,4 @@ build:
- *defaults-rules
script:
- source .gitlab/scripts/before-script.sh
- nix develop .#ci --command just build
- just nix-develop-ci just build
2 changes: 1 addition & 1 deletion .gitlab/scripts/before-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ set -u
ROOT_DIR=$(git rev-parse --show-toplevel)
. "$ROOT_DIR/tools/general.sh"

ci_container_mgr_setup
# ci_container_mgr_setup

unset ROOT_DIR
17 changes: 13 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ container_mgr := "podman"
nix-develop shell="zsh":
cd "{{root_dir}}" && nix develop ./tools/nix#default --command zsh


# Build the executable.
build *args:
cd "{{root_dir}}" && cargo build "${@:1}"
Expand All @@ -23,18 +24,26 @@ watch:
run:
cd "{{root_dir}}" && cargo run "${@:1}"

format-general *args:
# Not implemented yet.
true

# Format the code.
format *args:
cd "{{comp_dir}}" && \
"{{root_dir}}/tools/format-rust.sh" {{args}}

# Format all files other files.
format-general *args:
# Not implemented yet.
true

# Lint all code.
lint *args:
cd "{{comp_dir}}" && \
"{{root_dir}}/tools/lint-rust.sh" {{args}}

# Upload all images for CI.
upload-ci-images:
cd "{{root_dir}}" && \
.gitlab/scripts/upload-images.sh

# Enter a Nix development shell for CI.
nix-develop-ci:
cd "{{root_dir}}" && nix develop ./tools/nix#default --command "$@"

0 comments on commit 6dfc0cd

Please sign in to comment.